Skip to content

fm-spawn option to start a worker on an existing PR's head branch (stop duplicate follow-up PRs) #5938

Open

Description

@mehulbhagwani

Downstream copy: mehulbhagwani#13

Every task gets its own fm/<task-id> branch, and no-mistakes opens a PR for whatever branch it runs on. A brief saying "update the existing PR" is therefore not enough: follow-up tasks opened duplicate PRs (#5915/#5916, #5919, #5920, fork #8) in one afternoon when the intent was to update #5796, #4991, #4932 and #5709 in place.

Proposed: an explicit fm-spawn.sh option naming an existing PR; the worker's worktree resolves onto that PR's head branch (verified with git rev-parse --abbrev-ref HEAD before the first push) and no-mistakes is told the target PR before the first push. Opt-in only - default spawn behaviour and treehouse core principles unchanged.

Done when: the option exists and is verified as above; without it, behaviour is unchanged; a regression test proves no duplicate PR can be opened when the target is set.

Worker prompt (ready to dispatch)

Captain's intent: "Follow-up work lands on the PR that already exists; never open a duplicate PR again."

Spec: opt-in flag only; verify branch identity before any push and refuse loudly on mismatch. Load firstmate-coding-guidelines before editing. Delivery: no-mistakes to the fork, yolo on. Local proof: scripted end-to-end drill - spawn with the flag against a fixture PR, push a commit, confirm the same PR updated and no new PR exists.

Activity

  1. kunchenguid commented on Sep 27, 2026

    @kunchenguid
    Owner

    Speaking as Kun's firstmate:

    Whole thread read (body; no comments; downstream copy noted). Checked against latest main 3d14792a089fa6009290cd17f812ecfd8874c73f.

    Evidence on main

    • bin/fm-brief.sh / bin/fm-spawn.sh on main: no --existing-pr / EXISTING_PR surface — default spawn still creates a fresh fm/<task-id> branch and no-mistakes can open a new PR (matches the duplicate-PR incident class cited).
    • Open helping PR fix(bin): scaffold existing PR briefs #4129 (bbekdemir): adds --existing-pr <url> (optional asserted --branch, required no-mistakes --base-branch) to ship-brief scaffolding; worktree/checkout on the origin-hosted PR head; same-branch delivery; no-second-PR contract; records canonical PR URL for fm-pr-check.sh; keeps fm-brief.sh, fm-spawn.sh, and fm-dod-lib.sh aligned. That is the opt-in spawn/brief path this issue asks for.

    VISION.md (each rule)

    • One captain, one interface: aligns — duplicate follow-up PRs force captain cleanup and break peace of mind.
    • Authority is explicit: aligns — opt-in flag only; default spawn unchanged; no inferred consent to reuse a PR.
    • Scripts own the mechanics: aligns — branch identity / PR target checks are deterministic script work before push.
    • A restart is a non-event: aligns — durable PR registration must point at the intended PR.
    • Delegation with a spine: aligns — compose existing ship/no-mistakes primitives; refuses mismatch loudly.
    • The fleet outlives any vendor: n/a (forge-URL mechanics already multi-provider elsewhere).
    • Scope: aligns — command-layer spawn/brief delivery; not workshop/CI/merge-policy expansion.

    Contract-class expectation: opt-in — explicit spawn/brief flag; without it behaviour unchanged.

    Labeling existing-pr → #4129. Leave help there; no competing PR. Firstmate flag: no.

  2. mehulbhagwani commented on Sep 27, 2026

    @mehulbhagwani
    ContributorAuthor

    Additional evidence for why the base branch must be explicit (supports the required no-mistakes --base-branch in #4129):

    When a contributor works from a fork, no-mistakes takes origin (the fork) as its base. If the fork's main carries fork-only commits or lags upstream, a follow-up run on an upstream PR's branch rebases onto the fork's main instead of upstream main. We saw two effects:

    Both disappear when the pipeline is told the upstream base and the target PR before the first push, which is the contract #4129 describes. No competing PR from us; noting it here so the base-branch requirement stays in scope.

  3. kunchenguid commented on Sep 28, 2026

    @kunchenguid
    Owner

    Speaking as Kun's firstmate:

    Whole thread re-read (body + prior stamp + author note 2026-09-27T22:35 about fork base-branch). Checked against latest main fa48367394c61a167893a46cbdfd2c81769692d5.

    Evidence on main

    • bin/fm-spawn.sh / bin/fm-brief.sh / bin/fm-dod-lib.sh on main: still no --existing-pr / EXISTING_PR surface. Default spawn still mints a fresh fm/<task-id> branch; duplicate follow-up PRs remain possible. Not fixed.

    Open helping PR #4129 (bbekdemir): still OPEN (mergeable CONFLICTING). Tip still scaffolds --existing-pr <url> with optional asserted --branch and required no-mistakes --base-branch, origin-hosted PR-head checkout, same-branch / no-second-PR contract, and canonical PR URL for fm-pr-check.sh. Author's newer fork-base evidence (upstream PR polluted by fork main, second PR against the fork) is exactly why that PR requires an explicit upstream --base-branch before spawn — still in scope; no competing PR.

    VISION.md (each rule)

    • One captain, one interface: aligns — duplicate follow-up PRs force captain cleanup.
    • Authority is explicit: aligns — opt-in flag only; default spawn unchanged.
    • Scripts own the mechanics: aligns — branch / PR / base identity checks are deterministic before push.
    • A restart is a non-event: aligns — durable PR registration must name the intended PR.
    • Delegation with a spine: aligns — compose ship/no-mistakes primitives; refuse mismatch loudly.
    • The fleet outlives any vendor: n/a (forge-URL mechanics already multi-provider elsewhere).
    • Scope: aligns — command-layer spawn/brief delivery.

    Contract-class: opt-in — explicit spawn/brief flag; without it behaviour unchanged.

    Restamping existing-pr → #4129. Firstmate flag: no.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions