crash_watch: track prev_sub_agents to fix needs_login for newly spawned agents

This commit is contained in:
damocles 2026-05-22 12:26:49 +02:00 committed by Mara
parent 55fe2856b9
commit 7426654a74
2 changed files with 26 additions and 31 deletions

View file

@ -210,24 +210,12 @@ fn finish_approval(
});
}
}
ApprovalKind::Spawn => {
coord.notify_manager(&HelperEvent::Spawned {
agent: approval.agent.clone(),
ok,
note,
sha: approval.fetched_sha.clone(),
});
// Newly spawned container has no claude session yet. Emit
// NeedsLogin immediately so the manager prompts the operator
// rather than waiting for crash_watch (which would miss it
// because the agent appears simultaneously in both prev_needs
// and current_needs, making the diff empty on the first tick).
if ok {
coord.notify_manager(&HelperEvent::NeedsLogin {
agent: approval.agent.clone(),
});
}
}
ApprovalKind::Spawn => coord.notify_manager(&HelperEvent::Spawned {
agent: approval.agent.clone(),
ok,
note,
sha: approval.fetched_sha.clone(),
}),
ApprovalKind::ApplyCommit if is_first_spawn => {
coord.notify_manager(&HelperEvent::Spawned {
agent: approval.agent.clone(),
@ -235,11 +223,6 @@ fn finish_approval(
note,
sha: approval.fetched_sha.clone(),
});
if ok {
coord.notify_manager(&HelperEvent::NeedsLogin {
agent: approval.agent.clone(),
});
}
}
ApprovalKind::ApplyCommit => coord.notify_manager(&HelperEvent::Rebuilt {
agent: approval.agent.clone(),