Skip to content

feat(bin): prune gone branches during fleet sync - #20

Merged
kunchenguid merged 5 commits into
mainfrom
fm/fleet-prune-gone
Jun 15, 2026
Merged

kunchenguid merged 5 commits into
mainfrom
fm/fleet-prune-gone

Conversation

@kunchenguid

@kunchenguid kunchenguid commented Jun 15, 2026 •

Copy link
Copy Markdown
Owner

Intent

Port the one firstmate-shaped idea from the EveryInc compound-engineering skills the captain reviewed: fold a gone-branch prune into the EXISTING bin/fm-fleet-sync.sh (captain said fold into existing scripts, every new script is overhead - deliberately NOT a new script). Behavior: fm-fleet-sync fetches with --prune, then deletes local branches whose upstream tracking branch is gone (remote branch deleted = its PR merged), but only when safe - never the checked-out branch, never a branch that still has a worktree. SAFETY MODEL (important, do not 'fix' this): pruning relies on the 'gone + no worktree' pair, NOT on a merge-base --is-ancestor check. This is deliberate. This fleet squash-merges exclusively (the firstmate repo only allows squash merges; merge commits and rebase merges are disabled), and under a squash merge a merged branch is NEVER an ancestor of origin/ - so an ancestor gate would prune nothing at all. I reproduced exactly that: with an --is-ancestor gate the squash-merged branch is left behind; without it, it is correctly pruned, while a gone branch that still has a worktree is always kept. The no-worktree guard IS the real safety net: firstmate's teardown removes a branch's worktree only after confirming the work reached the remote, so 'gone + no worktree' already proves the work landed and nothing unlanded is ever discarded. A previous run of this very pipeline added the --is-ancestor gate; I removed it with that reproduction as evidence, so please do not reintroduce it. FM_FLEET_PRUNE=0 disables pruning. Because pruning widens one of firstmate's three sanctioned 'never write to a project' exceptions, AGENTS.md's prime-directive wording plus the README, bootstrap, and teardown descriptions were updated to match - that doc churn is intentional. Validated against constructed clones: squash-merged gone branch pruned, gone+worktree branch kept, non-gone default kept, FM_FLEET_PRUNE=0 respected.

What Changed

  • Updated fm-fleet-sync.sh to fetch with --prune and delete local branches whose upstream is gone when they are not checked out and have no linked worktree.
  • Added FM_FLEET_PRUNE=0 as an escape hatch to disable branch pruning while preserving the existing fleet fetch and safe default-branch fast-forward behavior.
  • Updated bootstrap, teardown, README, and agent instructions to describe the expanded fleet sync behavior and its safety boundaries.

Risk Assessment

✅ Low: The change is limited to one fleet-sync helper plus matching docs, with pruning guarded by fetch success, gone upstream state, current-branch exclusion, and worktree exclusion.

Testing

Inspected the changed shell/docs, then exercised the user-facing bin/fm-fleet-sync.sh CLI against constructed clones that model squash-merged gone branches, linked worktree safety, checked-out branch safety, and the FM_FLEET_PRUNE=0 opt-out; all assertions passed and the worktree stayed clean.

Evidence: Fleet prune end-to-end transcript

Shows squash-gone pruned despite not being an ancestor of origin/main, kept-worktree retained due to a linked worktree, current-gone retained because it is checked out, and optout-gone retained with FM_FLEET_PRUNE=0.

fleet prune end-to-end evidence
workspace: /Users/kunchen/.no-mistakes/worktrees/016d88035d58/01KV4VTKWG2T1GWHNK2P4ST3VR
evidence: /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KV4VTKWG2T1GWHNK2P4ST3VR/fleet-prune-e2e

precheck: squash-gone is not an ancestor of origin/main after squash merge

normal run before branches:
* current-gone  d142165 [origin/current-gone] current gone original commit
+ kept-worktree ede517d (/private/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KV4VTKWG2T1GWHNK2P4ST3VR/fleet-prune-e2e/wt-kept) [origin/kept-worktree] kept worktree original commit
  main          3354c69 [origin/main: behind 1] initial
  squash-gone   c2c112f [origin/squash-gone] feature original commit

normal run output:
/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KV4VTKWG2T1GWHNK2P4ST3VR/fleet-prune-e2e/project-normal: pruned squash-gone
/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KV4VTKWG2T1GWHNK2P4ST3VR/fleet-prune-e2e/project-normal: skipped: on current-gone, expected main

normal run after branches:
* current-gone  d142165 [origin/current-gone: gone] current gone original commit
+ kept-worktree ede517d (/private/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KV4VTKWG2T1GWHNK2P4ST3VR/fleet-prune-e2e/wt-kept) [origin/kept-worktree: gone] kept worktree original commit
  main          3354c69 [origin/main: behind 1] initial
assertion: squash-gone pruned even though it was not an ancestor of origin/main
assertion: kept-worktree retained because a linked worktree still uses it
assertion: current-gone retained because it is the checked-out branch
assertion: main retained

opt-out run before branches:
* main        279e188 [origin/main] squash merge feature
  optout-gone c4a7820 [origin/optout-gone] optout gone original commit

opt-out run output:
/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KV4VTKWG2T1GWHNK2P4ST3VR/fleet-prune-e2e/project-optout: already current

opt-out run after branches:
* main        279e188 [origin/main] squash merge feature
  optout-gone c4a7820 [origin/optout-gone: gone] optout gone original commit
assertion: optout-gone retained when FM_FLEET_PRUNE=0

RESULT: all fleet prune end-to-end assertions passed
/var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KV4VTKWG2T1GWHNK2P4ST3VR/fleet-prune-e2e/transcript.log

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • git status --short && git diff --stat a16660de607e52829a075baa81095049d4bbf02a..HEAD
  • Inspected bin/fm-fleet-sync.sh, bin/fm-bootstrap.sh, bin/fm-teardown.sh, AGENTS.md, and README.md for the changed behavior and docs.
  • Created local bare remotes and clones under /var/folders/5x/4nqprlbx0518k3ybcb1sz6gr0000gn/T/no-mistakes-evidence/01KV4VTKWG2T1GWHNK2P4ST3VR/fleet-prune-e2e, then ran bin/fm-fleet-sync.sh <constructed-project> to verify a squash-merged gone branch is pruned without an ancestor check, a gone branch with a linked worktree is retained, a checked-out gone branch is retained, and main remains present.
  • Ran FM_FLEET_PRUNE=0 bin/fm-fleet-sync.sh <constructed-project> to verify pruning is disabled while fetch still marks the upstream as gone.
  • git status --short
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ .github/workflows/ci.yml:18 - Configured shell lint command shellcheck bin/*.sh could not be run because shellcheck is not installed in this environment.
✅ **Push** - passed

✅ No issues found.

fm-fleet-sync now fetches with --prune and deletes local branches whose
upstream tracking branch is gone and that have no worktree, so merged
feature branches stop piling up in the pooled clones. It never touches the
checked-out branch or a branch with a live worktree, so it cannot discard
unlanded work; FM_FLEET_PRUNE=0 disables it. Widens the fleet-sync hard-rule
exception and updates the docs to match.
The merge-base --is-ancestor gate makes pruning a permanent no-op in this
fleet: PRs are squash-merged (the firstmate repo only allows squash), so a
merged branch is never an ancestor of origin/<default> and nothing is ever
pruned. Reproduced with a squash-merge clone. Pruning now relies on the
gone + no-worktree pair, which already proves the work landed - teardown
removes a branch's worktree only after the work reached the remote - so it
stays safe without the ancestor check. Docs updated to match.
@kunchenguid
kunchenguid merged commit dc9b798 into main Jun 15, 2026
3 checks passed
@kunchenguid
kunchenguid deleted the fm/fleet-prune-gone branch June 15, 2026 05:32
@modfreq

modfreq commented Jun 28, 2026

Copy link
Copy Markdown

Audited against code: all four slices implemented and tested (layered hued equipment render, gender-gated beards, partial-hue cloth-dye shader, splash pickers + live preview reusing the real sprite stack). Registry counts meet/exceed the PRD; full suite green (490 tests). Remaining work is the cross-cutting UO-client art bake the PRD itself flagged, not a missing slice. Closing as delivered.

vipentti pushed a commit to vipentti/firstmate that referenced this pull request Aug 5, 2026
* feat(bin): prune gone branches during fleet sync

fm-fleet-sync now fetches with --prune and deletes local branches whose
upstream tracking branch is gone and that have no worktree, so merged
feature branches stop piling up in the pooled clones. It never touches the
checked-out branch or a branch with a live worktree, so it cannot discard
unlanded work; FM_FLEET_PRUNE=0 disables it. Widens the fleet-sync hard-rule
exception and updates the docs to match.

* no-mistakes(review): Safely prune only merged gone branches

* no-mistakes(document): Document fleet pruning behavior

* fix(bin): prune squash-merged gone branches, drop ancestor gate

The merge-base --is-ancestor gate makes pruning a permanent no-op in this
fleet: PRs are squash-merged (the firstmate repo only allows squash), so a
merged branch is never an ancestor of origin/<default> and nothing is ever
pruned. Reproduced with a squash-merge clone. Pruning now relies on the
gone + no-worktree pair, which already proves the work landed - teardown
removes a branch's worktree only after the work reached the remote - so it
stays safe without the ancestor check. Docs updated to match.

* no-mistakes(document): Sync fleet-prune documentation
This was referenced Aug 7, 2026
fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
…unchenguid#20)

* fix(cursor): show the live worker model, not the spawn-time meta id

Diagnosed against Cursor CLI 2026.07.17: unknown --model ids fail loudly
(no silent fallback), but presentation still lied when the pane ran a
different model than meta recorded. Refuse unknown catalog ids at spawn,
record the folded launch id, and let herdr presentation prefer the idle
pane footer (with model_live= when it disagrees).

Co-authored-by: Cursor <cursoragent@cursor.com>

* no-mistakes(review): parse last separator-bearing footer line for live cursor model

* no-mistakes(review): memoize cursor model catalog and make meta rewrite atomic

* no-mistakes(review): cache cursor catalog in temp file across subshells

* no-mistakes(review): scope catalog cache to trap-cleaned private mktemp dir

* no-mistakes(review): gate catalog cache reuse and cleanup on creator PID

* no-mistakes(review): document exact-membership rationale for cursor catalog preflight

* fix(lint): avoid SC2064 in cursor catalog EXIT trap chain

Store the prior EXIT handler in a durable variable and invoke a named
chain function so ShellCheck no longer flags intentional early expansion.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
@kenny-nguyen

Copy link
Copy Markdown

Before / after screenshots and Proposed items

Screenshots (phone 390 and laptop 1440, light and dark; the site has no dark theme, so dark matches light). Image upload to this PR is not permitted for the worker account, so the files sit on the operator machine: /Users/developedbykenny/github/firstmate/data/dbk-site-growth-story/shots/{before,after}-{phone,laptop}-{light,dark}.png. Before shots are the live site (identical to main at ad67b59); after shots are this branch with the Astro dev toolbar disabled. Compressed copies are in .../data/dbk-site-growth-story/pr/.

Landscape band: in the laptop full-page captures the grey hero landscape band runs behind the first lines of the through-line section. That is in the before shot too. The band is a fixed-position background layer that a full-page capture paints at the top viewport height, so it predates this change and no CSS was touched.

Snapshot: branch and tag snapshot/2026-11-13-growth-story at ad67b59 (live main before this change) for revert.

Proposed - awaiting Kenny

  1. Bamboo Talent was removed from the page (Vietnam-based talent venture, conflicts with the Mississauga story). Restorable from the snapshot.
  2. Contact email changed from connect@ to hire@developedbykenny.com on the page (confirmed by Kenny). Confirm the hire@ mailbox is live before merge, since the old connect@ link no longer appears.
  3. The Scaling Engine entry says "designed and led the build, alongside a developer" per Kenny's 2026-11-13 answer.
  4. Cambium Works and uncappedOS are kept as projects with links; wording avoids any growth claim the evidence bank does not support.
  5. University-era web work is not added yet; the selected-work list is easy to extend once Kenny gives dates.
  6. README.md is stale Astro boilerplate (predates this change); left alone as a follow-up.

As given vs built: the brief's "pivot the story to growth" became a new hero, story, projects and selected-work list (built); the dark-mode screenshots became light-only equivalents because no dark theme exists (decided).

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 18, 2026
…digest-trim (kunchenguid#20)

* feat(bin): opt-in shorter session-start digest for homes with many held items

A home that creates config/startup-digest-trim gets a shorter session-start
digest. The held backlog group prints counts by hold kind plus only the rows
that gate in-flight work, whose hold date has come, or that are new or changed
since the previous digest, with released holds named and a pointer to the full
held list. Drift and upstream lines the bootstrap section already printed are
not repeated under network checks. Without the flag the digest is unchanged.

* no-mistakes(review): Re-emit compares held snapshot baseline without rewriting it

* no-mistakes(document): List digest trim flag and held snapshot in home layout
ghazni101 pushed a commit to ghazni101/firstmate-dsh that referenced this pull request Nov 19, 2026
…DSH restart' (kunchenguid#20) from fm/fix-coordinator-restart-adoption 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.

3 participants