fix(ai): send OpenCode session and client headers - #10894
Closed
PurpleMyst wants to merge 1 commit into
Closed
PurpleMyst wants to merge 1 commit into
PurpleMyst wants to merge 1 commit into
Conversation
OpenCode rejects requests that omit `x-opencode-session` with a `MissingSessionID` 400, and asks clients to identify themselves. Send `marimo/<version>` plus `x-opencode-client`, and the conversation's chat ID as the session. This covers both the configured `opencode-go` provider and `mo.ai.llm.openai` pointed at an `opencode.ai` base URL; one-shot completion requests use the notebook session ID. Because the gateway rejects requests without a session, a missing or unusable session ID raises rather than being silently dropped, and a malformed conversation ID is rejected at the API boundary. User-configured `extra_headers` still take precedence.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
1 task
6 tasks
Member
|
Thanks @PurpleMyst , I've made a more targeted fix based on this PR in #10895. Let us know if anything is missing from that. But thanks for this! |
Author
|
LGTM :) |
Light2Dark
added a commit
that referenced
this pull request
Sep 18, 2026
Recognize the contribution from PR #10894 to the OpenCode Go session and client header integration. Co-authored-by: PurpleMyst <PurpleMyst@users.noreply.github.com>
Light2Dark
added a commit
that referenced
this pull request
Sep 18, 2026
**This pull request was authored by a coding agent.** ## 📝 Summary Closes #10882. Related: #10894. OpenCode Go rejects marimo's AI requests because they omit `x-opencode-session`. Forward the existing AI SDK conversation ID for chat and cell editing, with notebook-scoped fallback IDs for older clients and autocomplete. Identify marimo with its user agent and client header, and allow configured header overrides regardless of capitalization. Automatically generated session headers use a SHA-256 digest of the ID, keeping header values stable, bounded, and safe for HTTP. Explicit header overrides remain unchanged. This keeps conversation identity stable across turns without introducing another session lifecycle or provider-specific validation helpers. Other providers are unaffected. ## 📋 Pre-Review Checklist - [x] The bug is tracked in #10882; no public Python API changes. - [ ] Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it. - [ ] Video or media evidence is provided for any visual changes (optional; no visual changes). ## ✅ Merge Checklist - [x] I have read the [contributor guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md). - [x] API schemas and generated TypeScript types have been updated. - [x] Tests have been added for the changes made. > Written by GPT-6 on Codex
This branch was successfully 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
Closes #10882
Send an
x-opencode-sessionheader using the conversation ID (or the notebook session ID for one-shot endpoints) and identify marimo with its own user agent.Identification is based on what pi sends as that's a verified client™️.
📋 Pre-Review Checklist
✅ Merge Checklist