Repository navigation
Conversation
Backport #56820 to the release branch's static detector and xUnit theory data. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
/tactics |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the targeted OpenCode detection backport.
No open issues 🎉
What changed in this PR
Backports the OpenCode detection fix to the release branch’s existing static detector without importing main-branch refactors.
Changes:
- Detects OpenCode through
OPENCODEinstead ofOPENCODE_AI, preserving nonempty-value semantics. - Adds regression cases for nonempty, empty, and obsolete markers, and isolates both environment variables during tests.
| File | Description |
|---|---|
test/dotnet.Tests/TelemetryCommonPropertiesTests.cs |
Adds OpenCode regression cases and updates environment isolation. |
src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs |
Corrects the marker used for the existing opencode classification. |
Review effort: Balanced
3 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Semantic backport of #56820 (merge commit a7d7d44).
Correct the OpenCode marker from
OPENCODE_AItoOPENCODE, preserving the existing nonempty-presence rule. Commands launched by OpenCode now receive the existingopencodeclassification and LLM-aware behavior; the obsolete marker alone no longer triggers detection.Upstream evidence: OpenCode explicitly sets
invocation.env.OPENCODE = "1"before launching commands:https://github.com/anomalyco/opencode/blob/77a0fd6f3b247235b09941d55ff0faf72be1dae4/packages/core/src/tool/plugin/shell.ts#L214
Conflict resolution and branch differences
The automated backport conflicted because this release branch has the older static detector rather than main's injectable environment accessor. Only the marker correction is applied to the branch's existing rule; main's refactors are not included.
The main-only files
test/dotnet.Tests/TelemetryTests/TelemetryCommonPropertiesTests.csandtest/dotnet.Tests/CommandTests/Test/GivenDotnetTestOutput.csdo not exist here. The existing xUnit data intest/dotnet.Tests/TelemetryCommonPropertiesTests.csis updated instead, coveringOPENCODE=1,OPENCODE=0, emptyOPENCODE, and obsoleteOPENCODE_AI=1. Both markers are cleared and restored with the branch's existing ambient-environment isolation helper. No missing main-only files are copied.Validation on release/10.0.4xx
.\.dotnet\dotnet.exe build test\dotnet.Tests\dotnet.Tests.csproj -c Debug /bl:1.binlog -v:quiet. Blocked by an unrelated compile error insrc/Cli/dotnet/Commands/Run/CSharpCompilerCommand.cs(9,30): CS0234,Microsoft.CodeAnalysis.CommandLinenamespace missing. Binary log loaded and confirmed one error; no full xUnit run or SDK/redist build is claimed.GetLLMEnvironment()andIsLLMEnvironment(), and passed all 44 rows, including all four OpenCode regressions. Harness build: 0 warnings, 0 errors (2.binlog). This is source-level validation, not an execution of the xUnit assembly.git diff --checkpassed.Main's reported 81 passing tests are upstream evidence only, not validation of this branch.
Tactics
Summary
The SDK checks
OPENCODE_AI, but OpenCode setsOPENCODE=1when launching commands, so its environment is not identified by the OpenCode rule. This backport replaces that marker withOPENCODEwhile retaining the existing nonempty-presence rule. The one-line production correction is suitable for servicing because it fixes the integration without importing main's detector refactors.Customer Impact
Users running SDK commands through OpenCode on the affected
release/10.0.4xxcode miss the existingopencodetelemetry classification and LLM-aware CLI behavior unless another agent marker also matches. Ordinary non-agent invocations are unaffected. Exact affected shipped SDK versions and customer-report frequency have not been established; no customer-tested workaround is recorded. After this correction,OPENCODE_AIalone no longer identifies OpenCode.Regression?
Unknown — not enough information to determine the introducing PR or first affected SDK version.
Testing
OPENCODE=1,OPENCODE=0, emptyOPENCODE, and rejectedOPENCODE_AI=1.git diff --checkpassed. CI results should be reviewed before merging; no successful branch CI result is asserted here. Main's 81 passing tests are upstream evidence only.Risk
Low. Production changes are limited to one environment-variable name in the existing OpenCode rule; other agent rules and matching semantics are unchanged. Tests cover positive, empty, nonempty, and obsolete-marker cases. Local full-project validation remains limited by the unrelated build error, so branch CI is required to close that validation gap.