Skip to content

fix: Enforce active session cap in UnifiedExecManager #146

Closed

Description

@minorcell

Summary

MAX_SESSIONS is defined as 64, but active sessions are not capped. Cleanup only removes exited sessions when total size exceeds the limit.

  • Affected code: /Users/mcell/Desktop/workspace/memo-cli/packages/tools/src/tools/exec_runtime.ts:13
  • Cleanup logic: /Users/mcell/Desktop/workspace/memo-cli/packages/tools/src/tools/exec_runtime.ts:160

Why this matters

A model can create many long-running commands and exceed intended limits, causing uncontrolled process count and memory/FD pressure.

Repro

Run exec_command many times with a long-running command (sleep 5) and yield_time_ms: 0.

Local result from 70 calls:

  • { running: 70, errors: 0 }

This exceeds MAX_SESSIONS=64 with no rejection.

Expected

New sessions should be rejected (or oldest should be terminated/evicted) once active session limit is reached.

Actual

No limit is enforced for running sessions.

Suggested fix

  • Track active (non-exited) session count and reject or evict above limit.
  • Optionally add idle timeout/TTL cleanup policy.
  • Add regression tests for cap enforcement.

Requested implementer

Please let memo handle this fix.

Activity

  1. added
    bugSomething isn't working
    needs-triageIssue needs initial triage
    area:toolsBuilt-in tools and tool runtime
    area:coreCore runtime and session state
    on Feb 11, 2026
  2. minorcell commented on Feb 11, 2026

    @minorcell
    OwnerAuthor

    Fixed in commit c3124fb.

    Changes:

    • Added active session counting in UnifiedExecManager.
    • Enforced MAX_SESSIONS for live sessions in start(), returning a deterministic error when exceeded.
    • Added regression test that starts >64 long-running sessions and verifies overflow rejection.

    Validation:

    • pnpm test packages/tools/src/tools/codex_tools.test.ts
  3. minorcell commented on Feb 11, 2026

    @minorcell
    OwnerAuthor

    Closing as fixed by c3124fb.

  4. added 2 commits that reference this issue on Feb 12, 2026
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

    area:coreCore runtime and session statearea:toolsBuilt-in tools and tool runtimebugSomething isn't workingneeds-triageIssue needs initial triagepriority:p1High priority

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions