chat: name the session's model in the conversation header

The conversation header showed only the thread title, so inside a chat there
was nothing saying which model was answering. It now renders a second line
from server-reported values only.

- ChatFormat.kt: add chatHeaderMeta(thread), joining the reported model, the
  session's kind tag and the directory with " · "; blank parts are omitted so
  no model is ever claimed when the server did not report one. Refactor
  sessionTagLabel to a tag-value overload so the list row and the header share
  one tag mapping.
- ChatStore.kt: ChatThread gains the tag field; sessionsLoaded and open fold
  the server's model/agent/tag into already-open threads, and ensureThread
  seeds them, so the header never shows a stale or missing model.
- ChatScreen.kt: the conversation top bar title becomes a two-line column with
  the meta line in the shared pipelinesText().meta role; the create flow states
  plainly that this server has no request for choosing a chat's model.
- No model chooser is shipped. The server forwards no model/agent on
  chat_prompt and exposes no model/agent catalogue, so shipping a picker would
  be a control that does nothing; android/README.md records the exact server
  change it would need.
- Tests: ChatFormatTest covers chatHeaderMeta (reported model/tag/directory,
  and never claiming an unreported model) and the shared tag mapping;
  ChatSessionManagementTest covers the open thread carrying the reported
  model/agent/tag and a list refresh folding a new model in.

Checked before committing:
- Packaged templates: none exist (the author package embeds only skill/SKILL.md
  and references/*.md; no *.tmpl/*.template in the tree) - nothing to update.
- Repository guidelines: android/README.md updated with the change and its
  evidence; the root README and docs/ describe the server and CLI, not the
  Android chat surface - no update needed.
- Packaged authoring skill references (internal/author/skill/references/): none
  describes the Android chat surface - no update needed.

android/ only, no new dependency beyond the declared material-icons-extended.
This commit is contained in:
2026-10-17 15:03:00 +01:00
parent 8e6cb39284
commit 9b67e55d70
6 changed files with 195 additions and 9 deletions
+78
View File
@@ -5783,3 +5783,81 @@ Not verified in this pass: the search field, the directory sections and the
empty state on a device, and the narrow/wide layouts — the brief keeps
implementation verification to the build and the unit tests, and visual review
owns the operator's Pixel 9 Pro XL.
## The conversation header names the session's model (17 Oct 2026)
A chat session's model was only visible in the session list row; inside a
conversation there was nothing saying what was answering. The conversation header
now shows the session's model beside its `Operator` tag and its directory, read
from the session the server already reports. `android/` only; no dependency was
added beyond the already-declared material-icons-extended, nothing in the
Pipelines server, its Go source, the installer or the Docker files was touched,
and no run is started from the app.
- **One derivation, server-reported only.** `ui/chat/ChatFormat.kt` adds
`chatHeaderMeta(thread)`: the model id, the session's kind tag (through the
shared `sessionTagLabel`, refactored to a tag-value overload so the list row
and the header cannot label a tag differently) and the directory, joined with
` · `. Every part is a value the server reported; a blank part is omitted, so a
session the server reported without a model (or an older server that omits the
field) shows no model claim at all — never a guess and never a catalogue.
- **The open thread carries what the server reports.** `ChatThread` gains the
`tag` field (it already mirrored title/directory/model/agent/busy), and
`ChatStore` now folds the server's `model`/`agent`/`tag` into an already-open
thread on `sessionsLoaded` (not only on first `open`), and seeds them in the
`ensureThread` placeholder. So the header never shows a stale or missing model
after a list refresh or for a background chat.
- **The header surface.** `ChatScreen.ChatConversationPane`'s top bar title
becomes a two-line `Column`: the existing title, then the meta line in the
shared `pipelinesText().meta` role with `onSurfaceVariant`, ellipsised — no new
geometry literal.
**No model chooser is shipped, and why.** The brief asks to let the operator
choose a session's model and report the exact server change if the server has no
request for it. It does not: `ChatPromptRequest` carries `model`/`agent` on the
wire (`internal/protocol/chat.go`), but the endpoint drops them —
`handleChatPrompt` calls `broker.Prompt(ctx, sessionID, prompt.Text)` and
`opencode.Chat.Prompt` posts only `{"text": ...}` — and there is no request that
sets a session's model, nor any request that lists the endpoint's models or
agents to offer a choice from. Shipping a picker would be a control that does
nothing, so the create flow instead says so plainly ("This server has no request
for choosing a chat's model, so a new chat uses the server's default.") and the
header shows the model the server does report once the session exists.
The exact server change it would need: (1) forward the chosen model/agent —
extend `chatBroker.Prompt` and `opencode.Chat.Prompt` to accept them and include
`model`/`agent` in the `POST /api/session/{id}/prompt` body, and pass
`prompt.Model`/`prompt.Agent` from `handleChatPrompt`; (2) expose a catalogue
request (for example `chat_models`/`chat_agents`, answered from the endpoint's
model/agent list) so the client can offer only what the server reports; and
(3) optionally accept `model`/`agent` on `chat_create` so a session starts with
the operator's chosen default rather than the endpoint's. Until then the app is
honest: it shows what the server reports and does not pretend to set it.
Tests (4 new): in `ChatFormatTest`, that `chatHeaderMeta` shows the reported
model, tag and directory, that it never claims a model the server did not report
(blank thread → empty, tag only → `Operator`), and that a session tag and a
thread tag label the same; in `ChatSessionManagementTest`, that an open
conversation carries the model/agent/tag the server reports and that a later list
refresh folds the server's new model into the open thread.
Evidence (this run's implementer pass, macOS, Gradle 8.11.1 at
`~/.gradle/wrapper/dists/gradle-8.11.1-bin/bpt9gzteqjrbo1mjrsomdt32c/gradle-8.11.1/bin/gradle`
with `JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"`
(JDK 17) and `ANDROID_HOME=/Users/alan/Library/Android/sdk`):
`gradle --offline --no-daemon :app:testDebugUnitTest` → `BUILD SUCCESSFUL`; the
JUnit XMLs total **55 suites / 505 tests / 0 failures / 0 errors / 0 skipped** (4
new). `gradle --offline --no-daemon :app:assembleDebug` → `BUILD SUCCESSFUL`; the
APK was published to this run's artifacts directory as
`pipelines-debug-wip-8e6cb39.apk` (18,706,104 bytes, sha256
`b52f2be1fcfce2654b90b9735ce03683fbf91e0a651b2b0ad49e92488d81ad05`; `8e6cb39` is
`git rev-parse --short HEAD`, the tree being uncommitted WIP on top of it) and is
served at
`http://10.0.0.75:8080/artifacts/272/1/pipelines-debug-wip-8e6cb39.apk`
(`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18706104`).
Not verified in this pass: the header meta on a device and the create-flow note —
the brief keeps implementation verification to the build and the unit tests, and
visual review owns the operator's Pixel 9 Pro XL. No packaged skill reference was
touched: this is an app-UI change and no reference describes the chat surface.