Repository navigation
Conversation
…state toggleFloorDelivery() set the displayed floorDeliveryPaused value optimistically before any of the per-agent controlAutoDelivery(a.id, next) IPC calls resolved, then fired all of them with .catch(() => null) - so a failed call for any individual agent (main-process exception, an agent whose control record isn't ready yet, an IPC hiccup) was silently dropped, and the returned snapshots (controlAutoDelivery actually resolves each agent's real resulting AgentControlSnapshot) were discarded entirely, success or failure. Net effect: the operator could click "pause delivery", see the floor-wide switch confidently show "Delivery Paused", while one or more agents - most likely ones mid-spawn or mid-teardown, exactly when an operator might want to pause things - never actually had autoDeliveryPaused flipped in the main process's ControlRegistry. This keeps the optimistic update for responsiveness but now actually reads the per-agent results: if any agent didn't confirm the requested state, it logs which ones and re-syncs the displayed value from god's own live snapshot instead of trusting the optimistic guess. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🚫 This PR is missing its before/after evidenceEvery pull request here has to show its work. Screenshots or a short screen recording, before the change and after it.
How to fix it: edit the description, keep the A bug fix with no visible surface still needs it: show the failing behaviour, then the same steps passing. A terminal recording is fine. Genuinely nothing to show — a CI tweak, a typo, a dependency bump? A maintainer can apply the |
|
Thank you, @UsryAce. We took this whole into 0.5.5, so it is already in the installers people are running. We want to merge it here too, so the credit sits on your pull request. One thing stands in the way. The "Before / after evidence" check is red: the description has no picture or recording under the Before and After headings. For a fix with nothing to see on screen, a terminal screenshot works: the failing behaviour or test before, and the same steps passing after. Edit the description and drag one under each heading. The check runs again by itself. The Build and Typecheck checks on this pull request are waiting on us, not on you. Once that is in and the checks are green, we merge it. |
Summary
`toggleFloorDelivery()` in `CommandCenterPanel.tsx` sets the displayed `floorDeliveryPaused` value optimistically, before any of the per-agent `controlAutoDelivery(a.id, next)` IPC calls resolve:
```ts
const toggleFloorDelivery = async () => {
const next = !floorDeliveryPaused;
setFloorDeliveryPaused(next); // shown immediately
const all = useStore.getState().agents;
await Promise.all(all.map((a) => window.cth.controlAutoDelivery(a.id, next).catch(() => null)));
};
```
Every per-agent call is wrapped in `.catch(() => null)`, and `controlAutoDelivery` actually resolves each agent's real resulting `AgentControlSnapshot` — but that return value, success or failure, is discarded entirely. So:
Why this matters
This is the ONE floor-wide switch for pausing auto-delivery to every agent. An operator could click "pause delivery" — often specifically because they're about to do something they don't want agents auto-acting during — see the switch confidently show "Delivery Paused" for the whole floor, while one or more agents (plausibly one mid-spawn or mid-teardown, which is exactly when a race like this bites) never actually got `autoDeliveryPaused` flipped in the main process's `ControlRegistry`.
Fix
Keeps the optimistic update for UI responsiveness, but now actually reads the per-agent results afterward. If any agent's returned snapshot is missing or doesn't match the requested state, it logs which agent(s) and re-syncs the displayed toggle from god's own live `controlSnapshot` instead of trusting the optimistic guess.
Test plan
🤖 Generated with Claude Code
Before
A minimal repro reproducing the exact control-flow shape of
toggleFloorDelivery(), with a mockedcontrolAutoDeliverywhere one agent (simulating one mid-spawn, whose control record isn't ready yet) rejects:The optimistic value is returned/displayed as success with zero indication that one agent's call actually failed - exactly what the real code does, since the per-agent result is discarded via
.catch(() => null)and never inspected.After
Same mock, same failing agent, using the new logic (read the per-agent results, detect the mismatch, log which agent(s) failed):
The failure is now detected and surfaced instead of silently swallowed; the real code additionally re-syncs the displayed toggle from god's own live
controlSnapshotat this point (not reproducible standalone without the real IPC layer, but the detection - the actual bug - is demonstrated here).