mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-07 03:00:29 +00:00
`ParentNotificationHub` kept a second `Mutex` and `watch` channel holding a copy of each child's terminal result -- data `SubAgent.status` already owns as `SubAgentStatus::Finished`, and which is never evicted, since nothing removes entries from `SupervisorState.agents`. Two of the three bugs fixed in the previous commit were ordering bugs in the coupling between those two structures: suppress-vs-commit in `begin_shutdown`, and register-vs-publish in `spawn_inner`. Both were fixed by ordering the steps correctly. Keeping the registration beside the status it is delivered with makes that whole class unrepresentable instead: - Registration is now a field on the `SubAgent` literal `spawn_inner` already builds, under the lock that publishes it. There is no window between publishing an agent and registering its notification. - Suppression on shutdown happens inside the critical section that decides the shutdown, after the status transition commits, so a rejected shutdown cannot discard a result the parent is owed. - `next_parent_notification_batch` scans agents for a live registration whose status is `Finished`, and ignores `Closing`/`Closed` outright -- so a shutdown racing delivery can no longer park the parent on a result that will never arrive, even if suppression were missed. `spawn_result_monitor` no longer takes the hub; it bumps a single `watch` counter after committing the status it already commits. Batch order was the queue's insertion order, so `SubAgent` carries a `spawn_seq` to keep delivery oldest-first. Tests move from exercising the hub directly to the supervisor API, and cover spawn-order batching and the shutdown-races-delivery case that the old shape could not express. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| apps | ||
| components | ||
| foundation | ||
| packages/fabro-api-client | ||