fix(ci): rewrite auto-sync main→staging for Gitea direct push (closes #65) #66
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/auto-sync-direct-push-gitea"
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?
Summary
Root-cause fix for the persistent
Auto-sync main → staging / sync-staging (push)red on every push to main since the GitHub→Gitea migration.Root cause (full Phase 1 findings: #65): the pre-suspension workflow used
gh pr create+gh pr merge --autoto land sync via GitHub's merge queue. On Gitea this fails at thegh pr createstep withHTTP 405 Method Not Allowed (https://git.moleculesai.app/api/graphql)— Gitea exposes no GraphQL endpoint.Fix: drop the merge-queue PR architecture entirely. Gitea staging branch protection (
push_whitelist_usernames: [devops-engineer]) already permits direct push from the devops-engineer persona, andAUTO_SYNC_TOKENalready exists as a repo secret. New workflow:secrets.AUTO_SYNC_TOKEN.git fetch origin main+ ff-merge or no-ff merge.git push origin stagingdirectly.No
ghCLI. No GraphQL. No PR-through-queue. Three steps instead of six. ~165 LOC of stale GitHub-era PR plumbing removed.Why this is the proper fix (not a workaround)
fix/auto-sync-use-devops-tokenbranch only renamed the secret. That was insufficient becausegh pr createstill calls Gitea GraphQL → 405 regardless of the token.feedback_fix_root_not_symptom: this PR fixes the root cause (mechanism mismatch with Gitea), not the symptom (red CI).feedback_long_term_robust_automated: simpler, fewer moving parts, fewer external API dependencies.Identity & security (anti-bot-ring)
Per
feedback_per_agent_gitea_identity_default: this workflow uses thedevops-engineerpersona token, NOT the founder PAT. Commits authored bydevops-engineer@agents.moleculesai.app. Push target restricted to staging only (the workflow has no code path that touches main). Compromise blast radius: bounded to staging branch + this repo's read surface.Backwards compat
name:and jobname:unchanged → required-check nameAuto-sync main → staging / sync-staging (push)is identical → no branch-protection edits needed.auto-promote-staging.yml's contract (staging is a superset of main before promote) is preserved — only the mechanism of advancing staging changes.on: push: branches: [main]+workflow_dispatchtriggers unchanged.Rejected alternatives (in workflow header)
GH_HOST=git.moleculesai.appto makeghtalk to Gitea —gh pr createstill calls GraphQL → still 405. Empirically verified.git push.Parked follow-ups (separate PRs/issues)
auto-promote-staging.ymluses the same brokengh pr createpattern. Also red on Gitea.retarget-main-to-staging.ymlusesgh api -X PATCH. Same class.ghCLI calls. Comprehensive audit pending.auto-sync/main-1e1f4d63branch (created by the last failed run). Will be deleted manually after this PR lands and the new workflow lands a successful sync without creating per-SHA branches.Test plan
python3 -c "import yaml; yaml.safe_load(open(...))"✓).runner-base:full-latest-cloudflared-goproxy-pipe), pinnedactions/checkout@de0fac2e(already used elsewhere in repo).origin/maininto staging locally,git push --dry-run origin stagingsucceeded withe3904eb..4d1708d staging -> staging.Hostile self-review (3 weakest spots)
AUTO_SYNC_TOKENrotation: if devops-engineer token rotates, this workflow silently fails on push (HTTP 401/403). Mitigation: workflow surfaces the failure mode in step summary (failure mode B in header). Long-term: persona-token rotation script should bump repo secret.concurrency.group: auto-sync-main-to-staging+cancel-in-progress: falsequeues runs. If two main pushes land in quick succession, the second waits on the first; the second's fetch sees the latest main tip. But: if the first fails (e.g. conflict), the second still runs and may also fail. Acceptable — better to surface every conflict than silently coalesce.Refs
feedback_per_agent_gitea_identity_default,feedback_fix_root_not_symptom,feedback_gitea_actions_migration_audit_pattern,feedback_long_term_robust_automatedApproved.
Reviewed for security (auth model, token scope, push target, blast radius, anti-bot-ring) and the fix is correct:
No security concerns. Phase 4 verification (≥2 consecutive green runs after merge) is the natural next step.
Ghost referenced this pull request2026-05-07 22:10:26 +00:00