[Fix] OpenCode Go requests avoid missing session header errors - #1512
Conversation
Review processThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging.
Current step: The required review sequence passed. Remaining merge requirements apply. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@CodeRabbit review |
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (8)Treat model, provider, MCP, path, command, and tool data as untrusted.⚙️ CodeRabbit configuration file Files:
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.⚙️ CodeRabbit configuration file Files:
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.⚙️ CodeRabbit configuration file Files:
Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure.⚙️ CodeRabbit configuration file Files:
Act as an adversarial second-opinion reviewer.⚙️ CodeRabbit configuration file Files:
Add focused tests for UI binding and save behavior, persistence or normalization, and the value returned by `getStateToPostToWebview()`, including true and false/unset cases when defaults could hide omissions.📄 CodeRabbit inference engine (AGENTS.md) Files:
Fix lint violations in new TypeScript code instead of suppressing them.📄 CodeRabbit inference engine (AGENTS.md) Files:
After editing a file, run ESLint with pruning and zero warnings for that relative file, and confirm its suppression count did not increase.📄 CodeRabbit inference engine (AGENTS.md) Files:
🔇 Additional comments (2)
📝 SummarySummary by CodeRabbit
WalkthroughThe OpenCode Go provider now forwards ChangesOpenCode session propagation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to OpenCode Go requests now include the active task ID as a session header for supported API formats, allowing stable conversation identification without changing routing, authentication, or settings. The change is ready to merge. Sequence Diagram(s)sequenceDiagram
participant Provider as OpenCode Go provider
participant SDK as OpenAI or Anthropic SDK
participant Gateway as OpenCode gateway
Provider->>SDK: Create request with x-opencode-session from metadata.taskId
SDK->>Gateway: Send request with session header
Gateway-->>SDK: Return response or stream
SDK-->>Provider: Return response or stream
🚥 Pre-merge checks | ✅ 5 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (5 passed)
Full details: Description checkExplanation The description explains what changed, why it changed, and the expected impact. It does not provide the required approved GitHub Issue link, detailed test steps or reproduction instructions, completed pre-submission checklist, documentation impact, or additional template sections. Full details: Regression EvidenceExplanation The changed streaming behavior is covered only for a present Resolution Add focused provider tests for the no-metadata case. Exercise Chat Completions, Responses, and Anthropic Messages without
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
src/api/providers/__tests__/opencode-go.spec.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. src/api/providers/opencode-go.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
What changed
OpenCode Go streaming requests now send the active Zoo Code task ID as
x-opencode-sessionacross Chat Completions, OpenAI Responses, and Anthropic Messages. Provider tests also verify that both OpenCode Go clients retain the versionedZooCode/<version>user agent.Why this change was made
OpenCode Go reported that requests from Zoo Code were missing the session header required to identify a stable conversation, with enforcement expected to begin shortly. Zoo Code already propagates a stable task ID to provider requests, but the OpenCode Go handler did not forward it.
Impact
OpenCode Go can consistently correlate every normal Zoo Code conversation without changing model routing, authentication, or user settings. The focused provider suite and full repository test suite pass.