Repository navigation
fix(skills-sync): fail the run when a push, gh call or skill copy fails - #177
Merged
Merged
Conversation
sync-skills.sh calls skills_sync_run_repo as an `if` condition. Bash ignores set -e inside a function in that context, also in a subshell that sets -e again, so a failed push or gh call printed 'synced' and the run stayed green (run 40313372142: 403 on an archived repo, then 'synced'). The same held for mkdir/rsync in skills_sync_sync_repo. Every git, gh, mkdir and rsync step now checks its own status. The new tests drive scripts/sync-skills.sh, the real caller, not the bare function.
6 tasks done
…ution Cross-review findings: `git diff --cached --quiet` exits >1 on an error, which counted as a change; and an empty realpath result for the clone root made every absolute destination look contained. Both now fail the repository. Two more entry-point tests cover them.
bketelsen
approved these changes
Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The skills sync reported success when a push or a
ghcall failed.scripts/sync-skills.sh:31callsskills_sync_run_repoas anifcondition. Bash ignoresset -efor every command inside a function in that context, also inside a subshell that sets-eagain. So the( set -e; … )block inscripts/lib/skills-sync-repo.shdid not stop on a failure: a failed push printed== <repo>: syncedand the job ended green. Production evidence: run 40313372142 (2026-10-26), snowcat-cockpit:remote: This repository was archived so it is read-only/fatal: … 403, thenPR #55 already open — branch force-updatedandsynced. The same masking applied tomkdir/rsync/marker writes inskills_sync_sync_repo(called asif !), which could stage a partial mirror.Changes:
scripts/lib/skills-sync-repo.sh: every git and gh step in the subshell checks its own status (|| exit 1); the subshell's status is read with|| rc=$?, so the function behaves the same under anifcaller and under aset -ecaller.scripts/lib/skills-sync-containment.sh:mkdir,rsyncand the marker write return 1 on failure.test/sync-skills.test.mjs: 4 new tests drivescripts/sync-skills.sh(the real caller), with stubbed failures of push,gh pr list,gh pr createandrsync. Each asserts exit 1,::error::sync failed for frostyard/consumer, noconsumer: synced, and (for git/gh) that a later consumer still syncs. The existingsync-skills-run-repotests call the bare function, so they did not see the bug.Found in the 2026-10-31 core skills audit (Odrade report
2026-10-31-core-skills, action 1).Risk tier
Risk tier: 2 — the automation script that pushes to consumer repositories (precedent #124). No workflow, permission or token change.
Verification
main(Missing expected rejection.for push, pr list, pr create; the rsync test fails without the containment change) and pass with the fix.npm run check: docs gate 1.000/1.000/1.000,bash_syntax: 6/6, 72/72 tests pass.