Skip to content

ci: retry the upstream tracker pull request instead of skipping on an existing branch - #3451

Open
Birfy wants to merge 1 commit into
mainfrom
dev/3448-upstream-track-stall
Open

Birfy wants to merge 1 commit into
mainfrom
dev/3448-upstream-track-stall

Conversation

@Birfy

@Birfy Birfy commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

ci: retry the upstream tracker pull request instead of skipping on an existing branch

Head f37841fcf782541057cab7db11e2cdcf3b5949c4 (tree bc8963bc1ccffb7b58c2f163757868e44d0c3ab0,
parent 2facf12ebf5a2151e17dcc497a5b3da5a674580f). The first push of this branch carried the same
tree under a locally synthesized parent commit with no shared history, so the pull request was refused
("no history in common with main"); the commit was re-parented onto 2facf12e with the tree,
the message and the author unchanged. One file, +43/−9:
.github/workflows/ds-bot-upstream-track.yml (7c83447e → 7686618b).

Why

Find the target release treated an existing upstream/ds-bot-<ref> branch as "already done", and
Push and open the pull request ran only when it was not. When gh pr create failed
(run 45976212422 on 11-27, 46128184106 on 11-28), the branch stayed behind and every later run
took the "branch already exists" path: sync, suite, smoke and the pull request step were all
skipped, and the run reported success (run 46244596502 on 11-29). Main stayed pinned to
v0.3.10 and no pull request was ever opened from upstream/ds-bot-v0.4.0 (8eb905ad) or
upstream/ds-bot-v0.4.2 (c422d5be). Details and the run table are in #3448.

What changed

  1. Done means an open pull request, not a branch: the step runs
    gh pr list --head "$branch" --state open --limit 1 --json number --jq '.[].number' and only
    sets skip=true when that prints a number. The skip message and the step summary name the
    pull request; a skip for "already pinned" and a skip for "pull request already open" no longer
    look the same.
  2. A branch without an open pull request is reused, not skipped. A new Check out the sync branch step fetches refs/heads/<branch> and does git switch -c <branch> --track origin/<branch> when the branch exists, otherwise creates it from main. Sync (sync, check,
    UPSTREAM.md rewrite, commit) is now gated on branch_exists == 'false'; the suite, the smoke
    and the pull request step still run, so one failed gh pr create can never stall the tracker
    again.
  3. A run that cannot open the pull request stays red and names the cause: branch, upstream ref,
    the tag main is still pinned to, and both remedies (repository setting or DS_BOT_TRACK_TOKEN).
    The next run then reuses the branch and retries this step instead of skipping.

Steps and conditions after the change:

step condition
Find the target release always
Check out the sync branch (new) skip == 'false'
Sync skip == 'false' && branch_exists == 'false'
Upstream suite skip == 'false'
Container startup smoke skip == 'false'
Push and open the pull request skip == 'false'
Fail the run when either check did not pass always() && skip == 'false'

No change to the pin, to runtime/ds-bot-upstream, to any container file, or to job permissions
(contents: write, pull-requests: write; gh pr list needs no permission this job lacks).

Verification (local, not CI)

  • The workflow parses (PyYAML 6.0) and has 9 steps in the order above; job permissions and env are
    unchanged.

  • Decision matrix, old script vs new, real node, stub gh/git (only the network-bound
    latest query is stubbed):

    case old new
    ref already pinned skip=true skip=true, summary main is already pinned to v0.3.10
    fresh sync skip=false skip=false, branch_exists=false
    branch exists, no PR skip=true (the stall) skip=false, branch_exists=true
    branch exists, PR #3500 open skip=true skip=true, open_pr=3500
    PR #3499 open, branch deleted skip=true skip=true, open_pr=3499
  • Check out the sync branch against a real bare remote: with branch_exists=true it lands on
    the remote branch tip (cff3434, the marker file committed on that branch present,
    @{u}=origin/upstream/ds-bot-v0.4.2), and the later git push origin <branch> prints
    Everything up-to-date, exit 0. With branch_exists=false it creates the branch from main
    (bf8ee48, no marker file, no upstream), which is the state Sync expects.

  • node scripts/ds-bot-upstream.mjs check → ok (Fei2411/DS-Bot@d104d9ca18d6, ds-bot 0.3.10, v0.3.10; 12 paths), exit 0.

  • tests/ci_test_list.test.mjs (the suite that reads .github/workflows): 2/2 pass, exit 0.

  • runtime/flybot-workspace-web: node --test --test-concurrency=2 test/*.test.js
    (node v22.23.5) → 497 tests / 497 pass / 0 fail / 0 cancelled / 0 skipped, exit 0.

Not verified here

  • No workflow_dispatch run: this branch has no push access from the authoring host, so the
    acceptance dispatch (ref: v0.4.2) is the reviewer's step. Expected outcome on the current
    repository configuration (default_workflow_permissions: read, can_approve_pull_request_reviews: false, DS_BOT_TRACK_TOKEN unset): sync, suite, smoke run and the run ends red at the pull
    request step with the new message — that is the accepted alternative in Upstream tracker stalls silently once its sync branch exists without a pull request #3448, not a green run.
  • actionlint is not installed on the authoring host, so no lint pass beyond the YAML parse.
  • docker is unavailable locally, so the container smoke step was not exercised.
  • jq is unavailable locally, so the --jq '.[].number' filter was not executed; it relies on the
    base jq behaviour that .[] over an empty array produces no output (an empty open_pr).

Out of scope

Upgrading the pin to v0.4.2 (vendored upstream plus container, its own risk:T3 review), and the
repository setting / DS_BOT_TRACK_TOKEN secret, which are owner decisions recorded in #3448.

Related #3448

… existing branch

`Find the target release` treated an existing `upstream/ds-bot-<ref>` branch as
"already done", so after `gh pr create` failed once (runs 45976212422 on 11-27
and 46128184106 on 11-28) every later run skipped sync, suite, smoke and the
pull request step and reported success (run 46244596502 on 11-29) while main
stayed pinned to v0.3.10 and no pull request was ever opened.

- Done now means an open pull request for the head branch, not the branch
  existing; the skip message and the step summary name the pull request number.
- A branch that exists without an open pull request is reused instead of
  skipped: a new `Check out the sync branch` step fetches and tracks it, `Sync`
  is gated on the branch being absent, and the suite, the smoke and the pull
  request step still run, so one failed `gh pr create` cannot stall the tracker.
- A run that cannot open the pull request stays red and names the branch, the
  upstream ref and the tag main is pinned to.

No change to the pin, to the vendored tree, or to any container file.

Related #3448
@github-actions github-actions Bot added the risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff label Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants