Auto-sync main → staging fails every push: gh CLI calls /api/graphql (Gitea returns 405) #65
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 1 — Investigation findings
Symptom
Required check
Auto-sync main → staging / sync-staging (push)has been failing on every push tomainsince the GitHub→Gitea migration on 2026-05-06. Last verified failing run:actions/runs/1117/jobs/0(target SHA1e1f4d63).Root cause
The pre-suspension
auto-sync-main-to-staging.ymlwas written for GitHub.com and assumed:merge_queueruleset onstagingblocking direct push (GitHub-only feature).gh pr createandgh pr merge --autoworking against the SCM API (GitHub GraphQL).secrets.GITHUB_TOKENrepresenting an integration that can land PRs through the queue.On Gitea Actions /
act_runner:merge_queueconcept; staging branch protection on this repo isenable_push: truewithpush_whitelist_usernames: [devops-engineer]. Direct push from the persona is allowed.gh pr createcall againsthttps://git.moleculesai.app/api/graphqlreturnsHTTP 405 Method Not Allowed.secrets.GITHUB_TOKENis a per-job runner-issued Gitea-scoped token, not a github.com identity.Concrete failure trace
From
runs/1117/jobs/0(logs at/api/v1/repos/molecule-ai/molecule-core/runs/1117/jobs/0/logs):Checkout staging✓ (line 11–95: clones, sets http extraheader, checks out staging)Configure git author✓Check if staging already contains main✓ →needs_sync=trueCreate auto-sync branch + merge main✓ (auto-sync/main-1e1f4d63, merge commit on top of staging)Push auto-sync branch✓ (line 277:* [new branch] auto-sync/main-1e1f4d63 -> auto-sync/main-1e1f4d63)Open auto-sync PR + enable auto-merge✗ — line 343:HTTP 405: 405 Method Not Allowed (https://git.moleculesai.app/api/graphql).gh pr createcalls Gitea GraphQL → 405 → exit 1.Result on every push to main: an orphan
auto-sync/main-<sha>branch is created and the workflow fails red. No PR is ever opened, so nothing lands on staging via this path.Why an existing fix-branch (
fix/auto-sync-use-devops-token) is insufficientThe earlier sister-agent attempt swapped
secrets.GITHUB_TOKEN→secrets.AUTO_SYNC_TOKENin two places. Verified by diff againstorigin/main: those are the only changes. This does not address the root cause — thegh pr createcommand still hits/api/graphqlregardless of the token, and Gitea still returns 405. Token-scope is not the bug.Affected surfaces (audit per
feedback_gitea_actions_migration_audit_pattern)auto-sync-main-to-staging.yml(this issue). Alsoauto-promote-staging.yml,retarget-main-to-staging.yml, and others usegh pr create/gh apiagainst Gitea — out of scope for this issue, follow-ups parked below.AUTO_SYNC_TOKENrepo secret already exists (created 2026-05-07 14:00). Issued todevops-engineerpersona. Whitelisted on staging branch protection. No rotation needed.GITHUB_SERVER_URLenv (perfeedback_act_runner_github_server_url) is relevant for setup-go etc., NOT for this workflow. Out of scope here.auto-promote-staging.ymlcomment block; updated as part of follow-up (NOT this PR).Cleanup
Orphaned branch
auto-sync/main-1e1f4d63(created by the failed run) still exists on origin. Will be deleted once the new workflow lands a successful sync (the new workflow does not create per-SHA branches).Parked follow-ups
auto-promote-staging.ymlcallsgh pr create/gh workflow runagainst Gitea. Same class of failure. Separate issue.retarget-main-to-staging.ymlusesgh api -X PATCH /pulls. Will fail when triggered. Separate issue.ghCLI calls; comprehensive audit perfeedback_gitea_actions_migration_audit_pattern. Separate epic.Fix
PR https://git.moleculesai.app/molecule-ai/molecule-core/pulls/: rewrite to use direct push from
devops-engineerpersona viaAUTO_SYNC_TOKEN. NoghCLI dependency, no PR-through-queue dance. Header comment block fully documents the new architecture, identity model, and 4 failure modes (A–D) with operator runbooks.Verification plan: this fix-PR's merge to main is itself the trigger; expect ≥2 consecutive green runs.
Ghost referenced this issue2026-05-07 22:10:26 +00:00