eca icon indicating copy to clipboard operation
eca copied to clipboard

ECA chat does not work with Opencode Go

Open suzuki11109 opened this issue 2 months ago • 4 comments

I got this error when I type something to the chat.

LLM response status: 400 body: {"type":"error","error":{"type":"MissingSessionID","message":"Error from provider (Console Go): Request is missing x-opencode-session and cannot be routed efficiently. Please see https://opencode.ai/docs/go/#where-can-i-use-it"}}

I used to work before until recently. It seems Opencode has added a header validation. https://opencode.ai/docs/go/#where-can-i-use-it

suzuki11109 avatar Sep 08 '26 04:09 suzuki11109

@suzuki11109 you can add custom headers with extraHeaders config, maybe try that? ref

ericdallo avatar Sep 08 '26 15:09 ericdallo

@ericdallo thanks for the pointer, but I think this is not enough. If I get this correctly, OpenCode's docs (https://opencode.ai/docs/go/#where-can-i-use-it) ask non-OpenCode clients to:

  • identify themselves with their own User-Agent rather than a generic HTTP-library name;
  • send a stable session ID in x-opencode-session for each conversation (the same for every request in that conversation), which they use for routing and prompt caching.

extraHeaders covers the first point ("User-Agent": "eca"), but not the second. If I understood this correctly (disclosure: I used Claude Code to dig into this), with extraHeaders the value is fixed per provider or model (not per conversation) and is resolved once when the config loads, even with ${cmd:uuidgen}. So every chat would share one ID, which breaks the per-conversation routing and caching the header is meant for. I guess the change would be in the server rather than in eca-emacs, so it might make sense to move this issue to editor-code-assistant/eca. I can open a new one there if this is actually the case.

egolep avatar Oct 11 '26 12:10 egolep

@suzuki11109 I moved the issue to eca. Yeah, I don't see how to solve this in a non opencode sepcific way, we shouldn't hardcode anything for specific providers just because they need headers with custom logic, ECA already expose extraHeaders to be generic and allow use other providers, this is the first provider I see that needs custom headers that keep changing, so not sure what to do here. c/c @zikajk

ericdallo avatar Oct 15 '26 12:10 ericdallo

I guess we would need to have something like${session-cmd:uuidgen} and ${chat-cmd:uuidgen}? That sounds crazy...

zikajk avatar Oct 15 '26 12:10 zikajk