Repository navigation
fix(agent-runner): reconcile orphaned running conversations - #665
Conversation
There was a problem hiding this comment.
ℹ️ No critical issues — one minor suggestion inline.
Reviewed changes
Reviewed the full two-commit PR (startup reconciliation of orphaned running conversations, plus the follow-up that ignores terminal sandbox Jobs), and traced the decision logic, both sandbox backends, and the publishing path against handler.publishTerminalStatus and services/realtime's router.
- Startup reconciliation —
reconcileRunningConversationsOnStartuplistsrunningrows, diffs them against the backend's live set, and fails orphans viaFailIfNotTerminalthen publishes terminal status. Backgrounded and fail-safe on listing/update errors, matching the issue's acceptance criteria. - Pure decision function —
shouldReapRunningConversationcorrectly leaves non-llm, environment-backed, live-sandbox, and within-grace rows untouched; table-tested. - Backend live sets — Docker (running containers by
labelConvID) and Kubernetes (non-terminal managed Jobs) implementations are correct, and only the twoManagers implementBackend. Build and targeted tests pass locally.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Re-reviewed the delta since the prior pullfrog review (head eae7dc9), which is the single follow-up commit 9cc3690 plus its new test.
- Routed orphan-failure events through the realtime context resolver —
reconcileRunningConversationsOnStartupnow callsGetConversationRealtimeContextand passes the resolvedownerAccountIDintoPublishRealtime, matchinghandler.publishTerminalStatus. Global-chat and owner-private project-chat failures now reach the owner room; shared project chats keep their project authz. On lookup failure the event is skipped, butPublishConversationStatusstill fires so the queue still advances. - Added
reconcile_realtime_test.go— new scenario test covering global / owner-private / shared project routing plus the lookup-failure path; it is gated onPACA_RECONCILE_TEST_DSNso it is skipped in CI.
The prior inline thread on the nil-actor routing is resolved by this commit.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
pikann
left a comment
There was a problem hiding this comment.
LGTM! Thank you for the contribution! 🚀

Fixes #664
What changed
runningconversations whose ephemeral sandbox is no longer live.Verification
go test ./...inservices/agent-runner— passed.go vet ./...inservices/agent-runner— passed.git diff --check— passed.The targeted regression tests cover stale/live/grace/environment/ACP decisions and Kubernetes active-vs-failed Job discovery. No live cluster test was run; the startup behavior is guarded against backend-list and conditional-update failures.