Commit 8aab4e4
mentor-claude: propagate transient inner-claude failure instead of swallowing it
The `claude -p` call ran under `set -euo pipefail`, so a non-zero exit — the
common transient case (quota/usage cut, Anthropic overload/5xx, api/network
blip) — aborted the handler at rc=1 with claude's stdout captured into a
discarded $out and nothing re-emitted. mentor.sh then saw an empty capture +
rc=1, which matches neither is_transient_empty_failure (wants a signal/offline
rc) nor is_transient_claude_signature/_fetch_stderr_is_offline (both need
signature TEXT), so it fell through to `die` and misread a transient inner-agent
outage as a real handler defect — needlessly marking garden-mentor.service
Failed and firing self-heal-run.sh into an identically-failing diagnosis (the
30-min FATAL loop observed 2026-07-06 00:50/01:20/01:50).
Mirror gardener-claude.sh / follow-up-claude.sh: run the inner agent under
`set +e`, capture rc and combined stdout+stderr, restore `set -e`, and on
non-zero rc re-emit the captured output to stderr AND propagate rc via `exit`
so mentor.sh's transient classifiers can see the signature text and/or a
propagated signal/offline rc and correctly WARN-and-retry. The rc=0 path parses
$out for JOB blocks exactly as before. Route the call through a
GARDEN_MENTOR_CLAUDE seam (default `claude`) mirroring GARDEN_FOLLOWUP_CLAUDE so
the transient-propagation path is testable with a non-`claude`-named stub (the
fleet sandbox pins the literal `claude` binary). Add a run-test.sh regression
driving the real handler through fake-claude.sh.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent d7ec9fc commit 8aab4e4
2 files changed
Lines changed: 50 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
65 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
66 | 94 | | |
67 | 95 | | |
68 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
933 | 933 | | |
934 | 934 | | |
935 | 935 | | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
936 | 956 | | |
937 | 957 | | |
938 | 958 | | |
| |||
0 commit comments