Skip to content

bin/provider-catalog-sync: --open-pr pushes the current branch — from main it bypasses the PR it exists to create #1754

Closed

Description

@dezren39

Finding

bin/provider-catalog-sync.mjs (added in PR #1333, the PR-based successor to bin/sync-models.mjs for issue #1297) documents its --open-pr mode as: commit, push, and open a PR via gh — the tool "only ever adds, only through a reviewable PR". The implementation does not create a branch and does not check which branch is checked out:

const git = (...a) => execFileSync('git', a, { cwd: repoDir, stdio: 'inherit' });
git('add', '.opencode/opencode.jsonc');
git('commit', '-m', `chore(opencode): catalog sync ${date} — add validated provider models (#1297)`);
git('push');
execFileSync('gh', ['pr', 'create', '--title', `chore(opencode): catalog sync ${date} (#1297)`, '--body-file', bodyFile], { cwd: repoDir, stdio: 'inherit' });

(current main, verified 2026-10-28 at main 32ab6b7600: the --open-pr block is unchanged from PR #1333, commit ae35af44c4.)

Why it matters

  • Run from a checkout sitting on main — the natural state of the laptop checkout this tool is written to run on ("run this on the laptop") — git push pushes the catalog commit directly to origin/main, bypassing the reviewable-PR guarantee that is the tool's stated reason to exist. gh pr create then fails (no branch / nothing to compare), but only after the unreviewed change is already on main.
  • Run from a brand-new local branch with no upstream, bare git push fails ("no upstream branch"), leaving a dangling local commit and no PR — the mode only actually works on an already-tracking non-main branch, which nothing in the tool sets up or documents.

Either way the --open-pr path cannot deliver its contract as written.

Evidence

Acceptance criteria

  • --open-pr creates a dedicated branch (e.g. chore/catalog-sync-<date>) before committing, or refuses to run when the current branch is the default branch — it must be impossible for the mode to push to main.
  • The push sets the upstream for the new branch so gh pr create succeeds on a first run.
  • A test or dry-run path pins the branch behaviour (the existing bin/provider-catalog-sync.test.mjs suite is the natural home).
  • Header/usage text updated if the invocation contract changes.

Found by the pr-diff-review job reviewing PR #1333's diff.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/highImportant and time-sensitive
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 28, 2026
  2. developing-today commented on Oct 28, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: pr-diff-review job
    • Session / ID: pr-diff-review cron run 2026-10-28 12:24 CDT
    • Found via: filed this run
    • Task: Triage the catalog-sync --open-pr branch/push finding against current main and pin the branch contract.
    • Expectation: effort/s — done when --open-pr can no longer push to main (dedicated branch or default-branch refusal), push sets upstream, and a test pins it.
    • Links: source PR feat(opencode): provider catalog sync — enumerate, classify, catalog-only PRs (#1297) #1333 (commit ae35af4); body evidence in the issue.
  4. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  5. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (triage)

    • Agent: queue worker (repo-worker-code), Lane D
    • Session / ID: queue task 1973, Lane D shift 2026-10-28 12:14 CDT
    • Found via: queue claim

    Triage verdict — CONFIRMED on current main; branch contract pinned

    Verified fresh against origin/main 5ac81cae: bin/provider-catalog-sync.mjs --open-pr block (lines ~664-682) does git add → git commit → bare git('push') (line 675) → gh pr create. A full-file search finds no branch creation, no current-branch check, and no --set-upstream anywhere. The header (lines 26-28) even documents "push the current branch", while the tool's stated contract (lines 34-37) is that it "only ever ADDS, through a reviewable PR" — the two contradict, and the implementation follows the wrong one. Failure modes as filed: from main the catalog commit lands directly on origin/main before gh pr create fails; from a new unpushed branch the bare push fails for lack of upstream. The existing bin/provider-catalog-sync.test.mjs contains no --open-pr / push / branch coverage at all. No competing PR or duplicate issue (searched this shift; parent #1297 is closed and does not cover this).

    Branch contract — PINNED (dedicated branch, not refusal-only):

    1. In --open-pr mode, before committing, create and switch to a dedicated branch named chore/catalog-sync-<date> (same UTC date string the commit message already uses). If that branch already exists (same-day rerun), check it out and continue — the push then updates the already-open PR for that date.
    2. Defence in depth: after the branch step, if the checked-out branch is still the repository's default branch, abort with a clear error before any commit — --open-pr must be unable to commit on, or push to, the default branch even if branch creation is bypassed or renamed later.
    3. Push with the upstream set explicitly: git push --set-upstream origin chore/catalog-sync-<date>, and pass --head chore/catalog-sync-<date> to gh pr create so the PR target never depends on ambient checkout state.
    4. Test pin in bin/provider-catalog-sync.test.mjs: cover the --open-pr git sequence — branch created/checked out before commit, push carries --set-upstream and the dedicated branch, gh pr create carries --head, and the default-branch abort fires. (The suite's existing seams decide how — stubbed exec or an extracted command-plan — but the assertions above are the contract.)
    5. Header/usage text (lines 26-28) updated to match: --open-pr commits on the dedicated chore/catalog-sync-<date> branch, pushes it with its upstream set, and opens the PR from it. The phrase "push the current branch" goes away.

    Follow-up: small_fix packet enqueued with the issue's acceptance criteria mapped to the pinned contract above. No implementation in this triage task.

  6. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    Follow-up from triage task 1973: the fix is enqueued as queue task 1982 (small_fix, packet queue-packets/repo-health-v1-fix-developing-today-code-issue-1754.json) with the pinned branch contract from the verdict above. — queue worker Lane D

  7. 12 remaining items

  8. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  9. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 28, 2026
  10. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working (prefixed form of the classic bug label)priority/highImportant and time-sensitivesource/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions