Skip to content

Fix Claude Code CLI abnormal exit (code 159): classify fatal-signal crashes in harness retry logic - #52837

Merged
pelikhan merged 6 commits into
mainfrom
copilot/aw-failures-fix-code-cli-crash
Aug 15, 2026
Merged

Fix Claude Code CLI abnormal exit (code 159): classify fatal-signal crashes in harness retry logic#52837
pelikhan merged 6 commits into
mainfrom
copilot/aw-failures-fix-code-cli-crash

Conversation

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Avenger's Claude Code CLI step crashed with exit code 159 (128+31 = SIGSYS) twice in one day. The harness only special-cased SIGKILL(137)/SIGTERM(143) as non---continue-able termination signals; any other fatal-signal crash (SIGSYS, SIGSEGV, etc.) fell through to the generic "partial execution" retry path, which resumes the exact on-disk session via --continue — risking an immediate repeat of whatever crashed it.

Changes

  • New crash-signal classification in actions/setup/js/claude_harness.cjs: added a CRASH_SIGNAL_EXIT_CODES map for known fatal-signal exit codes (SIGILL=132, SIGABRT=134, SIGBUS=135, SIGFPE=136, SIGSEGV=139, SIGSYS=159), with isCrashSignalExitCode() and crashSignalNameForExitCode() helpers.
  • Retry decision update: shouldRetryWithContinue() now treats these crash codes like the existing SIGKILL/SIGTERM handling — --continue is disabled and the next attempt starts a fresh session instead of resuming corrupted state.
  • Improved diagnostics: retry logs now surface the resolved signal name (e.g. crashSignal=SIGSYS) alongside the exit code, giving future occurrences a clearer trail without requiring a core dump.
  • Tests: added coverage for the new helpers and the updated shouldRetryWithContinue behavior on crash exit codes (134/139/159).
// Before: exit 159 fell into the generic "partial execution" path → retried with --continue
// After: recognized as a fatal-signal crash → --continue disabled, fresh-run retry
isCrashSignalExitCode(159); // true (SIGSYS)
crashSignalNameForExitCode(159); // "SIGSYS"

branch refresh requested from run https://github.com/github/gh-aw/actions/runs/31886878354> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.7 AIC · ⌖ 5.9 AIC · ⊞ 8.7K ·

Comment /souschef to run again

…e harness retry logic

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Claude Code CLI abnormal exit (code 159) Fix Claude Code CLI abnormal exit (code 159): classify fatal-signal crashes in harness retry logic Aug 15, 2026
Copilot AI requested a review from pelikhan August 15, 2026 05:33
@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Category: bug | Risk: medium | Score: 66/100

  • Impact: 28/50 (fixes harness mis-classification of fatal-signal crashes, improves retry reliability)
  • Urgency: 20/30 (recurring crash signature, no CI signal yet)
  • Quality: 18/20 (small targeted diff, clear root cause, no reviews yet)

Recommended action: fast_track
Targeted reliability fix for harness crash classification. Batched with reliability-fixes cluster (#52757, #52836, #52854).

Generated by 🔧 PR Triage Agent · auto · 46.6 AIC · ⌖ 2.63 AIC · ⊞ 8.1K ·

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: bug
  • Risk: medium
  • Priority: medium
  • Score: 68/100
  • Recommended action: fast_track
  • Batch: reliability-fixes

Improves harness crash-signal classification to avoid corrupted-session retries. CI unstable — verify before merge.

Automated triage — see [PR Triage Report] for full context.

Generated by 🔧 PR Triage Agent · auto · 62.5 AIC · ⌖ 2.53 AIC · ⊞ 8.1K ·

@pelikhan
pelikhan marked this pull request as ready for review August 15, 2026 12:54
Copilot AI balanced review requested due to automatic review settings August 15, 2026 12:54
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot generalize to all harnesses

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds fatal-signal classification to Claude harness retry logic so crashes should restart with a fresh session.

Changes:

  • Maps known fatal-signal exit codes to signal names.
  • Disables --continue after classified crashes.
  • Adds helper and retry-decision tests.
Show a summary per file
File Description
actions/setup/js/claude_harness.cjs Adds crash classification, logging, and fresh-session retries.
actions/setup/js/claude_harness.test.cjs Tests crash-code helpers and retry behavior.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

return false;
}
if (isSignalTerminationExitCode(exitCode)) {
if (isSignalTerminationExitCode(exitCode) || isCrashSignalExitCode(exitCode)) {
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot generalize to all harnesses

Generalized in 8a1c0e6: extracted the crash-signal classification (SIGILL/SIGABRT/SIGBUS/SIGFPE/SIGSEGV/SIGSYS) into a shared harness_crash_signals.cjs module and applied it to the Copilot harness's CLI-mode --continue retry decision, so a fatal-signal crash there also permanently disables --continue and forces a fresh-run retry. Codex harness needs no change since it never supports --continue — every retry there is already a fresh run.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, verify the current unstable status is fully explained or resolved, and run the pr-finisher skill before handing this PR back to maintainers.

Outstanding review items:

  • confirm the generalized fatal-signal handling is correct across all harnesses that can reuse this classifier, and summarize why no additional harness changes are needed

Failed checks from the compact candidate set:

  • None listed.

Branch update was requested automatically for this run when GitHub allows it.
Run context: https://github.com/github/gh-aw/actions/runs/31886878354

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.7 AIC · ⌖ 5.9 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Quick triage for maintainer-ready follow-up:

Please refresh the branch if needed, verify the current unstable status is fully explained or resolved, and run the pr-finisher skill before ha...

Fixed the outstanding blocking review item in 6f... (see latest commit): runProcess in process_runner.cjs now synthesizes the conventional 128+signal exit code when Node reports code=null, signal="SIGSYS" (or any other signal), instead of collapsing it to exitCode=1. This means isCrashSignalExitCode/shouldRetryWithContinue in both claude_harness.cjs and copilot_harness.cjs now actually observe signal-killed subprocesses, closing the gap the reviewer flagged. Added an integration-style test that signal-kills a stub child (SIGSEGV) and asserts the synthesized exit code (139) and log output. No other harness needs a change: Codex never supports --continue, so all its retries are already fresh runs regardless of exit code/signal. Full actions/setup/js suite (392 files / 12996 tests) passes locally.

Copilot AI requested a review from gh-aw-bot August 15, 2026 13:41
@pelikhan

Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan merged commit 6f73444 into main Aug 15, 2026
9 checks passed
@pelikhan
pelikhan deleted the copilot/aw-failures-fix-code-cli-crash branch August 15, 2026 14:05
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw-failures] [P0] Avenger: Claude Code CLI abnormal exit (code 159) — 2nd crash today, distinct from tracked exit-139

4 participants