Repository navigation
Daemon refuses new callers once 256 transports pile up from callers that are gone #468
Description
What happens
On a long-lived daemon, every call that needs a new keep-alive transport eventually fails with:
Transport capacity reached; drain unused transports with daemon stop.
Callers whose transport already exists keep working, but any new caller identity is refused. mcporter daemon status lists 256 transports, almost all of them for callers that are long gone. Only a daemon restart clears it.
Why
- Transport identity includes the caller's resolved environment. This is documented in
docs/daemon.md, and I'm not proposing to change it. In practice, though, every coding-agent session carries its own session variables (for exampleCLAUDE_CODE_SESSION_ID), so each session creates its own transport per keep-alive server. - Nothing removes an entry from the broker's
entriesmap exceptclose(). Idle retirement setsstate = 'idle'and keeps the entry. Keep-alive servers withoutidleTimeoutMsare never retired, and an entry whose connect failed keeps its slot unless that same identity calls again. invokerefuses atentries.size >= 256, so entries left behind by callers that are gone use up the capacity permanently.
With about 11 keep-alive servers per session, the daemon refuses new sessions during roughly the 24th session since its last restart. On my machine daemon status showed 256 transports, all connected, the newest last used two days before the outage. daemon restart cleared it, but only until the same build-up happened again.
Repro (compiled CLI, private daemon)
Run one keep-alive HTTP server, then make 260 mcporter call invocations, each with a different CALLER_SESSION_ID in its environment. On main (2874448), callers 1–256 succeed and callers 257–260 fail with transport_limit. The script is linked from the PR.
Expected
Transports nobody is using should not hold capacity forever. At the limit, the broker could retire the least recently used transport that has no queued or active call. It would refuse only when no transport can be safely reclaimed.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Oct 26, 2026
Codex review: this still needs some work.
Summary
This issue remains source-proven on current main, and its open fixing PR has an explicit collaborator hold pending a session-retention decision.
Reproducibility: Current source proves rejection of identity 257 because caller release and idle retirement do not free transport entries, corroborated by the contributor's inspected CLI screenshot; no tests or live reproduction ran during this read-only review.
Root-cause cluster
Relationship:
canonicalCanonical: #468
Summary: This issue owns the retained-entry capacity failure addressed by the open fixing PR; searches found no separate report superseding it.
Members:
fixed_by_candidate: fix(daemon): reclaim unused transports at the broker limit #469 - The PR explicitly closes this issue and changes admission at the same 256-entry capacity boundary.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Maintainer decision needed
Next step
Resolve the retained-session eviction policy in #469 before landing its capacity repair.
Review details
Best possible solution:
Land an explicitly approved capacity-reclamation policy that preserves environment isolation, active work, uncertain outcomes, Chrome ownership, and verified retirement.
Do we have a high-confidence way to reproduce the issue?
Current source proves rejection of identity 257 because caller release and idle retirement do not free transport entries, corroborated by the contributor's inspected CLI screenshot; no tests or live reproduction ran during this read-only review.
Is this the best way to solve the issue?
The linked PR addresses slot accumulation through existing serialized retirement, but its connected-session eviction policy requires the explicit decision already requested by the collaborator.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 8ba0ef967805.
Label changes
Label changes:
No label changes.
Label justifications:
P1: Accumulated transport identities block new agent sessions on a long-lived daemon until an operator drains or restarts it.impact:other: Permanent transport-slot exhaustion prevents new connections while existing callers continue working.Evidence reviewed
What I checked:
src/daemon/broker.ts:172, 8ba0ef967805)src/daemon/broker.ts:402, 8ba0ef967805)src/daemon/connection-identity.ts:136, 8ba0ef967805)docs/daemon.md:11, 8ba0ef967805)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed October 27, 2026, 10:43 PM ET / October 28, 2026, 02:43 UTC.
50 remaining items