Send x-opencode-session on OpenCode requests - #501
Conversation
Implementation PlanProblem analysisdreb already creates the right stable conversation identifier: OpenCode models span OpenAI Completions, OpenAI Responses, Anthropic Messages, and Google Generative AI, so protocol-local fixes would be easy to miss or drift apart. Several coding-agent features also call The fix should derive the header per request rather than mutating shared model definitions. This preserves isolation between concurrent sessions and gives explicit configured/request headers higher precedence. Deliverables
Acceptance criteria
Files to create or modify
|
Vitest coverage
|
Progress UpdateImplementation complete.
Tests
Verification: full pre-commit gate green — biome, Commit: Progress tracked by mach6 |
Unverified Review Candidates — Pending AssessmentReview round: 1
CriticalNone. ImportantFinding 1 — Session ID loaded from a session file is used unsanitized as an HTTP header value (error-auditor, confidence 85)
Before this PR the same file worked fine (no header was generated). Trigger is local file tampering/corruption only (all legitimate write paths use Finding 2 — No test covers the final Every new call site that injects SuggestionsFinding 3 — New compaction tests exercise Finding 4 — Request-level explicit header override is tested only at unit level, not on the wire (test-reviewer, confidence 82) The acceptance criterion is about explicit request-level Finding 5 — Unnecessary
Finding 6 — Unnecessary
Strengths
Agents run: code-reviewer (no candidates), error-auditor (1), test-reviewer (3), completeness-checker (no candidates), simplifier (2) Reviewed by mach6 |
Review AssessmentClassifications
Action Plan
Non-blocking follow-ups, in priority order: (1) session-ID header allow-list in Assessment by mach6 |
Progress UpdateAddressed findings 2 and 3 from round 2 of the mach6 review: the earlier session-ID coverage was helper-level, so dropping Added
Mutation-checked each wiring site: removing the session ID at any one of the four sites (manual compaction, auto compaction, branch summarization, and the turn-prefix fan-out inside Commit: Progress tracked by mach6 |
Unverified Review Candidates — Pending AssessmentReview round: 2
CriticalNone. ImportantFinding 1 — Subagent tool
Finding 2 — DispatchArbiter
Finding 3 — Wire-level protocol tests never exercise All four protocol wire tests in SuggestionsFinding 4 — Tab-title mode-level wiring untested in both modes (test-reviewer, confidence 85) Deleting Finding 5 — Buddy hatch/reroll mode-level wiring untested in both modes (test-reviewer, confidence 85) Dropping the third argument at any of the four sites ( Finding 6 — Session ID loaded from a session file flows unsanitized into the header value (error-auditor, confidence 95) Round-1 finding 1, unchanged in this commit: Finding 7 — Buddy soul generation swallows the new failure mode silently (error-auditor, confidence 85) The pre-existing bare Finding 8 — New wiring test duplicates the existing
Finding 9 — Same fixture duplication in Same analysis: the local Nitpick (round-1 item 5, still open) — Unnecessary
Nitpick (round-1 item 6, still open) — Unnecessary
Strengths
Agents run: code-reviewer (no candidates; first attempt hit a context limit and was retried once), error-auditor (2), test-reviewer (5), completeness-checker (no candidates), simplifier (4) Reviewed by mach6 |
Closes #500
Ensure OpenCode Zen and Go requests carry a stable per-conversation session header across all supported provider protocols and internal LLM request paths.
Implementation plan posted as a comment below.