fix(loop): fail arm-loop loudly on leftover __PLACEHOLDER__ after sed (#130)#167
Conversation
…#130) Guard both installed unit files (pr-loop and claude-rc) right after the sed blocks write them: grep each for any surviving __[A-Z_]*__ token and exit 1 with the offending file/placeholder if one leaked through. Turns future template/script skew into an immediate, diagnosable arm-time failure instead of a silent status=127 at the next reboot. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…fail-safe (#130) Two adversarial review findings on the arm-loop.sh leftover-placeholder guard: (1) grep -o found nothing on a clean install and, under set -euo pipefail, aborted the script before daemon-reload; (2) both systemd templates carry the literal doc token __PLACEHOLDER__ in their header comment, causing a false-positive exit 1 on every run. Scope the scan to non-comment (directive) lines only and add `|| true` so a no-match no longer aborts the healthy path. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
14 similar comments
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
|
fix(loop): fail arm-loop loudly on leftover PLACEHOLDER after sed (#130) (not yet reviewed) |
Summary
Closes #130.
Adds a defensive post-sed guard to
.claude/scripts/arm-loop.sh: after bothsedblocks write the installed systemd unit files (pr-loop-<slug>.service,claude-rc-<slug>.service) and beforesystemctl --user daemon-reload, the script now scans each generated unit for any leftover__[A-Z_]*__placeholder and, if found, fails loudly (stderr message naming the file and the exact leaked token, thenexit 1).Why (and what was already fixed)
The primary bug #130 reported — the missing
__PATH__substitution in the pr-loop sed block, which let the literal__PATH__reach the installed unit and crash-loop it at boot withstatus=127— was already resolved onmainby commit f9dcfcb (issue #107), which bakes a composed$baked_path(node/claude dirs + system dirs). This PR implements the issue's explicitly-recommended follow-up hardening: turn any future template/script skew (a new__FOO__added to a template without a matching-ehere) into an immediate, obvious arm-time failure instead of a silentstatus=127at the next reboot.Implementation notes
grep -v '^[[:space:]]*#'), because both templates carry the literal doc token__PLACEHOLDER__in their header comments — that prose is never a sed target and must not false-positive. A real leftover always lives in a directive line.grep -oexits 1 on no match; the|| trueinside the command substitution keeps the healthy (zero-leftover) path from abortingarm-loop.shunderset -euo pipefail, while a genuine leftover still triggersexit 1.arm-loop v6->v7.Validation
GATES_FILE=.claude/self/gates.json: build, lint (bash -non scripts), test (checks.sh test+smoke-fanout.sh).__PLACEHOLDER__false positive; (b) dropping a single substitution (__PATH__,__SPAWN_MODE__) -> the specific leftover is reported and wouldexit 1.Reviews (consensus=all, per
.claude/self/gates.json)🤖 Generated with Claude Code