Chat: answered questions collapse into their turn like tool calls
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# Answered questions collapse into their turn like tool calls
|
||||
|
||||
User report: after replying to a harness question (OpenCode question tool,
|
||||
Claude Code AskUserQuestion, Codex elicitation) the question card stays at the
|
||||
bottom of the chat. Follow-up: it should collapse like tool calls.
|
||||
|
||||
## Root cause
|
||||
|
||||
Not a missed server event. The reply's ack already marked the form resolved
|
||||
locally (`ChatThreadCards.answerQuestion`), and OpenCode/Codex resolution
|
||||
frames folded correctly. But every retained form, settled or not, was still
|
||||
rendered as a full card in the transcript's `trailing` rows
|
||||
(`chatCardRows` -> `transcriptRows(trailing:)`), so an answered question stayed
|
||||
as an "Answer recorded." card pinned after the last message. Narrow and wide
|
||||
used the same rows; on a phone the card simply covers more of the screen.
|
||||
|
||||
## Behavior now
|
||||
|
||||
- Pending questions, and ones whose answer was refused (with the server's
|
||||
reason), stay full interactive cards.
|
||||
- Once the reply is acknowledged (Claude Code: the ack is the only prompt
|
||||
signal; the server's readback resolution comes later) or the server sends a
|
||||
resolved/cancelled `form` frame (OpenCode `form.replied`/`form.cancelled`,
|
||||
Codex), the card leaves the card list and becomes a `ChatTurnChip` in the
|
||||
footer of the agent turn it arrived during, beside `N tools`:
|
||||
`Which database? · Postgres` (`· Expired`, `· Closed`, `· +N more`). It opens
|
||||
a native sheet with the title, status and full recorded answers.
|
||||
`groupSettledQuestions` in `lib/features/chat/conversation/chat_question_group.dart`.
|
||||
- Forms carry no turn id, so the client stamps the agent message streaming
|
||||
when the first frame arrives (`raised_in_message_id`, client-only). A question
|
||||
with no turn in view shares one loose `questions` row where it stood.
|
||||
- Forms are not part of stored history and the server replays only pending
|
||||
ones, so after a reload an answered question is gone (its tool call remains
|
||||
in the turn's tools chip).
|
||||
|
||||
## Evidence
|
||||
|
||||
- Tests: `test/features/chat/conversation/chat_question_group_test.dart`
|
||||
(grouping, summary, narrow 390x844 and wide 1280x900 ack collapse, refusal
|
||||
keeps the card, OpenCode/Codex resolution frame, cancel, ack plus
|
||||
form.replied, Cupertino, stale pending replay, remount). The full
|
||||
`test/features/chat` suite passes; `flutter analyze` is clean.
|
||||
- Browser: fixture option `?question=claude|opencode|fail`
|
||||
(`tool/perf/chat_question_fixture.dart`). Before/after captures at 560x1000
|
||||
and 1280x800 under `build/cq/out/`.
|
||||
- Not deployed, no device verification.
|
||||
Reference in New Issue
Block a user