Skip to content

session-fork parent token count resolution has no timeout and blocks session creation indefinitely #101718

Description

@aniruddhaadak80

Description

The recently-modified session-fork.ts (commit 88f1ec38) calls resolveParentForkTokenCount to decide whether to fork a parent session. This async call reads the parent transcript file, parses it, and counts tokens — but it has no timeout or abort signal.

Location

Impact

If the parent session transcript file is very large (hundreds of MB from a long-running agent) or if the filesystem is slow (NFS, FUSE, or a saturated SSD), this call blocks the session-create path indefinitely with no upper bound. Every new thread/reply in that session stalls, and the gateway accumulates blocked async contexts that never resolve, eventually exhausting connection slots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions