Repository navigation
[Loops] completed run-agent sessions remain active and idle #445
Description
CompozyOS version
v0.3.0-beta.18 — latest official beta release
The affected Loop runtime was also verified against the current main branch during root-cause analysis.
Operating system
Linux (x86_64)
Area
Core / daemon, Sessions, Loops & tasks
ACP agent
Codex (the behavior is not provider-specific)
Steps to reproduce
- Start a Loop containing an isolated
run-agentnode. - Let the agent return schema-valid output so the node succeeds.
- Inspect the Loop output and note the bound session ID.
- Run
compozy session status <session-id> --jsonafter the agent turn and node have completed.
What happened
The ACP turn completed and the Loop accepted the node output, but the Loop-owned system session remained active in idle. It stopped only after an explicit user cancellation.
Production evidence:
- Loop Run:
looprun-9200415b0e47ad26 - Node:
execute_task(kind: run-agent,session.isolated: true) - Session:
sess_a99d86feccd4a21e9827ff158fc6ef19 - Session event sequence 451:
doneat2026-08-20T19:52:11.040187174Z - The node output was accepted as
succeeded, and the Loop later reacheddone. - No automatic
session_stoppedevent followed. - Session event sequence 452:
session_stoppedat2026-08-20T20:30:40.644366646Z, withstop_reason=user_canceled - The completed Loop-owned session therefore remained active for about 38 minutes until manual cleanup.
This report does not concern ordinary user sessions: those are intentionally reusable and may remain active in idle after a turn.
What I expected
When a Loop-owned run-agent binding can no longer be reused, CompozyOS should durably stop its system session. A successful isolated action must not leave an active process behind.
Cleanup must remain retry-safe: a retriable action failure may need the same session to continue from its latest progress, so the fix must be tied to the binding/cell lifecycle rather than blindly stopping after every prompt.
Root-cause evidence
RunAgentActionExecutor binds and prompts the session, then returns the accepted result without closing the run-owned binding. ActionSessionBinder exposes bind, prompt, and prompt-cancel operations, but no terminal binding-close operation for run-agent.
The shared binding store already supports CloseSessionBinding, and the durable cleanup relay stops run-owned Goal sessions after terminal checkpoint settlement. No equivalent terminal transition is invoked for a settled run-agent cell, so no cleanup obligation is queued.
Acceptance criteria
- A successful isolated
run-agentcell durably closes its run-owned binding and stops the session. - Terminal failure/cancel/kill paths do not leak run-owned
run-agentsessions. - Retriable/death-resume work keeps the session alive until the cell reaches a true terminal boundary.
- Cleanup is idempotent and survives daemon restart through the existing durable cleanup lane.
- Borrowed origin/user sessions are never stopped by Loop cleanup.
- Focused failure-path and managed-runtime tests prove the terminal and retry cases.
Final checks
- I searched existing issues and this is not a duplicate.
- I verified the affected code path against the current
mainbranch.
Metadata
Metadata
Assignees
Labels
Type
Fields
Projects
- StatusShow more project fieldsDone
Activity