fix(ask): keep real options, badge recommended, restore tool results after reload #6

Merged
lucas merged 1 commit from feat/t-70 into main 2026-10-14 17:19:43 +02:00
Collaborator

Fixes four bugs in the ask flow. The dialog's "Other"-option filter hid legitimate options; it is replaced by a pattern for free-text deferrals ("Something else", "Different (I'll explain)", …) that only ever checks the last option, in the new apps/web/src/lib/ask-options.ts. recommended now reaches the dialog through deckSelect, so the RECOMMENDED badge shows, and ASK_DESCRIPTION stops telling agents that " (Recommended)" is added for them. The answered ask card now turns the chosen option green even when its label ends in " (Recommended)". When a session is reloaded from history, toolResult messages now rebuild result (content + details), so tool cards from earlier turns keep their output after reload, reconnect or session switch; the unused resultContent field is removed.

Decisions

  • Filter: over 826 recorded ask questions the new pattern drops 34 options, all free-text deferrals, and no legitimate ones. The old filter hid at least one legitimate option in 76 questions.
  • The badge is matched by label: dialog.options[recommended] === opt. If the recommended option is itself the trailing deferral that gets filtered out, no badge is shown.
  • If the live tool_execution_end result arrived first, it is kept when the matching toolResult message comes in afterwards.
  • On reload, the result content is the raw message content array, the same shape as the live result. The text/image normalisation resultContent did is no longer applied.

Verification

  • cd apps/web && bun test src/lib: 137 pass, 0 fail (new keep/drop table for filterOtherOptions; new tests for rebuilding results on reload).
  • cd apps/server && bun test src/bridge: 343 pass, 0 fail.
  • bun run typecheck: protocol, server and web all exit 0.
  • Throwaway ExtensionUIBridge.deckSelect(..., 0): the dialog-open frame carries recommended: 0; with undefined the key is absent.
  • Throwaway renderToStaticMarkup(AskTool):
    • Live result selecting "A (Recommended)" → that row is green with ▶.
    • Stream rebuilt by initSession from [assistant toolCall, toolResult] → the selected B row is green.
  • Throwaway renderToStaticMarkup(AskDialog) with options ["Typed `details` + unchanged text", "Switch to JSON", "Web-only parse", "Something else"] and recommended: 0: the first three are shown, option 0 has the RECOMMENDED badge, "Something else" is dropped, and the dialog's own "Other (type your own)" row follows.
  • Not run: the in-browser check (needs a deck server restart).
Fixes four bugs in the `ask` flow. The dialog's "Other"-option filter hid legitimate options; it is replaced by a pattern for free-text deferrals ("Something else", "Different (I'll explain)", …) that only ever checks the last option, in the new `apps/web/src/lib/ask-options.ts`. `recommended` now reaches the dialog through `deckSelect`, so the RECOMMENDED badge shows, and `ASK_DESCRIPTION` stops telling agents that " (Recommended)" is added for them. The answered ask card now turns the chosen option green even when its label ends in " (Recommended)". When a session is reloaded from history, `toolResult` messages now rebuild `result` (content + details), so tool cards from earlier turns keep their output after reload, reconnect or session switch; the unused `resultContent` field is removed. ## Decisions - Filter: over 826 recorded ask questions the new pattern drops 34 options, all free-text deferrals, and no legitimate ones. The old filter hid at least one legitimate option in 76 questions. - The badge is matched by label: `dialog.options[recommended] === opt`. If the recommended option is itself the trailing deferral that gets filtered out, no badge is shown. - If the live `tool_execution_end` result arrived first, it is kept when the matching `toolResult` message comes in afterwards. - On reload, the result content is the raw message content array, the same shape as the live result. The text/image normalisation `resultContent` did is no longer applied. ## Verification - `cd apps/web && bun test src/lib`: 137 pass, 0 fail (new keep/drop table for `filterOtherOptions`; new tests for rebuilding results on reload). - `cd apps/server && bun test src/bridge`: 343 pass, 0 fail. - `bun run typecheck`: protocol, server and web all exit 0. - Throwaway `ExtensionUIBridge.deckSelect(..., 0)`: the dialog-open frame carries `recommended: 0`; with `undefined` the key is absent. - Throwaway `renderToStaticMarkup(AskTool)`: - Live result selecting `"A (Recommended)"` → that row is green with ▶. - Stream rebuilt by `initSession` from `[assistant toolCall, toolResult]` → the selected `B` row is green. - Throwaway `renderToStaticMarkup(AskDialog)` with options ``["Typed `details` + unchanged text", "Switch to JSON", "Web-only parse", "Something else"]`` and `recommended: 0`: the first three are shown, option 0 has the RECOMMENDED badge, "Something else" is dropped, and the dialog's own "Other (type your own)" row follows. - Not run: the in-browser check (needs a deck server restart).
- Replace the keyword heuristic that hid legitimate ask options with a
  free-text-deferral pattern applied only to the last option.
- Forward `recommended` through deckSelect so the dialog badges it; match
  the badge by label after filtering. Stop telling agents a
  " (Recommended)" suffix is added.
- Highlight the chosen option in the ask card even when its label carries
  the " (Recommended)" suffix.
- Rebuild tool results (content + details) from toolResult messages on
  session hydration; drop the unused resultContent field.

Co-Authored-By: Claude Opus 5.5 via omp-deck
lucas approved these changes 2026-10-14 17:19:22 +02:00
lucas merged commit 162356bcc3 into main 2026-10-14 17:19:43 +02:00
lucas deleted branch feat/t-70 2026-10-14 17:19:44 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lucas/omp-deck!6
No description provided.