Skip to content

[Loops] completed run-agent sessions remain active and idle #445

Closed

Description

@franciscpd

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

  1. Start a Loop containing an isolated run-agent node.
  2. Let the agent return schema-valid output so the node succeeds.
  3. Inspect the Loop output and note the bound session ID.
  4. Run compozy session status <session-id> --json after 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: done at 2026-08-20T19:52:11.040187174Z
  • The node output was accepted as succeeded, and the Loop later reached done.
  • No automatic session_stopped event followed.
  • Session event sequence 452: session_stopped at 2026-08-20T20:30:40.644366646Z, with stop_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-agent cell durably closes its run-owned binding and stops the session.
  • Terminal failure/cancel/kill paths do not leak run-owned run-agent sessions.
  • 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 main branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions