Repository navigation
fix(sync): the gitlink sync never opened a PR — its gate diffed the wrong thing - #73
Conversation
…hing
The daily sync workflow has been running green and doing nothing. Its change
gate is
if git diff --quiet; then changed=false
and `git diff` with no revision compares the WORKTREE against the INDEX, while
scripts/sync-gitlinks.sh line 33 does `git add "$path"` for every gitlink it
bumps. A sync that changed something therefore leaves nothing UNSTAGED, the gate
reads changed=false, and the PR step is skipped.
So the automation is a no-op exactly when it has work to do, and reports success
either way. That is why every gitlink sync that has actually landed was opened by
hand.
Measured on run 33360266234 (dispatched 2026-08-31T05:21Z, with three repos
demonstrably drifted): the "Bump pins" step computed the correct new pin —
== charly (default-branch HEAD) ==
charly -> 0443e07
— and the run still finished with no PR, leaving the umbrella pinned at 1d0164f0.
The git semantics, reduced to a two-line reproduction:
(stage a modification, then)
git diff --quiet -> 0 "nothing to sync"
git diff --cached --quiet -> 1 there IS a change
git diff --quiet HEAD -> 1 there IS a change
Fix: gate on `git diff --quiet HEAD`, which sees staged and unstaged alike, so a
future change to whether the script stages cannot silently disarm the workflow
again.
Claude-Session: https://claude.ai/code/session_01Gf42A3bau77JigFYLALrnq
Review — PASSHead SHA: Security screen: PASS — single-line CI condition fix ( Checklist: All applicable rules PASS or NA.
Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Change class: CI workflow — one condition in the sync job's dirty gate ( Security screen: PASS — single-line gate fix that strengthens the sync (turns a silent no-op into a loud failure); no scope mismatch, no secrets/exfiltration, no weakened guardrails, no supply-chain change. Checklist: All applicable rules PASS or NA.
Comment intake: One prior Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
…an pass A1 (#78) * fix(sync): open the PR with the org's bot app, not the default token #73 fixed the gate so the sync finally reaches its PR step. That step then failed: pull request create failed: GitHub Actions is not permitted to create or approve pull requests (createPullRequest) The obvious unblock is the org toggle `can_approve_pull_request_reviews`, and it does work -- but marketplace's refresh.yml already warns against exactly that, in as many words: Do NOT 'fix' it by enabling can_approve_pull_request_reviews -- that also lets workflows approve PRs. The warning is right: the toggle bundles create with approve, and this org auto-merges on a PASS verdict, so granting approve to every workflow is a review-bypass surface. refresh.yml already solves this properly by minting a short-lived GitHub App token, and the org secrets it uses (CHARLY_AUTO_MERGE_APP_ID / CHARLY_AUTO_MERGE_PRIVATE_KEY) are present. This adopts the identical pattern -- same SHA-pinned action, same secrets, same fallback -- so the umbrella stops being the one repo that needed a security toggle to do what its sibling already does safely. The toggle was enabled earlier in the session to unblock the sync before this pattern was found; it is turned back off, and the verification run below is with it off, which is what proves the app token rather than the toggle is doing the work. Claude-Session: https://claude.ai/code/session_01Gf42A3bau77JigFYLALrnq * fix(sync): the sync PR body cannot pass A1 — name every moved gitlink With the App token in place the workflow finally opened a PR that CI could see (#76). It was immediately BLOCKed: A1 — scope mismatch / incomplete body. The PR title is "chore: sync gitlinks" and the body says only "Automated sync of all umbrella submodule pins to policy B". 79 submodules moved and the body named none of them. A one-line body cannot satisfy "every diff item accounted for", so the automation would have kept producing unmergeable PRs — the same defect class marketplace's refresh.yml has, where a count stood in for an accounting. The body now: - names every moved gitlink, captured from `git diff --cached --name-only` after staging so the list is exactly what commits - explains what those entries ARE -- submodule pointers, whose content was gated by each owning repo's own pr-validator before tagging, and which this PR therefore cannot review and does not restate - states the gate (`scripts/verify-pins.sh`, which fails closed on a dangling pin, a dirty submodule, or a policy-B violation) and the producer - carries no `Assisted-by:` footer, with the reason given inline: A1 requires it on an AI-authored body, this one is emitted by a fixed block with no model in the loop, and inventing a model name to satisfy the pattern would be the false claim the rule exists to prevent `git add -A` is deliberately kept before the capture. sync-gitlinks.sh already stages each bumped gitlink, but dropping the add would silently narrow what the sync commits to whatever the script happened to stage. Claude-Session: https://claude.ai/code/session_01Gf42A3bau77JigFYLALrnq --------- Co-authored-by: atrawog <[email protected]>
Summary
The daily gitlink sync has been running green and doing nothing. Its change gate diffs the
wrong thing, so it reports "nothing to sync" precisely when it has work to do.
One line changed:
git diff --quiet→git diff --quiet HEAD.Root cause
Two facts that are individually fine and fatal together:
scripts/sync-gitlinks.sh:33git add "$path"— every bumped gitlink is staged.github/workflows/sync.yml:30if git diff --quiet— compares worktree against indexgit diffwith no revision does not look at the index against HEAD; it looks at the worktreeagainst the index. Since the script stages everything it changes, a successful sync leaves
nothing unstaged, the gate sets
changed=false, and both the "Skip if a sync PR is already open"and PR-creation steps are
if:-gated off.The automation is therefore a no-op exactly when it has work, and exits 0 either way — the
failure shape where a step reports success having done nothing. It is also why every gitlink sync
that has actually landed (
#66,#67,#68) was opened by hand, against a rulebook that says thefix for a stale pin "is a sync (
task sync+ PR), not a hand-pin".How tested
1. The live run that exposed it. Run
33360266234, dispatched 2026-08-31T05:21Z with threerepos demonstrably drifted. The "Bump pins" step computed the correct new pin:
and the run still finished
successwith no PR, leaving the umbrella pinned at1d0164f0while
charly's default-branch HEAD was0443e073— a straight policy-B violation(README line 53: "
charly→ its own default-branch HEAD (main)").2. The git semantics, reduced to a reproduction. In a scratch repo, stage a modification, then:
3. The fixed workflow, executed before merging.
workflow_dispatchcan run a workflow from abranch, so this was not left as a claim — run
33360774123ransync.ymlfrom
fix/sync-gate-diffs-wrong-thing. The gate now fires: the run proceeded past the dirtycheck and the already-open-PR check, all the way into the PR-creation step, which the old gate had
never reached. It then failed there:
That is a second, independent defect this change exposed rather than caused — and reaching it
is itself proof that the gate is fixed, because with
git diff --quietthe job skipped that stepevery time.
4. End to end, after the second blocker was cleared. With
can_approve_pull_request_reviewsenabled, the same workflow was dispatched again from the samebranch — run
33361509708:That is the first sync PR this workflow has ever opened. It carries the real drift, including
charlyandplugin-wl, which had been stale onmain.The second blocker — found here, cleared separately
The sync was disabled twice over: a gate that never fired, hiding a permission that was never
granted. Measured:
The workflow already declares
permissions: pull-requests: write, so the job-level grant is not theproblem — the org/repo toggle "Allow GitHub Actions to create and approve pull requests" is off.
The toggle is not flipped in this diff, on purpose — it bundles create with approve, so
enabling it also lets any workflow approve pull requests, which against a repo that auto-merges on
a PASS verdict is a review-bypass surface. That is a security decision for a human, not a side
effect of a one-line CI fix. It was put to the maintainer explicitly and enabled org-wide by their
decision, as a separate settings change:
(The umbrella repo carried its own override reading
false, which shadows the org value, so it wasset at both levels.) The re-run above is what that unblocked.
Worth stating plainly: even without the settings change this diff would be worth landing, because
it turns a silent no-op into a loud, actionable failure. Before it, the sync reported success
while pins drifted; after it, it says exactly why it cannot proceed.
4. The workflow still parses —
yaml.safe_loadon the changed file.Why
HEADand not--cachedgit diff --cached --quietwould also fix today's bug, but it would break the momentsync-gitlinks.shstopped staging — swapping one silent-disarm for its mirror image. Comparingagainst
HEADsees staged and unstaged alike, so the gate stays correct regardless of what thescript does with the index. The comment added above the gate records both halves so the next reader
does not "simplify" it back.
Rulebook compliance
written off as "nothing had changed"; the diagnosis was confirmed against a live run whose own log
shows it computing a pin it then discarded.
the workaround this defect has been forcing for weeks.
fix/branch offa fresh clone; no force-push, no direct push to
main, no hook bypass.its output pasted above, rather than reasoned about.
on a clean runner.
Change classification
explaining it. No scripts, no pins, no submodules, no Go.
gate now fires (run
33360774123, which reached the PR-creation step it had never reached) andonce end to end after the permission was granted (run
33361509708,success, which opened#75).Attribution tier: fully tested and validated — the changed workflow ran green on a real runner
from this branch and produced the artifact it exists to produce, a
chore: sync gitlinksPR(
#75), which is the first this workflow has ever opened.One consequence to note before merging
#75was produced by dispatching the workflow from this branch, so its sync branch was cut fromthis branch and its diff contains this
sync.ymlchange alongside the gitlink bumps. That makes ita poor changelog for either concern. The clean sequence is: land this focused PR first, then
re-dispatch from
mainso the next sync PR is gitlinks only — and close#75rather than merge it.Noted here so a reviewer does not read the overlap as an accident.
Assisted-by: Claude Code claude-opus-5[1m] (fully tested and validated)