Repository navigation
Description
Summary
The dispatcher's contracts-sync job pushes its re-synced branch to the consumer repo and then dies on gh: Resource not accessible by personal access token (HTTP 403) before it opens the PR. Every producer merge that touches a contractSync source therefore leaves a branch nobody looks at and no pull request, so a human has to notice the drift and re-sync by hand. It happened for both consumers of SahajCloud#1246 and has to be fixed in the token, not the script.
Approach
contracts-sync runs with GH_TOKEN: secrets.SYDEVS_BOT_PAT and set -euo pipefail (.github/workflows/dispatcher.yml:259). After the force-push at dispatcher.yml:349 the step makes two gh calls against the consumer repo, and the 403 is one of them:
attest—gh api -X POST "repos/$REPO/statuses/$(git rev-parse HEAD)"(dispatcher.yml:295-298, called at:350), which needs Commit statuses: write on the consumer.gh pr create --repo "$REPO" … --draft(dispatcher.yml:359), which needs Pull requests: write.
Pin which one first: read the commit status on sydevs/WeMeditateWeb@3626cc1. A sydevs / contract-sync status present means attest succeeded and gh pr create is the refusal; absent means attest is. Then widen SYDEVS_BOT_PAT for WeMeditateWeb, SahajAtlasWeb and SahajAtlasWordpress to cover whichever permission is missing — this is a token change in GitHub settings, not a code change, so the work is to pin the permission and record it.
contracts-sync is not idempotent across this failure in one respect worth checking while here: the fallback path reads open from gh pr list before it regenerates (dispatcher.yml:324), so with the branch pushed and no PR, the next run takes the no-PR path again, force-pushes, and 403s in the same place. The branch never grows stale, but it also never becomes a PR.
Acceptance criteria
-
SYDEVS_BOT_PATcan post a commit status and open a pull request in all threecontractSyncconsumer repos. - A producer merge touching a
contractSyncsource leaves an open draft PR in each affected consumer, not a bare branch. - The missing permission and which repos it was granted on are written down where the next reader of
dispatcher.yml:295finds them.
Verification checklist
-
gh api -X POST repos/sydevs/WeMeditateWeb/statuses/<any sha> -f state=success -f context='sydevs / contract-sync'returns 201 underSYDEVS_BOT_PAT. -
gh pr list --repo sydevs/WeMeditateWeb --head claude/chore-sync-contracts --state openreturns a number underSYDEVS_BOT_PAT. - Re-run the
contracts-syncleg of SahajCloud run 45054537018 (or the next producer merge) and confirm each consumer leg exits 0 with a draft PR open. -
sydevs/WeMeditateWebbranchclaude/chore-sync-contractsis either carrying an open PR or deleted.
Notes
Evidence: SahajCloud run 45054537018, both dispatch / contracts-sync legs (jobs 137306772191 and 137306772355), each 403ing ~1.7 s after the sync command finished. sydevs/WeMeditateWeb branch claude/chore-sync-contracts exists at 3626cc1, authored sydevs-bot 18:21:03Z, with no PR; it was cut from 5d6cbd9, before #328 landed, so it is stale as well as orphaned.
Found while reviewing sydevs/WeMeditateWeb#329, the hand re-sync a human had to open because this job did not. Not a duplicate of #298 (a stale contractSync path) or #282 (dismissing a contract approval).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
Ardnived commentedon Nov 22, 2026
Verified. The token now has Commit statuses write, and #306 opens the PR before posting the status. Re-ran the failed
contracts-synclegs of SahajCloud run 45078199691 (attempt 2): both legs succeeded, opening draft sydevs/WeMeditateWeb#331 and sydevs/SahajAtlasWeb#463, each head carrying asydevs / contract-syncsuccess status from sydevs-bot. SahajAtlasWordpress was not in that run's plan, so its grant is confirmed by the token settings only, not by a run.