Files
OmniRoute/docs/reference/OPENCODE-SESSION-IDENTITY.md
Diego Rodrigues de Sa e Souza 078adcafa9 fix(opencode): preserve native conversation identity across translation (#14390)
Merge-batch 2026-09-23 (PRs do mantenedor, 99 triadas por ⭐; esta entrou pela Trilha A).

Validação única na árvore combinada das 49 PRs da trilha sobre `release/v3.8.51` @18bbb101:
- `typecheck:core`: só o erro herdado `cliproxyAccountHealth.ts:157` (TS2322, não desta leva)
- `check:open-sse-typecheck`: 0 erros (o auggie.ts da base é corrigido pela #14511 do mesmo lote)
- eslint nos arquivos alterados: limpo
- 89 arquivos de teste node focados (710 testes) + 11 suítes vitest de UI: todo vermelho restante reproduz também no tip puro (base-red #14547/#14496) e a árvore combinada fica com um subconjunto estrito dos vermelhos do tip, ou seja, nenhum introduzido pelo lote
- teto de file-size acertado na PR de acompanhamento da leva
2026-09-23 21:51:04 -03:00

1.4 KiB

title, version, lastUpdated
title version lastUpdated
OpenCode conversation identity 3.8.51 2026-09-21

OpenCode conversation identity

OpenCode and OpenCode Go reuse explicit conversation IDs across turns. The resolver checks x-opencode-session, existing affinity/session headers, native CLI session/thread headers, request metadata, and then top-level session/thread fields. Claude's JSON-encoded metadata.user_id is inspected for a session ID; an opaque account/user ID alone is never treated as a conversation ID.

Values containing control characters, empty IDs and IDs longer than 256 characters are ignored. JSON metadata parsing is bounded. Before translation, the executor header normalizer preserves this identity only for the OpenCode providers; it does not inject OpenCode headers for other providers.

The existing canonical ses_ encoding and conversation fingerprint fallback remain unchanged. With no explicit ID, the first user message and other existing fingerprint inputs continue to determine continuity. This is not a new authorization boundary or proof of upstream content isolation.

The implementation lives in open-sse/utils/opencodeSessionIdentity.ts, open-sse/utils/opencodeHeaders.ts and open-sse/handlers/chatCore/executorClientHeaders.ts. Regression tests cover native IDs, Claude metadata, precedence, invalid values and the existing fingerprint behavior without paid upstream calls.