Commit d257bcf
authored
fix(ui): prevent duplicate ask_user card on session load (#1446)
## Summary
- When loading a session with a pending `ask_user` request, the
\"Questions for you\" card was rendered twice
- Two code paths both generated an `AskUserRequest` message for the same
pending confirmation:
1. `extractMessagesFromTasks()` found it in task history (no decision
yet → pending card)
2. `extractApprovalMessagesFromTasks()` found the same confirmation in
`task.status.message`
- Both were concatenated into `storedMessages`, causing the duplicate
**Fix:** `extractMessagesFromTasks()` now skips unresolved confirmations
(where no subsequent user decision exists in history). Pending
confirmations are exclusively owned by
`extractApprovalMessagesFromTasks()` via `task.status.message`; resolved
ones continue to render inline from history as before.
## Test plan
- [ ] Start a session with an agent that uses `ask_user` (e.g. an agent
configured to ask before merging a PR)
- [ ] Trigger the `ask_user` prompt, then reload/revisit the session
- [ ] Change/Swap to another conversation - then return
- [ ] Verify only one \"Questions for you\" card is shown (previously
two appeared)
- [ ] Verify that answering the question still works correctly
- [ ] Verify resolved `ask_user` sessions show the answered card
correctly (read-only)
Signed-off-by: Matcham89 <cjmatcham@hotmail.co.uk>1 parent 953648a commit d257bcf
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| |||
0 commit comments