Skip to content

fix(orchestrator): cancel queued sessions when agent is disabled#41

Merged
JaredforReal merged 1 commit into
mainfrom
fix/agent-off-cancel-queued
May 7, 2026
Merged

fix(orchestrator): cancel queued sessions when agent is disabled#41
JaredforReal merged 1 commit into
mainfrom
fix/agent-off-cancel-queued

Conversation

@jimpablo
Copy link
Copy Markdown
Collaborator

@jimpablo jimpablo commented May 6, 2026

Summary

  • loom agent off now cancels all QUEUED sessions immediately
  • Previously, queued tasks continued waiting for semaphore slots and would run even after agent was disabled
  • RUNNING sessions are allowed to finish gracefully

Changes

  • Session now stores its asyncio Task reference (_task field)
  • SessionManager.cancel_queued() cancels all QUEUED sessions
  • Dispatcher.set_agent_enabled(False) calls cancel_queued()

Test plan

  • Run loom up, wait for drain to spawn sessions
  • Run loom agent off — verify QUEUED sessions are cancelled
  • Verify RUNNING sessions finish naturally, no new ones spawn
  • Run loom agent on — verify PENDING envelopes are drained again

Copilot AI review requested due to automatic review settings May 6, 2026 14:49
Signed-off-by: jimpablo <194239734+jimpablo@users.noreply.github.com>
@jimpablo jimpablo force-pushed the fix/agent-off-cancel-queued branch from 2e8a740 to 7ad7715 Compare May 6, 2026 14:56
@JaredforReal JaredforReal merged commit 9e72574 into main May 7, 2026
3 checks passed
@jimpablo jimpablo deleted the fix/agent-off-cancel-queued branch May 7, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants