Retarget main→staging fails on Gitea: gh api PATCH + gh pr close go via GraphQL/GitHub-shape paths (#196 Phase 1) #74
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
retarget-main-to-staging.ymlenforces SHARED_RULES rule 8 ("staging-first"). When a bot opens a PR againstmain, it retargets the PR base tostagingautomatically. The retarget call usesgh api -X PATCH /repos/.../pulls/{N}and a follow-upgh pr comment / gh pr close.On Gitea,
gh apicalls (whichghCLI translates to REST or GraphQL depending on path) work for some endpoints but the path here may attempt the GitHub-only PATCH semantics. Specifically:gh api -X PATCH "repos/{owner}/{repo}/pulls/{N}" -f base=staging— uses GitHub's RESTPATCH /pulls/{N}. Gitea has the same path and method, but the host URLghdefaults to isapi.github.com. WithGH_HOSTset correctly, Gitea CAN serve this. But empirical check from #65:ghcalls have repeatedly failed against Gitea regardless of GH_HOST due to fallback GraphQL probes.gh pr close/comment— calls GraphQL → 405 on Gitea.Root cause class
Same as #65 / #195:
ghCLI assumes GitHub host conventions and a GraphQL endpoint that Gitea does not provide.Trigger profile: this workflow runs only when a bot opens a PR against
main. Bot-authored PRs against main are infrequent; the workflow has not been exercised since the cutover on 2026-05-06. (Verified:pull_request_targetevents in the last week's actions runs are zero — but the next bot-authored main-PR will trip it.)Affected surfaces
retarget-main-to-staging.yml(this issue). 3ghcall sites:gh api -X PATCH(retarget),gh pr close,gh pr comment.secrets.GITHUB_TOKEN(the per-job ephemeral runner token). On Gitea Actions this token has limited cross-PR write scope. To be safe, switch toAUTO_SYNC_TOKEN(devops-engineer persona) — same identity already used by auto-sync PR #66 and auto-promote (#195 fix). Anti-bot-ring: keeps the persona cohesive.Gitea REST equivalents (verified via
swagger.v1.json)PATCH /api/v1/repos/{owner}/{repo}/pulls/{index}with body{"base": "staging"}— exists. Direct equivalent togh api -X PATCH.POST /api/v1/repos/{owner}/{repo}/issues/{index}/commentswith body{"body": "..."}— exists. (PRs are issues in Gitea; same comment endpoint.)POST /api/v1/repos/{owner}/{repo}/pulls/{index}PATCHingstate=closed— closes a PR.Critical-path? No
This workflow runs on
pull_request_target: opened/reopenedforbranches: [main]. Manual operator dispatch only happens via fresh PRs. Not on the deploy critical path. Med priority — but still must be fixed before a bot-authored main-PR lands and dead-locks.Fix
PR https://git.moleculesai.app/molecule-ai/molecule-core/pulls/: rewrite to use direct
curl-based Gitea REST calls instead ofgh api / gh pr close / gh pr comment. NoghCLI dependency. Header comment block updated.Verification plan
main, observe the workflow:Refs
feedback_per_agent_gitea_identity_default,feedback_fix_root_not_symptom,feedback_gitea_actions_migration_audit_patternFix shipped in PR #79. All 22 CI contexts green; ready for review.
Verification path: this is operator-triggered (
pull_request_targetopened/reopened onbranches: [main]). Once the new workflow is on main, controlled trigger by opening a junk bot-shape PR against main from a fork branch will exercise the new code path. Workflow stays in standby otherwise.