You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Builtin compaction generates its own provider request through ModelRuntime.stream() rather than the normal AgentSession stream wrapper. That bypasses the OpenCode session-attribution layer in sdk.ts, so an opencode / opencode-go summarization request can reach the provider without x-opencode-session and fail with 400 MissingSessionID even while ordinary turns succeed.
The patch reuses the existing OpenCode provider/host predicate at the compaction request boundary. It deliberately does not move session attribution into ModelRuntime, change provider routing/auth, or special-case DeepSeek: the failure is a request-boundary omission that affects any model sent through OpenCode Go.
Header contract
The compaction request preserves the same authority order as normal AgentSession traffic:
the existing provider-request / before_provider_headers transform.
Explicit configuration and extensions therefore remain authoritative.
Changes
Rename/export the narrow helper as getOpenCodeSessionHeaders() so its scope is explicit and the existing opencode / opencode-go / opencode.ai predicate is reused rather than duplicated.
Seed builtin summary request headers from the active SessionManager id before the existing auth/header transform.
Document at the call site why compaction must do this locally: it bypasses sdk.ts's AgentSession stream wrapper.
Keep the regression in test/suite/regressions/ and pin provider-id routing, opencode.ai host routing, auth/configured-header override precedence, extension override precedence, and non-OpenCode neutrality.
Add canonical exact-nearest tracker entries in src/core/changes.md and src/core/extensions/builtin/compaction/changes.md for the two upstream-owned production paths.
Scope / upstream sync
The branch is synchronized with upstream main at 464f1a54e8569cdfe8e4620583e19d594a6b96e9 (PR head 27fcf328cde6c1ec015cdbe76f07913f3c421840). Current main still has the original private getSessionHeaders() and compaction still forwards only auth/configured headers, so the defect remains present upstream.
The semantic runtime diff remains two production files plus one focused regression; the two additional changed files are repository-policy changes.md trackers only.
No retry policy, payload transformation, credential selection, ordinary AgentSession request behavior, or non-OpenCode provider behavior is intentionally changed.
Verification status
The regression is deterministic and does not call a real provider. The exact-nearest tracker requirement is now satisfied in the branch.
This connector environment cannot execute the repository test runner, so I am not claiming a local green run. PR-triggered CI / Changelog workflows for fork contributions may require repository approval before jobs execute; action_required is an approval gate, not a test result. Any executable type/test or changelog-policy failure remains blocking evidence.
Per CONTRIBUTING.md, release CHANGELOG.md entries are maintainer-owned; this PR does not edit them. The PR stays draft until executable CI evidence and the release-note policy are accounted for.
Audit/update pass complete on the runtime patch. I tightened the helper name to the OpenCode-specific getOpenCodeSessionHeaders(), documented the alternate compaction request boundary, moved the regression into test/suite/regressions/, and expanded it to pin provider-id + host detection and both override layers (resolved/configured headers, then before_provider_headers). The branch is also resynced to current main at e66c1553a60917260f480ebab09c817fda73fb14.
I am intentionally keeping this as a draft for the moment. Two evidence gates remain: exact-nearest changes.md entries for the two upstream-owned production paths, and executable CI (the PR workflows have been action_required, so there is no test result to claim yet). Per CONTRIBUTING.md I will not add the release CHANGELOG.md entry from the external-contributor side. No provider/network test was used, and I am not claiming local green from this connector environment.
Follow-up on the draft: the exact-nearest changes.md coverage for both upstream-owned production paths is now committed on head 27fcf328cde6c1ec015cdbe76f07913f3c421840. The runtime/test scope is unchanged; the PR now has five changed files because the two additional files are policy trackers only. CI and Changelog gate are again stopped at action_required before jobs are created, so executable verification still needs repository approval.
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
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
Fixes #1523.
Builtin compaction generates its own provider request through
ModelRuntime.stream()rather than the normalAgentSessionstream wrapper. That bypasses the OpenCode session-attribution layer insdk.ts, so anopencode/opencode-gosummarization request can reach the provider withoutx-opencode-sessionand fail with400 MissingSessionIDeven while ordinary turns succeed.The patch reuses the existing OpenCode provider/host predicate at the compaction request boundary. It deliberately does not move session attribution into
ModelRuntime, change provider routing/auth, or special-case DeepSeek: the failure is a request-boundary omission that affects any model sent through OpenCode Go.Header contract
The compaction request preserves the same authority order as normal AgentSession traffic:
x-opencode-session,x-opencode-client);before_provider_headerstransform.Explicit configuration and extensions therefore remain authoritative.
Changes
getOpenCodeSessionHeaders()so its scope is explicit and the existingopencode/opencode-go/opencode.aipredicate is reused rather than duplicated.SessionManagerid before the existing auth/header transform.sdk.ts's AgentSession stream wrapper.test/suite/regressions/and pin provider-id routing,opencode.aihost routing, auth/configured-header override precedence, extension override precedence, and non-OpenCode neutrality.src/core/changes.mdandsrc/core/extensions/builtin/compaction/changes.mdfor the two upstream-owned production paths.Scope / upstream sync
The branch is synchronized with upstream
mainat464f1a54e8569cdfe8e4620583e19d594a6b96e9(PR head27fcf328cde6c1ec015cdbe76f07913f3c421840). Currentmainstill has the original privategetSessionHeaders()and compaction still forwards only auth/configured headers, so the defect remains present upstream.The semantic runtime diff remains two production files plus one focused regression; the two additional changed files are repository-policy
changes.mdtrackers only.No retry policy, payload transformation, credential selection, ordinary AgentSession request behavior, or non-OpenCode provider behavior is intentionally changed.
Verification status
The regression is deterministic and does not call a real provider. The exact-nearest tracker requirement is now satisfied in the branch.
This connector environment cannot execute the repository test runner, so I am not claiming a local green run. PR-triggered CI / Changelog workflows for fork contributions may require repository approval before jobs execute;
action_requiredis an approval gate, not a test result. Any executable type/test or changelog-policy failure remains blocking evidence.Per
CONTRIBUTING.md, releaseCHANGELOG.mdentries are maintainer-owned; this PR does not edit them. The PR stays draft until executable CI evidence and the release-note policy are accounted for.