chat: a verification chat can never appear in the operator's list

The operator's chat list showed ~99 stray "New chat" entries. The listing
was already fail-closed (registry-only); the fault was what got recorded: an
automated UI check drives the real page, so its throwaway chat was recorded as
an operator chat exactly like a manually created one and stayed in the list for
ever (each run added one).

Server: chat_create takes an optional ephemeral flag. The session is created,
bootstrapped, usable, closable and reopenable exactly like any other, but its
registry row is hidden, so chat_sessions never lists it. operator_sessions gains
an ephemeral column (idempotent migration, existing rows default to listed) and
the list query filters it; the single-row lookup does not, so close/reopen keep
working. RecordVerificationSession is the hidden recorder.

Web: the page marks a create ephemeral only when automation asks for it
(__pipelinesEphemeralChat, set by the UI smoke for its throwaway chat), so the
smoke's own runs stop polluting while a manual create is unchanged.

Tests: a hidden row is never listed yet is still looked up and closable; a
normal re-record of the same id lists it again; a pre-ephemeral database
migrates with every existing chat still listed. Live data pruned separately
(107 -> 8 registry rows, backed up).
This commit is contained in:
2026-10-19 13:15:08 +01:00
parent 94c802a147
commit 2fe63012f9
10 changed files with 233 additions and 18 deletions
+6
View File
@@ -349,6 +349,12 @@ sessions pipeline runs create. The protocol types are:
value all resolve to the home directory). A relative or missing directory is
rejected before any OpenCode call. The created session is recorded with the
stored tag `operator` and returned as the response's `chat_session`.
An optional `ephemeral: true` creates the session for automated verification:
it is created, bootstrapped and usable exactly like any other chat and can still
be closed and reopened, but its registry row is hidden, so `chat_sessions` never
lists it and a check that drives the real UI cannot leave a stray "New chat" in
the operator's list. The flag only removes a chat from the shared list, so it
cannot reveal or alter another session.
- `chat_directories` returns the operator's home first, then the directories of
previous operator sessions most-recently-used first, deduplicated and bounded
(currently 8). It is a dedicated request so the create dialog can load the