mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
docs: record why a resumed turn's send cannot hang an agent
Review asked twice whether `permit.send` can leave an agent Running with no turn on its way. It cannot, and the reasoning is not local to the call, so state it there. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8c19b1e94a
commit
a617eaa5eb
1 changed files with 8 additions and 0 deletions
|
|
@ -775,6 +775,14 @@ impl SubAgentSupervisor {
|
|||
|
||||
if let Some((permit, generation)) = resumed {
|
||||
self.publish();
|
||||
// This send cannot fail: `OwnedPermit::send` returns `()`, and the
|
||||
// capacity it needs was reserved above while the state lock was
|
||||
// held. Should a concurrent close drop the receiver first, the
|
||||
// command is discarded and the agent still cannot hang, because
|
||||
// every path that stops the runner -- `run_shutdown` and the two
|
||||
// drop impls -- is reached only after `begin_shutdown` has set
|
||||
// `Closing` under this same lock. A waiter then observes the close
|
||||
// and stops instead of waiting on a turn that will never run.
|
||||
permit.send(StartTurn {
|
||||
generation,
|
||||
prompt: message.to_string(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue