fix: send x-opencode-session header for OpenCode Go gateways - #389
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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 |
OpenCode Go now requires a stable x-opencode-session per conversation (https://opencode.ai/docs/go/#where-can-i-use-it). Add a shared helper that applies the header (and a self-identifying User-Agent) whenever the channel gateway points at opencode, using tsb-{ChatId} as the stable session id for chat paths and tsb-global for models/embeddings.
ModerRAS
force-pushed
the
fix/opencode-session-header
branch
from
September 10, 2026 04:46
d901f11 to
8a81411
Compare
Contributor
PR Check ReportSummary
Test Results
Code Quality
Test Artifacts
LinksThis report is auto-generated by GitHub Actions |
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.
问题
OpenCode Go 现在要求每个请求携带
x-opencode-session请求头(每个会话稳定的 session ID),否则返回 HTTP 400MissingSessionID,导致 AI Agent 执行失败:Error from provider (Console Go): Request is missing x-opencode-session and cannot be routed efficiently.参考: https://opencode.ai/docs/go/#where-can-i-use-it
修复
OpencodeSessionHeaders.Apply()共享辅助:仅当 gateway 指向 opencode 时,注入x-opencode-session(聊天路径使用tsb-{ChatId}作为会话内稳定 ID,模型列表/向量等无会话路径使用tsb-global)以及自识别的User-Agent: TelegramSearchBot/1.0验证
TelegramSearchBot.LLM构建通过(0 错误)TelegramSearchBot.LLM.Test全部 259 个测试通过