Skip to content

fix(terminal): stop reporting a clean exit as signal "0" - #366

Open
gnutix wants to merge 1 commit into
johannesjo:mainfrom
gnutix:fix/pty-clean-exit-signal
Open

gnutix wants to merge 1 commit into
johannesjo:mainfrom
gnutix:fix/pty-clean-exit-signal

Conversation

@gnutix

@gnutix gnutix commented Nov 13, 2026

Copy link
Copy Markdown

Problem

A setup script that exits 0 shows the red badge "Setup script failed (0)" and an error notification.

On Unix, node-pty's onExit reports signal: 0 when a process exits normally. electron/ipc/pty.ts turned any defined signal into a string (signal !== undefined ? String(signal) : null), so a clean exit reached the renderer as signal: "0", which is truthy. Then:

  • noteSetupShellExit (exitCode === 0 && !signal) marks the setup run failed, and setupExitLabel shows the signal, 0. This affects every successful setup script on Linux and macOS since feat(worktrees): opt-in per-project setup, teardown and include list #349.
  • taskStatus.ts (agent.exitCode !== 0 || agent.signal !== null) counts an agent that exited cleanly as failed.
  • The Codex chat handoff already worked around it with code.signal === '0'.

Fix

Send null unless node-pty reports a real signal number (signal ? String(signal) : null), so no consumer needs to know about the 0 quirk. The Codex workaround is removed, since it can no longer be reached.

Tests

  • New pty.test.ts cases: signal 0 → null, undefined → null, 15 → "15". The signal-0 case fails without the fix (expected signal: '0' to match null).
  • npm run check and npm test pass (6251 unit + 2637 client tests).

🤖 Generated with Claude Code (Opus 5.5)

On Unix, node-pty reports `signal: 0` when a process exits normally. The
exit message turned that into the string "0", which the renderer treats
as a real signal: a setup script that exited 0 showed "Setup script
failed (0)", and an agent that exited cleanly counted as failed in the
task status. Send `null` unless there is a real signal number, and drop
the Codex handoff's special case for "0".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant