Auto-promote staging→main fails on Gitea: gh CLI calls /api/graphql + workflow_dispatch endpoint missing (#195 Phase 1) #73
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
auto-promote-staging.ymlis the staging→main promote workflow. It currently usesgh pr create,gh pr merge --auto,gh pr view,gh run list, andgh workflow runagainst Gitea. Every one of those calls hits a Gitea endpoint that does not exist or returns 405:gh pr create→POST /api/graphql→ 405 (same root cause as #65)gh pr merge --auto→ GraphQL → 405gh pr list/view --json→ GraphQL → 405gh run list --workflow=...→ GraphQL → 405gh workflow run …→ RESTPOST /actions/workflows/{id}/dispatchesdoes NOT exist on Gitea 1.22.6 (verified viahttps://git.moleculesai.app/swagger.v1.json)This workflow has not run successfully a single time since the GitHub→Gitea cutover on 2026-05-06. Next time staging passes its gates, the promote will fail red.
Root cause class
Same as #65: the workflow assumes:
workflow_dispatchREST endpoint exists (it doesn't on Gitea 1.22.6)Critical constraint discovered:
maincannot be direct-pushedPR #66 fixed the auto-sync (main→staging) by direct-pushing as
devops-engineer(whitelisted on staging viapush_whitelist_usernames). The reverse direction (staging→main) cannot use that pattern because main's branch protection hasenable_push: falsewith NO whitelist:(Verified via
GET /api/v1/repos/molecule-ai/molecule-core/branch_protections.)Direct push to main is impossible for any persona. The promote MUST go via a PR.
Affected surfaces (audit per
feedback_gitea_actions_migration_audit_pattern)auto-promote-staging.yml(this issue). 5 distinctghcall sites.AUTO_SYNC_TOKEN(devops-engineer persona) already exists and haspush: truerepo scope. Same persona can create PRs againstmainand merge them via Gitea REST. No new secret needed.mainruleset stays untouched. PR-mediated merges respect approvals + status checks naturally. No edits.Downstream cascade analysis
The original workflow had a tail step that explicitly dispatched
publish-workspace-server-image.ymlafter promote merge, because GitHub's GITHUB_TOKEN-initiated merges suppress downstreamon: pushevents.This is a GitHub-specific safety rule (no recursion). Gitea Actions does not have this rule (verified empirically: PR #66's merge to main fired
auto-sync-main-to-stagingnaturally on the next push trigger).publish-workspace-server-image.ymltriggers onon: push: branches: [main]. Once the promote PR merges, the resulting commit on main fires the cascade naturally. The explicit dispatch step is now dead code on Gitea — and even if we wanted to keep it, Gitea has noworkflow_dispatchREST endpoint to call.Why approval requirement on main is load-bearing
feedback_prod_apply_needs_hongming_chat_go(saved 2026-05-07): "prod state mutations route through Hongming chat". Staging→main IS a prod state mutation (the next deploy fans out to tenants). Auto-merging without human review would fight the project rule.Gitea's
merge_when_checks_succeed: true+required_approvals: 1work well together: the workflow opens the PR, schedules auto-merge, but Gitea waits for approval AND status checks before landing. Hongming reviews via the canvas/chat-handle of the PR notification → approves → Gitea auto-merges. Zero branch-protection changes needed.Parked follow-ups
gh workflow runfrom a CLI with GitHub-shape — wait, no, that endpoint doesn't exist on Gitea either. Operator alternative: empty commit to main triggers the publish. File a separate small issue if observed.Fix
PR https://git.moleculesai.app/molecule-ai/molecule-core/pulls/: rewrite to use Gitea REST API (no
ghCLI). New shape:gh run list)staging → mainviaPOST /api/v1/repos/.../pullsPOST /api/v1/repos/.../pulls/{index}/mergewithmerge_when_checks_succeed: trueon: pushcascade.The post-merge polling + workflow_dispatch chain is removed entirely (dead on Gitea, replaced by natural
on: pushcascade).Verification plan
publish-workspace-server-image.ymlfires naturallyRefs
feedback_per_agent_gitea_identity_default,feedback_fix_root_not_symptom,feedback_gitea_actions_migration_audit_pattern,feedback_prod_apply_needs_hongming_chat_go,feedback_long_term_robust_automatedFix shipped in PR #78. All 22 CI contexts green; ready for review.
Verification path (Phase 4): merge PR #78 → workflow becomes live on main → operator triggers
workflow_dispatchwithforce=truefor the first real promote test. Will need ≥2 consecutive green runs of the new mechanism to consider this fully verified.Phase 4 verification cannot be performed by the bot (would require self-merge to main, exactly the bot-ring fingerprint we are avoiding per
feedback_github_botring_fingerprint).