fix(tracker-intake): exclude terminated sessions from seen issue set#2777
fix(tracker-intake): exclude terminated sessions from seen issue set#2777anmol0b wants to merge 1 commit into
Conversation
codebanditssss
left a comment
There was a problem hiding this comment.
Reviewed the tracker-intake lifecycle change and its regression coverage. Filtering terminated sessions out of the seen issue set correctly allows killed, crashed, or failed sessions to be retried while live sessions still prevent duplicate work. The focused tests and full backend test suite pass locally. Looks good to merge.
|
Thanks for contributing to Agent Orchestrator. This PR is being picked up by the current external contributor on-call pair: If someone is already working on this, please continue as usual. For faster context or live questions, you can also join the AO Discord. Join the session here: Come by if you want to see what is being built, ask questions, or just hang around with the community. |
Problem
seenIssueIDsinbackend/internal/observe/trackerintake/observer.gobuiltits "already has a session" set from
ListAllSessions, which returns everysession including terminated ones. Once any session — killed, crashed, or a
failed spawn — had ever existed for an issue, that issue's ID stayed in the
seenset forever. The intake poller would then skip the issue on everysubsequent poll, so it never got re-spawned. The issue stayed open in the
tracker, assigned, and silently unworked — no error, no log, no notification.
Fix
seenIssueIDsnow also checkssess.IsTerminated, so only live sessionscount as "claiming" an issue:
A killed/crashed/failed-spawn session now frees its issue for the next
intake cycle.
Tests
Added to
observer_test.go:TestSeenIssueIDsExcludesTerminatedSessions— a live session for an issueis still seen even when a terminated session for the same issue exists.
TestSeenIssueIDsIgnoresOnlyTerminatedSession— an issue with only aterminated session is not marked as seen.
TestPollRespawnsIssueAfterTerminatedSession— end-to-end:Pollspawns anew session for an issue whose only prior session is terminated.
All three fail on
mainand pass with the fix. Full package and fullbackend suite pass (
go test ./...).Scope
This PR only touches
seenIssueIDs's filtering logic and its tests. It doesnot:
ListAllSessions/session_store.go) — theIsTerminatedfield is already scanned intodomain.SessionRecordfromthe DB, so no query change was needed.
blocked/waiting_input). If a session is stuck rather than properly marked
terminated, this fix does not help it — that's a separate root cause and
separate PR.
issue. Happy to follow up with that in a separate PR if wanted, but kept
this one scoped to the single root cause.
Fixes #2746