Repository navigation
Conversation
|
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 are recorded for the OpenCode marker backport.
No open issues 🎉
What changed in this PR
Backports the OpenCode detection fix to release/11.0.1xx, preserving the branch’s existing environment-detection implementation without importing main’s refactor.
Changes:
- Changes the OpenCode marker from
OPENCODE_AItoOPENCODE, retaining nonempty-value detection. - Adds regression cases for
1,0, empty values, and rejection of the obsolete marker; isolates both variables during tests.
| File | Description |
|---|---|
test/dotnet.Tests/TelemetryTests/TelemetryCommonPropertiesTests.cs |
Adds marker regression cases and updates environment isolation. |
src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cs |
Uses OPENCODE for the existing OpenCode detection rule. |
Review effort: Balanced
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
Backport #56820 (merge commit a7d7d44) to
release/11.0.1xx.Correct the OpenCode LLM environment marker from
OPENCODE_AItoOPENCODE, preserving the existing presence-based semantics: any non-empty value identifies OpenCode. Add regression cases forOPENCODE=1,OPENCODE=0, an empty value, and rejection of the incorrectOPENCODE_AImarker.Original PR: #56820
Upstream evidence
OpenCode's shell tool explicitly sets
invocation.env.OPENCODE = "1"before running 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 branch uses static environment-detection rules that read the process environment, while main uses an injected environment-variable accessor. Only the marker correction is applied to this branch's existing rule; main's detector refactor is not included.
The regression cases use the existing MSTest
TelemetryCommonPropertiesTestsdata source and save/clear/restore environment-isolation mechanism. BothOPENCODEand the rejectedOPENCODE_AImarker remain in that isolation list so ambient values cannot affect the regression cases.Main's
test/dotnet.Tests/CommandTests/Test/GivenDotnetTestOutput.csdoes not exist on this branch. No missing main-only test files or unrelated refactors are copied.Changed files:
src/Cli/dotnet/Telemetry/LLMEnvironmentDetectorForTelemetry.cstest/dotnet.Tests/TelemetryTests/TelemetryCommonPropertiesTests.csValidation on this release branch
build.cmd /bl:1.binlogsucceeded, 0 errors. Existing dependency-audit warnings for MessagePack and System.Security.Cryptography.Pkcs remain outside this surgical backport..dotnet\dotnet.exe .github\skills\targeted-test\scripts\RunTargetedTests.cs -- --project test\dotnet.Tests\dotnet.Tests.csproj --filter "FullyQualifiedName~CanDetectLLMStatusForEnvVars" --no-buildpassed: 64 passed, 0 failed, 0 skipped.artifacts\log\targeted-tests\dotnet.Tests\20261029-135329-42816\test-results.trx; full build binlog:1.binlog.git diff --checkpassed.These are release/11.0.1xx results, not main's 81-test result.
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 withOPENCODEand retains the existing nonempty-presence semantics. It is suitable for the release branch because the production change is one environment-variable name, without main's detector refactors.Customer Impact
SDK commands launched through OpenCode on the affected
release/11.0.1xxcode miss the existingopencodeLLM-environment classification 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 the correction, the obsoleteOPENCODE_AImarker alone 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; both markers are saved, cleared, and restored for isolation.CanDetectLLMStatusForEnvVarsrun passed all 64 cases with zero failures or skips against the freshly built assembly.git diff --checkpassed. No successful branch CI result is asserted here; CI should be reviewed before merging. Main's 81-test result is separate upstream validation.Risk
Low. Only the OpenCode marker changes in production; other agent rules and matching semantics remain unchanged. The two-file backport includes regression coverage for nonempty, empty, and obsolete markers and avoids unrelated main-branch changes.