Skip to content

Commit cb4cbfc

Browse files
committed
fix: use last_activity_at in kill ordering + add TODO for activity updates
kill_target_last_activity was still using started_at for branches while timeout detection had been switched to last_activity_at. Also note that last_activity_at is only set at branch spawn — updating it mid-execution requires ProcessEvent plumbing from the hook.
1 parent c75f93c commit cb4cbfc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/agent/cortex.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ struct BranchTracker {
354354
branch_id: BranchId,
355355
channel_id: ChannelId,
356356
started_at: Instant,
357+
/// Currently set at branch spawn only. To make this truly activity-based,
358+
/// send a ProcessEvent variant from the hook on tool completions and text
359+
/// deltas, then update this field in the cortex event loop.
357360
last_activity_at: Instant,
358361
}
359362

@@ -510,7 +513,7 @@ fn parse_structured_success_flag(result: &str) -> Option<bool> {
510513
fn kill_target_last_activity(target: &KillTarget) -> Instant {
511514
match target {
512515
KillTarget::Worker(tracker) => tracker.last_activity_at,
513-
KillTarget::Branch(tracker) => tracker.started_at,
516+
KillTarget::Branch(tracker) => tracker.last_activity_at,
514517
}
515518
}
516519

0 commit comments

Comments
 (0)