Skip to content

fix(devkit-sync): on-demand only, and stop deleting the PR branch - #54

Merged
omar-nahhas merged 1 commit into
mainfrom
fix/devkit-sync-on-demand
Aug 4, 2026
Merged

omar-nahhas merged 1 commit into
mainfrom
fix/devkit-sync-on-demand

Conversation

@omar-nahhas

Copy link
Copy Markdown
Contributor

Two changes. The first is what you asked for; the second is a bug I found while making it, and it's the more serious of the two.

1. Drop the schedule (policy)

Caller template is now workflow_dispatch: only. A submodule pin is a deliberate dependency upgrade, not something that should land while nobody is watching.

The schedule measurably cost more than it delivered:

repo PRs opened merged closed unmerged
chat-comments 11 7 3
diff-visualizer 13 8 4
mermaid-diagrams 16 6 9
share-chat 11 8 2
total 51 29 18

189 devkit-sync runs → 29 merged bumps. And from 2026-07-10 it silently no-op'd for three weeks: every night it opened a PR whose checks sat in action_required awaiting approval, so nothing merged and nothing complained — a no-op is indistinguishable from "nothing to sync".

Deliberate bumps still work exactly as before: make update-devkit, or dispatch this workflow manually.

2. Stop deleting the branch (the actual bug)

The push step opened with:

git push origin --delete "$BRANCH_NAME" 2>/dev/null || true

Deleting a head ref deletes the PR with it — GitHub auto-closes any open PR whose head branch disappears. That is the real cause of those 18 closed-unmerged PRs, and four of the casualties were already fully green: the v2.1.5 sync PRs had passed their e2e and were discarded and re-queued for nothing.

Verified from the event log on chat-comments#21:

head_ref_deleted  by=github-actions[bot]  at=2026-08-04T06:18:40Z
closed            by=github-actions[bot]  at=2026-08-04T06:18:40Z
→ #22 created at 06:18:42Z, identical pin (5212c09)

The delete also made the gh pr edit reuse path immediately below it dead code: it closed the very PR the next line went looking for, so existing was always empty and every run created a brand-new PR instead of updating one. That's why the branch shows a fresh PR number every time.

A force-push is sufficient and non-destructive — an open PR follows its head ref and picks up the new commit.

Correction to something I said earlier

I told you the scheduler "closed all four green PRs and opened identical replacements", and attributed it to scheduling. The scheduling made it frequent, but the destruction came from the branch delete. Fixing only the schedule would have left a manual dispatch just as capable of clobbering an open green PR.

Propagation

devkit-sync never writes .github/workflows/, so the template change does not reach consumers on its own — the four copies need the same edit. Doing that next, separately.

Policy — drop the nightly schedule (caller is workflow_dispatch only). A
submodule pin is a deliberate dependency upgrade, not something that should land
overnight. Measured: 189 runs across the fleet produced 29 merged bumps; 51 PRs
opened, 18 closed without merging. And from 2026-07-10 it silently no-op'd for
three weeks — every night it opened a PR whose checks sat in action_required
awaiting approval, so nothing merged and nothing complained. A no-op looks
exactly like "nothing to sync".

Implementation — remove `git push origin --delete "$BRANCH_NAME"`. This is the
real cause of those 18 closed PRs: deleting a head ref DELETES THE PR WITH IT,
because GitHub auto-closes any open PR whose head branch disappears. Four of the
casualties were already fully green — the v2.1.5 sync PRs, whose e2e had passed,
were closed and re-queued for nothing.

Verified from the event log on chat-comments#21: head_ref_deleted and closed,
both by github-actions[bot] at 06:18:40, with the replacement PR #22 created two
seconds later carrying an identical pin.

The delete also made the `gh pr edit` reuse path dead code — it closed the very
PR the next line searched for, so `existing` was always empty and every run
created a new PR rather than updating one. Force-push alone is enough: an open PR
follows its head ref.
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