Commit abdcbb8
mentor: classify an empty-output handler kill (rc=137/143/offline) as transient, not a die
The improve-handler branch classified a failure transient only when the
captured output matched is_transient_claude_signature or
_fetch_stderr_is_offline. An empty-output non-zero exit — a `claude -p` handler
SIGKILLed/OOM-killed (rc=137/143) or cut mid-call by a quota/network blip —
produces an EMPTY $capture that matches neither TEXT signature, so it fell
through to die (exit 1). That marks garden-mentor.service Failed and fires
self-heal-run.sh into a diagnosis that fails identically in the same outage —
the observed 30-min FATAL loop on endolinbot (2026-07-05 18:20/18:50/19:20,
bare "FATAL: improve handler failed" with no preceding $out diagnostic).
Capture the handler's exit code immediately into $rc (under set +e, mirroring
gardener.sh:376-381) so it survives the later out="$(...)" substitution, and add
an empty-capture-transient branch mirroring gardener.sh:679-687: when the
capture is empty and is_transient_empty_failure "$rc" is true, WARN + exit 0
(markers unadvanced, retry next tick) rather than die. Reuses the same common.sh
helper the gardener relies on, keeping the two handlers' transient-vs-real
classification aligned. Reserves the die->self-heal path for a non-empty or
non-transient real defect.
Adds a regression subtest (rc=137 empty-output kill -> exit 0, markers
unadvanced) alongside the existing transient/real cases.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 2e0ea48 commit abdcbb8
2 files changed
Lines changed: 43 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
100 | 111 | | |
101 | 112 | | |
102 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
103 | 129 | | |
104 | 130 | | |
105 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
919 | 935 | | |
920 | 936 | | |
921 | 937 | | |
| |||
0 commit comments