MaxListenersExceededWarning for resize after resume; one run later loses shell spawning with persistent EBADF
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 38/100
- Issue-Typ
- Bug
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- node.js, react
- Bereich
- cli, developer-experience
Rechercherichtung
Beginne damit, die Warnung mit NODE_OPTIONS=--trace-warnings und --debug --resume zu reproduzieren. Untersuche dann den gebündelten Speicherort in dist/cli.mjs sowie die zugehörigen Ink/React-Stackframes. Vergleiche die beiden angehängten bereinigten Logs und verfolge die Fehler bei resize-listener und shell-spawn getrennt. Erledigt ist die Aufgabe, wenn fortgesetzte Sitzungen keine resize-listener mehr anhäufen und die gemeldeten shell-spawn-Fehler verstanden und behoben sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
Summary
Long-running/resumed Command Code sessions intermittently stop before the requested task is complete. With warning traces enabled, two independent resumed sessions produced the same warning from the same bundled source location:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected.
11 resize listeners added to [Socket]. MaxListeners is 10.
...
at file:///opt/homebrew/lib/node_modules/command-code/dist/cli.mjs:3:1248967
at commitHookEffectListMount (.../react-reconciler.production.js:6718:26)
at commitPassiveMountOnFiber (.../react-reconciler.production.js:8144:25)
In one of the runs, subsequent shell tools eventually started failing persistently with spawn EBADF, including commands as simple as true and echo. File-reading tools continued to work. Restarting/resuming can make the problem disappear temporarily, so the behavior appears intermittent.
I am not claiming that the resize-listener leak necessarily causes EBADF, but they occurred in the same process and the listener warning is independently reproducible.
Environment
- Command Code:
1.53.0 - Node.js:
v25.6.1 - OS: macOS
26.6.2(25G83), arm64 - Terminal: Apple Terminal,
TERM=xterm-256color - Command Code dependency:
ink@7.1.0 - Models/providers tested:
baseten/zai-org/GLM-5.3-Flashcheaperinference/glm-5.3-flash
The installed package declares Node.js >=22, so the active Node version satisfies its declared engine constraint.
Evidence
Two minimized sanitized traces are attached:
commandcode-178c-sanitized.log: listener warning in a Baseten session, followed by successful continuation after manual input.commandcode-c89132d7-sanitized.log: identical listener warning in a CheaperInference session, followed later by persistentspawn EBADFfor trivial local commands.
The full session transcripts are available privately if needed. They are not attached publicly because tool results contain project and infrastructure details.
Possibly related reports
- CommandCodeAI/command-code#601 — long sessions periodically stop with pending work and no error.
- QwenLM/qwen-code#7159 — the exact
11 resize listeners added to [WriteStream]warning; the linked fix reportedly shares a single terminal-size listener instead of attaching one per component instance. - CommandCodeAI/command-code#466 — completed generation with no assistant response displayed/saved (not identical, but potentially related to response/stream handling).
Expected Behavior
Expected behavior
- Mounting/unmounting or resuming the TUI should not accumulate
resizelisteners. - Long-running sessions should continue until the task is complete or report a clear reason for stopping.
- A failed child-process spawn should not permanently break all subsequent shell-tool invocations in that process.
- Empty assistant responses should be retried reliably or surfaced as an explicit error.
Actual Behavior
Actual behavior
There appear to be three observable failure modes:
-
The model returns a normal text message such as "moving to the next check", but no following tool call is made and the turn ends while todo items remain.
-
Some session records contain an assistant entry with an empty
contentarray despite non-zero output-token usage. Command Code sometimes injectsPlease continue your response..., but recovery is inconsistent. -
In one traced process, shell spawning later became unusable:
SHELL [true] -> spawn EBADF SHELL [echo alive] -> spawn EBADF SHELL [echo hello] -> spawn EBADF
Restarting/resuming may allow the same session to continue for a long time, making the issue appear random.
Steps to reproduce the issue
Reproduction
-
Start or resume a session containing a multi-step coding task with many tool calls.
-
Let it run until it stops while work remains.
-
Resume with warnings and debug output captured:
NODE_OPTIONS=--trace-warnings commandcode --debug \ --resume <session-id> 2>&1 | tee /tmp/commandcode-debug.log -
Continue the task through multiple tool calls.
-
Observe the
MaxListenersExceededWarningafter the eleventhresizelistener is attached. -
In one reproduced run, continue using shell tools; after several successful commands they begin returning
spawn EBADFpersistently.
The warning reproduced in two independent resumed processes with different session IDs and exactly the same Command Code bundle location.
Command Code Version
1.53.0
Operating System
macOS
Terminal/IDE
Apple Terminal, TERM=xterm-256color
Shell
No response
Session file (optional)
No response
Fix prompt (optional)
No response
Additional context
The normal --debug log primarily recorded startup/resume information and did not contain the runtime warning. Capturing stderr with NODE_OPTIONS=--trace-warnings was required to obtain the useful stack trace.
commandcode-178c-sanitized.log
commandcode-c89132d7-sanitized.log
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 4k
- Forks
- 350
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus CommandCodeAI/command-code
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#855 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
CommandCodeAI/command-code#841 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#655 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
CommandCodeAI/command-code#608 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 70/100
CommandCodeAI/command-code#893 ·
Alle Issues in CommandCodeAI/command-code
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
area: compat bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
area: dogs bug priority: P3 silent failure test-code
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
phoenixframework/phoenix#6847 ·