Skip to content

fix: suppress auto-continue on signal deaths (#222)#226

Merged
Nathan Schram (nathanschram) merged 1 commit intodevfrom
fix/auto-continue-signal-death
Mar 23, 2026
Merged

fix: suppress auto-continue on signal deaths (#222)#226
Nathan Schram (nathanschram) merged 1 commit intodevfrom
fix/auto-continue-signal-death

Conversation

@nathanschram
Copy link
Member

Summary

Auto-continue was causing a death spiral when earlyoom killed Claude sessions. Now suppressed on signal deaths (rc=143/SIGTERM, rc=137/SIGKILL).

The death spiral: earlyoom kills 4 sessions → all have last_event_type=user → auto-continue respawns all 4 (~5 GB new processes) → earlyoom kills them again → repeat.

The fix: _should_auto_continue now checks proc_returncode — signal deaths (rc>128 or rc<0) are excluded. The upstream bug #34142/#30333 exits with rc=0, so auto-continue still triggers for its intended purpose.

Closes #222

Changes

  • src/untether/runner_bridge.py_is_signal_death() helper + proc_returncode param on _should_auto_continue
  • src/untether/runner.pyproc_returncode field on JsonlStreamState, set after proc.wait()
  • tests/test_exec_bridge.py — 12 new tests (7 auto-continue + 5 signal death)
  • tests/test_exec_runner.py — default assertion for proc_returncode

Test plan

  • 1815 tests pass, 81.37% coverage
  • Existing auto-continue tests still pass (rc=0 upstream bug still detected)
  • Signal deaths (143, 137, -9, -15) correctly blocked
  • Normal exits (0, 1, None) correctly allowed

🤖 Generated with Claude Code

…222)

When earlyoom killed Claude sessions (rc=143/SIGTERM), auto-continue detected
last_event_type=user and immediately respawned all 4 killed sessions (~5 GB of
new processes) into the same memory pressure. This caused a death spiral where
sessions were killed and respawned repeatedly.

Fix: _should_auto_continue now checks proc_returncode — signal deaths (rc>128
or rc<0) are excluded. The upstream bug #34142/#30333 exits with rc=0, so
auto-continue still works for its intended purpose.

- Add _is_signal_death() helper to runner_bridge.py
- Add proc_returncode field to JsonlStreamState
- Store returncode on stream state after process exit
- Pass proc_returncode through to _should_auto_continue
- 12 new tests for signal death detection and auto-continue gating

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 128a591e-556f-45ba-a2c0-56b52db94b9f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/auto-continue-signal-death

Comment @coderabbitai help to get the list of available commands and usage tips.

@nathanschram Nathan Schram (nathanschram) merged commit 198a7c9 into dev Mar 23, 2026
21 checks passed
@nathanschram Nathan Schram (nathanschram) deleted the fix/auto-continue-signal-death branch March 23, 2026 09:53
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