-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Summary
Two related issues causing Claude Code failed (rc=143) on staging:
1. /new command doesn't cancel running processes (fixed)
/new only cleared stored resume tokens — it did NOT cancel running processes. If a Claude session was running and the user typed /new, the old process kept running (~400 MB RSS), and the next prompt spawned a new session. This leaked processes and worsened memory pressure.
Fix: /new now cancels all running tasks for the chat before clearing sessions. Reply message shows "cancelled run and cleared" when a process was killed.
2. earlyoom killing Claude processes under memory pressure
Root cause of the rc=143: earlyoom sends SIGTERM to Claude Code processes when system memory drops below thresholds. Not an Untether or Claude Code bug — earlyoom is correctly protecting the system.
Evidence (earlyoom)
earlyoom logs (2026-03-23) — every rc=143 maps to an earlyoom kill:
| Time | earlyoom action | Untether session |
|---|---|---|
| 15:54:08 | SIGTERM → PID 1716517 "claude" (424 MB) | lba-web rc=143 |
| 16:00:02 | SIGTERM → PID 1832869 "claude" (394 MB) | scout rc=143 |
| 16:02:35 | SIGTERM → PID 1850322 "claude" (384 MB) | cf-monitor rc=143 |
| 16:02:50 | SIGTERM → PID 1868362 "claude" (374 MB) | lba-web rc=143 |
| 16:05:14 | SIGTERM → PID 1944950 "claude" (379 MB) | scout rc=143 |
| 16:05:49 | SIGTERM → PID 1947761 "claude" (366 MB) | cf-monitor rc=143 |
| 16:11:39 | SIGTERM → PID 1977747 "claude" (379 MB) | scout rc=143 |
| 16:11:54 | SIGTERM → PID 1974757 "claude" (371 MB) | 3c317ef4 lba-web rc=143 |
Root cause: memory saturation
- 31 GB total RAM, swap at 0% free
- 128 workerd processes from scout consuming ~13.5 GB
- 3-4 concurrent Claude sessions at ~400 MB each
- earlyoom triggers at <10% free RAM AND <5% free swap
Changes
src/untether/telegram/commands/topics.py— Added_cancel_chat_tasks()helper; updated_handle_new_commandand_handle_chat_new_commandto cancel running tasks before clearing sessionssrc/untether/telegram/loop.py— Addedrunning_taskstoTelegramCommandContext; passed through all/newcall sitestests/test_telegram_topics_command.py— 10 new tests covering cancellation behaviour
Affected versions
- Untether: v0.35.0rc11
- Claude Code: v2.1.81
- Host: lba-1 (Hetzner, 30 GB RAM, 4 GB swap)