Files
pipelines/docs/notes/opencode-chat-list-model.md

31 lines
1.8 KiB
Markdown

# OpenCode chat list model reporting
OpenCode's session summary and detail can omit `model` even after an assistant
reply recorded one. The live operator session's detail omitted it; a read-only
GET of its newest assistant message returned `deepseek-v4.1-flash` with provider
`opencode-go`. The Flutter list already renders a supplied model correctly.
The server now resolves missing models after filtering to registered operator
sessions. It prefers an explicit selected model in session detail, then reads
a bounded recent assistant page. No configured/global default is invented for
an empty chat. Existing listed models and other harnesses are preserved.
The adapter reuses its authenticated transport and correct operator directory.
Reads are capped at 1 MiB; V2 requests one assistant, descending, and native V1
requests eight recent messages. A backend ignoring page bounds is rejected.
Successful and empty results are cached for 30 seconds, invalidated by an
upstream update timestamp or an accepted model switch. The cache is bounded to
128 entries. All optional metadata reads share a two-second list budget; failure
is logged and leaves the chat visible with its model unknown. Pipeline and
foreign histories are never fetched for this enrichment.
Validation: go build ./..., go vet ./..., and go test ./... pass. Focused race
checks cover V1/V2 payloads, current-model preference, cache refresh/expiry,
switch invalidation, empty chats, oversized/malformed responses, operator-only
filtering, and metadata failures. Live checks read only detail/reply metadata;
no prompt, chat mutation, shared-service restart or server deployment occurred.
Server deployment remains pending. internal/server/AGENTS.md reserves deployed
server changes to the operator; tests used local fixtures only. No Flutter or
web build is required for this server-only fix.