Commit 7403792
Yogthos
fix(ui): thread question_tx/plan_tx through 3 missed sites + passive close on tool-turnover
Two related UI/threading bugs surfaced during code review of 9475586.
## 1. Three missed build_agent sites in ui/mod.rs (companion to 9475586)
Last commit fixed the 9 build_agent calls in slash.rs but missed
three in ui/mod.rs that also passed `None, None` for question_tx +
plan_tx:
- L1770: `/cd` worktree-return to main repo
- L2507: `/model` switch rebuild
- L2764: auto worktree-cleanup return
Same C8-LSP shape: after any of these paths rebuilt the agent the
`question` + `plan_enter` + `plan_exit` tools silently disappeared
from the LLM's tool list for the rest of the session, because
`builder.rs:621` / `agent/builder.rs:252` install those tools only
when their channels are `Some`. The threading is now mechanical
across all 13 call sites (3 in main.rs, 9 in slash.rs, 4 in
ui/mod.rs — all `&Option<T>` refs auto-clone to `Option<T>` via
method resolution).
## 2. Chamber-abort false-positive on fresh ToolCall
`close_tool_chamber_if_open` aliases `close_tool_chamber_abort` for
back-compat (658a63e), which paints "⚠ tool denied · aborted · no
result" inside any chamber where `last_tool_name.is_some() ||
tool_chamber_open` at the time of close. The call at line 2123 fires
when a NEW ToolCall arrives over a chamber whose flags haven't
flipped yet — under parallel tool execution the next
`ToolExecutionStart` lands before the prior `ToolExecutionEnd`
processes, so EVERY in-flight chamber gets falsely branded as
"denied" while the tool is actually executing normally.
Switched 2123 to `close_tool_chamber_passive` — a fresh ToolCall is
chamber turnover, not a denial event. The other three abort callers
(`AgentEvent::Error` / `Interjected` / `ContextOverflow`) genuinely
are denial-shaped and stay on the abort variant.
This unmasks a separate underlying bug: the UI's single-chamber
state model (`tool_chamber_open: bool`, `last_tool_name: Option`)
can't represent multiple in-flight tool calls. Empty Read chambers
+ out-of-place `↳ trailers` for tools whose results arrive after a
newer call's chamber opens are the new visible symptom. A per-id
chamber state rework is filed separately.
Tests: existing `close_tool_chamber_*` unit tests still pass
(passive variant has equivalent gating behavior, just different
inner-row content).1 parent 9475586 commit 7403792
1 file changed
Lines changed: 21 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1774 | 1774 | | |
1775 | 1775 | | |
1776 | 1776 | | |
1777 | | - | |
1778 | | - | |
| 1777 | + | |
| 1778 | + | |
1779 | 1779 | | |
1780 | 1780 | | |
1781 | 1781 | | |
| |||
2120 | 2120 | | |
2121 | 2121 | | |
2122 | 2122 | | |
2123 | | - | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
2124 | 2138 | | |
2125 | 2139 | | |
2126 | 2140 | | |
| |||
2511 | 2525 | | |
2512 | 2526 | | |
2513 | 2527 | | |
2514 | | - | |
2515 | | - | |
| 2528 | + | |
| 2529 | + | |
2516 | 2530 | | |
2517 | 2531 | | |
2518 | 2532 | | |
| |||
2768 | 2782 | | |
2769 | 2783 | | |
2770 | 2784 | | |
2771 | | - | |
2772 | | - | |
| 2785 | + | |
| 2786 | + | |
2773 | 2787 | | |
2774 | 2788 | | |
2775 | 2789 | | |
| |||
0 commit comments