Skip to content

ci(auto-sync): App-token dispatch + ubuntu-latest + workflow_dispatch - #2497

Merged
HongmingWang-Rabbit merged 1 commit into
stagingfrom
ci/fix-auto-sync-no-recursion
May 2, 2026
Merged

HongmingWang-Rabbit merged 1 commit into
stagingfrom
ci/fix-auto-sync-no-recursion

Conversation

@HongmingWang-Rabbit

Copy link
Copy Markdown
Contributor

Summary

Fixes three compounding bugs that have silently broken auto-sync-main-to-staging.yml since 2026-04-30 — the workflow has only run 3 times ever (last 2026-04-29) despite multiple staging→main promotes since. Currently wedging Phase 2 promote PR #2442 on mergeStateStatus: BEHIND.

Diagnosis (confirmed empirically)

What this PR changes

  1. auto-promote-staging.yml polling tail: after the publish dispatch, also gh workflow run auto-sync-main-to-staging.yml --ref main via App token. Mirror of the existing publish dispatch — same App-token, same failure-path comment.
  2. auto-sync-main-to-staging.yml:
    • Adds workflow_dispatch trigger (load-bearing for chore: rebrand icons + LICENSE cleanup + HANDOFF.md #1).
    • runs-on: ubuntu-latest (was [self-hosted, macos, arm64] — copy-paste artefact from molecule-controlplane; molecule-core has no Mac runner registered, so the job would sit unassigned even when the trigger fired).
    • on: push: [main] retained as defense-in-depth for manual-UI merges by humans (which use their PAT and DO fire downstream workflows).

Recovery for the current wedge

After this lands on staging + auto-promotes to main: gh workflow run auto-sync-main-to-staging.yml --ref main to backfill the 76c604fb gap. PR #2442 goes from BEHIND → CLEAN and self-merges.

Long-term

Switch auto-promote's gh pr merge --auto call to use the App token (instead of GITHUB_TOKEN). That makes on: push triggers fire naturally and obviates the explicit dispatches. Out of scope here — tracked in #2357.

Test plan

  • YAML lint passes on both files
  • Self-merges via secondary approval + merge queue
  • After landing, gh workflow run auto-sync-main-to-staging.yml --ref main succeeds and opens a sync PR
  • Sync PR auto-merges into staging
  • PR staging → main: auto-promote 5b70204 #2442 (Phase 2 promote) goes from BEHIND → CLEAN and merges

🤖 Generated with Claude Code

auto-sync-main-to-staging.yml hasn't fired since 2026-04-29 despite
multiple staging→main promotes since. The promote PR #2442 (Phase 2)
has been wedged on `mergeStateStatus: BEHIND` for hours because
staging is missing the merge commit from PR #2437.

Three compounding bugs, all fixed here:

1. **GitHub no-recursion suppresses the `on: push` trigger.**
   When the merge queue lands a staging→main promote, the resulting
   push to main is "by GITHUB_TOKEN", and per
   https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
   that push event does NOT fire any downstream workflows. Verified
   empirically against SHA 76c604f (PR #2437): exactly ONE workflow
   fired on that push — `publish-workspace-server-image`, dispatched
   explicitly by auto-promote-staging.yml's polling tail with an App
   token (the documented #2357 workaround). Every other `on: push`
   workflow on main, including auto-sync, was silently suppressed.

   Same fix extended here: auto-promote-staging.yml's polling tail
   now ALSO dispatches `auto-sync-main-to-staging.yml --ref main`
   via the App token after the merge lands. App-initiated dispatch
   propagates `workflow_run` cascades, which is what the publish
   tail relies on too. Failure path: emits `::error::` with the
   recovery command — operator runs it once and the next promote
   self-heals.

   auto-sync.yml gains `workflow_dispatch:` so it can be invoked
   from the dispatch above + manually if a future promote also
   misses (defense in depth).

2. **`runs-on: [self-hosted, macos, arm64]` was wrong for this repo.**
   Comment claimed "matches the rest of this repo's workflows" — false:
   this is the ONLY workflow in molecule-core/.github/workflows/ with
   a non-ubuntu runs-on. Copy-paste artefact from molecule-controlplane
   (which IS private and has a Mac runner). molecule-core has no Mac
   runner registered, so even when the trigger DID fire (the 3 historic
   manual-UI merges), the job would have sat unassigned if the runner
   were offline. Switched to `ubuntu-latest` to match every other
   workflow in this repo.

3. **The `on: push` trigger remains** as a defense-in-depth path for
   the rare case of a manual UI merge by a real user (which uses
   their PAT and DOES fire downstream workflows — confirmed via the
   2026-04-29 d35a242 run with `triggering_actor=HongmingWang-Rabbit`
   that fired 16 workflows including auto-sync). Belt-and-suspenders.

Long-term: switching auto-promote's `gh pr merge --auto` call to use
the App token (instead of GITHUB_TOKEN) would let `on: push` triggers
fire naturally and obviate the need for the explicit dispatches in
the polling tail. Tracked in #2357 — out of scope here.

Operator recovery for the current Phase 2 wedge: after this lands on
staging, dispatch auto-sync once via
`gh workflow run auto-sync-main-to-staging.yml --ref main` to
backfill the missed sync from 76c604f. PR #2442 will go from
BEHIND → CLEAN and auto-merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@HongmingWang-Rabbit
HongmingWang-Rabbit added this pull request to the merge queue May 2, 2026
Merged via the queue into staging with commit bae3403 May 2, 2026
21 checks passed
@HongmingWang-Rabbit
HongmingWang-Rabbit deleted the ci/fix-auto-sync-no-recursion branch May 2, 2026 05:35
HongmingWang-Rabbit pushed a commit that referenced this pull request Jun 12, 2026
…ierge topbar' (#2497) from feat/canvas-org-switcher into main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant