Skip to content

feat(bin): merge upstream firstmate main bf05a4fc into the fork - #377

Merged
trillium merged 12 commits into
mainfrom
fm/upstream-merge-20261107
Nov 7, 2026
Merged

trillium merged 12 commits into
mainfrom
fm/upstream-merge-20261107

Conversation

@trillium

@trillium trillium commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Intent

Resolve the nightly firstmate upstream reconcile conflict under the captain's runbook (runbooks-0et, 2026-11-04): firstmate owns the conflict-resolution PR (yolo, merged on green, never parked on the captain), and every conflict outcome gets a creature review.

Context: the mini0 nightly job tried at 2026-11-07T11:45Z to merge upstream kunchenguid/firstmate main bf05a4f (9 commits) into the fork trillium/firstmate main 50dbd42 and hit conflicts in: bin/fm-pr-merge.sh docs/pi-supervision-branch.md. Nothing was pushed.

What Changed

  • Merges upstream kunchenguid/firstmate main bf05a4fc (9 commits) into the fork. Upstream changes brought in:
    • fm-dispatch-resolve.sh accepts an optional, validated TYPESAFE_BASE that sets a different TypeSafe endpoint. An invalid value exits 2 before any credential lookup. Curl now runs with --globoff.
    • Before refusing to tear down a clean worktree whose commits aren't on a remote, fm-teardown.sh fetches from each remote (the no-mistakes gate is skipped). If the fetch fails, the refusal says so.
    • fm-timeout-lib.sh: when the caller is interrupted, the Perl timeout fallback now cleans up its command group.
    • New bin/fm-watch-key-lib.sh gives every per-endpoint watcher marker the same bounded v3.<sha256> key, so markers from different endpoints no longer collide. On upgrade, these caches reset once; docs/configuration.md documents this.
  • The merge conflicts in bin/fm-pr-merge.sh and docs/pi-supervision-branch.md were both resolved by keeping the fork's version. The fork already has upstream's update-branch and settled-check logic (in bin/fm-pr-github-ready-lib.sh), and its fm-spawn doc row is the newer wording. The reasoning is in .pr-evidence/upstream-merge-20261107/resolution.md.
  • Tests and docs come along with the upstream changes: new and expanded suites for teardown, the timeout lib, dispatch-resolve and watch triage/wedge-cap, plus updates to docs/configuration.md, docs/architecture.md and docs/scripts.md.

Risk Assessment

✅ Low: The merge brings in upstream's non-conflicting changes unaltered. In both conflicted files the fork's version was kept, and the source backs that choice: the fork already has upstream's update-branch and settled-check logic, and upstream's github_update_behind_branch function is identical in the fork's ready-lib. The fork's pi-supervision doc row describes the live-workers count that fm-spawn.sh actually implements.

Testing

I ran the merged fm-pr-merge.sh directly against a scratch FM_HOME, ran its full stubbed-forge test, and ran the targeted tests for each area the 9 upstream commits change. fm-pr-merge, teardown, timeout-lib, dispatch-resolve, extension-binding and wake-queue all pass. Four watch/daemon test cases fail, and each fails the same way on both parent commits, so they were already failing before this merge (here or on this host) and the merge did not add them. No Herdr or primary-lab run was needed because the change touches no pane lifecycle. Scratch directories were removed and the worktree is clean.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Merged fm-pr-merge.sh (kept fork version) still has upstream's GitHub update-branch merge flow: behind PR, consent required, head pinned, waits refused on draft/closed/conflict ✅ pass live fm-pr-merge.log (stubbed gh/forge, real script): 'fm-pr-merge immediately refuses draft, closed, conflicting, or unreadable updated heads despite pending or missing checks' plus 136 other ok, exit 0
Adversarial: --update-branch is rejected on a non-GitHub forge and when given a value ✅ pass live pr-merge-cli.txt: 'applies only to GitHub' / 'takes no value', exit 2
The kept docs/pi-supervision-branch.md row is accurate: fm-spawn's cap uses fm-afk-contract.sh live-workers ✅ pass live fm-afk-contract.sh live-workers on a scratch state prints 0; fm-spawn.sh:2308 calls it
Upstream teardown refreshes stale remote refs before refusing landed work (kunchenguid#8030) ✅ pass live fm-teardown.log exit 0
Upstream timeout lib cleans up Perl timeout processes on interruption (kunchenguid#7922) ✅ pass live fm-timeout-lib.log exit 0
Upstream dispatch-resolve accepts configurable TypeSafe base URLs (kunchenguid#7957) ✅ pass live fm-dispatch-resolve.log exit 0
Watcher marker keys and triage, merged with upstream kunchenguid#7923, keep their behavior ✅ pass live Most fm-watch-triage cases pass, including the new distinct-marker-key cases. The single 'expired stream did not enter inspection timer' failure also occurs on base 50dbd42 and upstream bf05a4f, so…
Evidence: fm-pr-merge --update-branch CLI guards

Source: fm-pr-merge --update-branch CLI guards

$ fm-pr-merge.sh t1 <gitlab MR> --update-branch error: --update-branch applies only to GitHub exit=2 $ fm-pr-merge.sh t1 <github PR> --update-branch=x error: --update-branch takes no value exit=2

$ fm-pr-merge.sh t1 <gitlab MR> --update-branch
error: --update-branch applies only to GitHub
exit=2
$ fm-pr-merge.sh t1 <github PR> --update-branch=x
error: --update-branch takes no value
exit=2
Evidence: fm-pr-merge test transcript

Source: fm-pr-merge test transcript

observation: visibility=updated blocker=draft waiting=pending preflight_reads=2 retry_advice=false
observation: visibility=updated blocker=draft waiting=missing preflight_reads=2 retry_advice=false
observation: visibility=updated blocker=closed waiting=pending preflight_reads=2 retry_advice=false
observation: visibility=updated blocker=closed waiting=missing preflight_reads=2 retry_advice=false
observation: visibility=updated blocker=conflict waiting=pending preflight_reads=2 retry_advice=false
observation: visibility=updated blocker=conflict waiting=missing preflight_reads=2 retry_advice=false
observation: visibility=updated blocker=required-source waiting=pending preflight_reads=2 retry_advice=false
observation: visibility=updated blocker=required-source waiting=missing preflight_reads=2 retry_advice=false
observation: visibility=delayed blocker=draft waiting=pending preflight_reads=2 retry_advice=false
observation: visibility=delayed blocker=draft waiting=missing preflight_reads=2 retry_advice=false
observation: visibility=delayed blocker=closed waiting=pending preflight_reads=2 retry_advice=false
observation: visibility=delayed blocker=closed waiting=missing preflight_reads=2 retry_advice=false
observation: visibility=delayed blocker=conflict waiting=pending preflight_reads=2 retry_advice=false
observation: visibility=delayed blocker=conflict waiting=missing preflight_reads=2 retry_advice=false
observation: visibility=delayed blocker=required-source waiting=pending preflight_reads=2 retry_advice=false
observation: visibility=delayed blocker=required-source waiting=missing preflight_reads=2 retry_advice=false
ok - fm-pr-merge immediately refuses draft, closed, conflicting, or unreadable updated heads despite pending or missing checks
ok - fm-pr-merge refuses a concurrent source-head change before updating, with or without --expected-head
ok - fm-pr-merge reports exact queue retry flags after a zero-exit false success
ok - fm-pr-merge omits merge-queue retry guidance for a closed GitHub PR
ok - fm-pr-merge aggregates agreeing merge-queue rules
ok - fm-pr-merge reports ambiguity for conflicting merge-queue rules
ok - fm-pr-merge records pr= and pr_head= for a verified GitHub merge
ok - fm-pr-merge records pr= before the forge call can land the merge
ok - fm-pr-merge propagates a real merge failure without silently succeeding
ok - fm-pr-merge refuses a GitHub merge call that leaves the PR open and unqueued
ok - fm-pr-merge retries a bounded number of times when mergeable is UNKNOWN and merges once it resolves
ok - fm-pr-merge reports mergeability still pending after its bounded UNKNOWN retry is spent
ok - fm-pr-merge refuses on the UNKNOWN re-check when a check turned red between reads
ok - fm-pr-merge refuses a genuine mergeable conflict immediately, without retrying
ok - fm-pr-merge keeps PR bookkeeping when it cannot read a successful merge call's outcome
ok - fm-pr-merge refuses with the forge's own output quoted apart from its verdict
ok - fm-pr-merge quotes the forge output when it cannot read the outcome either
ok - fm-pr-merge does not echo back queue flags the caller already used
ok - fm-pr-merge still names retry flags when the caller used a different method
ok - fm-pr-merge names the queue requirement even when its method is unrecognised
ok - fm-pr-merge distinguishes unreadable branch rules from a base with no merge queue
ok - fm-pr-merge reads a plan-gated 403 on branch rules as no merge queue, not unreadable
ok - fm-pr-merge says nothing about a merge queue when the base branch has no queue rule
ok - fm-pr-merge accepts only a proved merge from the gh-axi fallback
ok - fm-pr-merge explains an armed auto-merge that landed nothing on a queue-less base
ok - fm-pr-merge never reports auto-merge as armed when the merge command failed
ok - fm-pr-merge claims no acceptance for a failed merge command carrying queue flags
ok - fm-pr-merge falls back to the gh-axi view when gh's read fails
ok - fm-pr-merge names a landed state hiding behind a failed GitHub merge command
ok - fm-pr-merge refuses a GitHub merge when gh is missing, before recording
ok - fm-pr-merge refuses a GitHub merge when gh is missing rather than merging blind
ok - fm-pr-merge verifies a genuinely merged GitHub pull request
ok - fm-pr-merge refuses to claim a merge when poll recording fails
ok - fm-pr-merge accepts and accurately reports a GitHub merge-queue entry
ok - fm-pr-merge explains how to retry with the required GitHub merge queue method
ok - fm-pr-merge refuses branch deletion unless --attended-override is passed
ok - fm-pr-merge refuses before merging when task meta is missing
ok - fm-pr-merge refuses malformed PR URLs before calling gh-axi
ok - fm-pr-merge --help and -h print the header usage and exit 0
ok - fm-pr-merge refuses unsafe PR URL segments before recording state
ok - fm-pr-merge refuses repo override args before recording state
ok - fm-pr-merge refuses a bundled short-option repo override and refuses -d unless attended
ok - fm-pr-merge does not add default --squash when the caller passes an explicit merge method
ok - fm-pr-merge respects --method=<value> as an explicit merge method
ok - fm-pr-merge parses a GitHub PR URL into gh-axi number and --repo arguments
ok - fm-pr-merge refuses a caller --sha on GitHub because the head comes from the live read
ok - fm-pr-merge merges a GitLab merge request through glab instead of refusing it
ok - fm-pr-merge takes the GitLab instance from the URL rather than assuming one
ok - fm-pr-merge imposes no merge method on GitLab, leaving the project's own one
ok - fm-pr-merge refuses GitLab source-branch deletion unless --attended-override is passed
ok - fm-pr-merge propagates a real glab merge failure without silently succeeding
ok - fm-pr-merge refuses on each GitLab pre-merge condition independently
ok - fm-pr-merge reports every failing GitLab condition, not only the first
ok - fm-pr-merge reports a stale recorded head and verifies the live one
ok - fm-pr-merge refuses an unreadable GitLab merge request state rather than merging blind
ok - fm-pr-merge refuses a GitLab head commit it cannot validate
ok - fm-pr-merge refuses before recording anything when glab or jq is absent
ok - fm-pr-merge merges a Forgejo pull request through tea api instead of refusing it
ok - fm-pr-merge resolves the tea login by matching the PR's host against every registered login
ok - fm-pr-merge refuses when zero or more than one tea login matches the pull request's host
ok - fm-pr-merge refuses on each Forgejo pre-merge condition independently
ok - fm-pr-merge treats an unconfigured Forgejo combined status as none, refusing rather than skipping the check
ok - fm-pr-merge reads every Forgejo combined-status page before merging
ok - fm-pr-merge reports a stale recorded head and binds the merge to the live one instead
ok - fm-pr-merge refuses a Forgejo head commit it cannot validate
ok - fm-pr-merge refuses before recording anything when tea or jq is absent
ok - fm-pr-merge never trusts tea api's exit status alone; a rejected merge is caught by the confirm read
ok - fm-pr-merge retries a failed Forgejo confirmation read and persists the merge authority
ok - fm-pr-merge maps --squash/--rebase to Forgejo's Do field, defaults to the repository's default merge style, and refuses any other extra argument
ok - fm-pr-merge refuses a GitLab head override before recording state
ok - a merge a secondmate home performs itself is reported upward exactly once
ok - a locally routed secondmate home reports the landed PR into its parent's own channel
ok - a landed GitLab merge request is reported upward on the same channel
ok - a queued GitLab merge stays silent and leaves confirmation to the armed poll
ok - a refused or failed merge reports no outcome
ok - a GitLab merge refused before the forge call reports no outcome
ok - a merge a main home performs itself leaves one durable wake naming the PR
ok - a queued GitHub merge stays silent and leaves confirmation to the armed poll
ok - distinct merged PRs for one task retain distinct captain-facing wakes
ok - an uncommitted marker retry preserves at least one durable outcome
ok - a secondmate home that cannot report upward says so instead of merging in silence
ok - fm-pr-merge proceeds when the home carries no backlog at all
ok - fm-pr-merge refuses when the backlog exists but cannot be read
ok - fm-pr-merge refuses when its configured backend cannot be read
ok - fm-pr-merge refuses when its user backend configuration cannot be read
ok - fm-pr-merge refuses when its user backend configuration directory cannot be traversed
ok - fm-pr-merge proceeds once when its user configuration directory and backlog are genuinely absent
ok - fm-pr-merge honors a backend override over an unreadable user configuration
ok - fm-pr-merge updates behind branches only with explicit opt-in after all guards pass
ok - fm-pr-merge retains --expected-head before and after a consented behind-branch update
ok - fm-pr-merge refuses failed updated checks immediately while other checks are pending
ok - fm-pr-merge updates a green behind branch and merges only after the new head is green
ok - fm-pr-merge refuses red GitHub checks and waives only a named --allow-red check
ok - fm-pr-merge refuses a draft pull request and one with no boolean draft state
ok - fm-pr-merge merges when a failed check run was replaced by a passing re-run
ok - fm-pr-merge never lets a check run supersede a legacy status context
ok - fm-pr-merge still refuses when a check's current run failed after an earlier pass
ok - fm-pr-merge uses start order when the old success finishes last
ok - fm-pr-merge supersedes an old cancellation that finishes last
ok - fm-pr-merge keeps a check red while its re-run is still in flight
ok - fm-pr-merge never lets one check's pass clear another check's failure
ok - fm-pr-merge clears a failure only on a proven later pass of the same check
ok - fm-pr-merge keeps --allow-red scoped to its named check beside a superseded failure
ok - fm-pr-merge rechecks away presence before an attended red merge
ok - fm-pr-merge keeps a quiet-mode home's merges attended, the named red-check waiver included
ok - fm-pr-merge accepts exactly one separately named red-check waiver
ok - while the away-posture record exists any green merge lands under away authority, yolo or not, and attended merges stay untagged
ok - under the away-posture record the branch merges a green task, is refused on a red check with or without --allow-red, and is refused at the partition while attended
ok - a branch merge refuses under the lock when the away record is archived during preflight
ok - away posture permits immediate merges but refuses every asynchronous path
ok - away merge proceeds on a plan-gated 403 because that repository cannot have a merge queue
ok - the away record does not bypass red checks, and a recorded pr= must match the URL
ok - an unreadable away-posture record refuses the merge instead of skipping the record
ok - no away-record archive or replacement lands between the authority read and the merge
ok - a record made unreadable before the merge's own authority read refuses the merge
ok - a merge that cannot lock the away record refuses instead of merging unlocked
ok - fm-pr-merge refuses --allow-red on GitLab
ok - fm-pr-merge refuses when a required check from branch protection or a ruleset never reported
ok - fm-pr-merge merges when every required check reported and is green
ok - fm-pr-merge reports a red check and an unreported required check together with every other failure
ok - fm-pr-merge names a cancelled check and says it needs a rerun
ok - fm-pr-merge refuses when the required checks cannot be read, and tells a plan without rules apart
ok - fm-pr-merge --allow-missing waives only its named unreported check
ok - fm-pr-merge --allow-missing is single use, attended-only, and GitHub-only like --allow-red
ok - fm-pr-merge enforces required producer identity and named waivers
ok - fm-pr-merge matches an app-bound required commit status by name
ok - fm-pr-merge reports known missing checks and all independent read errors
ok - fm-pr-merge refuses --allow-red on Forgejo
ok - fm-pr-merge refuses --allow-missing on Forgejo
ok - fm-pr-merge --allow-no-pipeline waives only a null GitLab head pipeline and keeps every other condition
ok - fm-pr-merge --allow-no-pipeline is attended-only, takes no value, and applies only to GitLab
ok - fm-pr-merge sends a matching --expected-head to each forge
ok - fm-pr-merge refuses before any merge write when the live head differs from --expected-head
ok - fm-pr-merge binds the forge write to the supplied head after that head moves
ok - fm-pr-merge does not replace --expected-head when a later preflight reads a new head
ok - fm-pr-merge refuses a malformed, abbreviated, missing, or conflicting --expected-head before any effect
ok - fm-pr-merge keeps draft, hold, review, check, authority, and identity refusals when --expected-head matches
Evidence: fm-teardown test transcript

Source: fm-teardown test transcript

ok - teardown leaves opencode's busy plugin in the returned pool worktree as on main
ok - hidden untracked work is refused before return while a clean control returns
ok - content fallback distinguishes unavailable Git proof, containment, conflicts, and unlanded content
orca/reap-refusal: teardown_exit=1 replay_exit=0 metadata_after_replay=retained backlog_after_replay=in_flight
tmux/reap-refusal: teardown_exit=1 replay_exit=0 metadata_after_replay=retained backlog_after_replay=in_flight
ok - post-reap proof retains late work and retry records on ordinary and Orca paths, preserving clean/force/scout behavior
ok - status archival is opt-in and preserves the complete log
ok - config-absent teardown does not read or invoke record export
ok - unopted teardown ignores symlinked config when record export is absent
ok - teardown commits the record archive before deleting sources and fails closed when export cannot commit
ok - forced secondmate teardown exports task records from the child sub-state
ok - record export waits for endpoint quiescence and retry captures records changed after refusal
ok - forced secondmate retirement preserves two descendant levels and refuses linked child directories
ok - local missing-status retirement stays lock-free without creating an archive
ok - reused task IDs never overwrite archives and retention removes only old owned logs
ok - archive sources and directories reject symlinks; pruning never follows children links
ok - failed archive publication preserves presentation and watcher bookkeeping
ok - cursor retirement failure removes its archive so retry publishes one history
ok - archive publication and cold logs never re-wake or re-present
ok - retention failures warn without aborting unrelated teardown
ok - a missing teardown startup source refuses before cleanup
ok - an unreadable teardown startup source refuses before cleanup
ok - a missing adapter sibling refuses before cleanup
ok - a forced descendant with a missing adapter sibling refuses before cleanup
ok - a forced secondmate with a missing own adapter sibling refuses before child cleanup
ok - present required sources still reach the ordinary teardown refusal
ok - local-only worktree with HEAD on a fork remote is torn down and the home summary is refreshed
ok - teardown closes its own backlog item before reporting success
ok - teardown closes a landed Gerrit task with its change URL as a note and a GitHub task with --pr
ok - teardown closes a landed GitLab task with its merge request URL as a note and GitHub and Forgejo tasks with --pr
ok - teardown honors config/backlog-backend=manual and still finishes cleanly
ok - local-only worktree with truly unpushed work is refused (safety preserved)
ok - local-only worktree with work merged into local main is torn down (no regression)
ok - work landed on another origin branch from another clone is proven after a refresh
ok - a failed refresh refuses and names the remote it could not reach
ok - commits on no remote branch still refuse after a successful refresh
ok - uncommitted work refuses even when the commits have landed
ok - a file saved during the refresh refuses teardown and survives
ok - a project with no remote refuses as before and fetches nothing
ok - the refresh keeps a dropped branch's tracking ref even with fetch.prune set
ok - work the tracking refs already show adds no network call
ok - a hung refresh is cut off at its bound and refuses
ok - commits held only by the no-mistakes gate are not refreshed into landed
ok - no-mistakes worktree with HEAD on origin is torn down (no regression)
ok - no-mistakes worktree with genuinely unlanded work is refused (safety preserved)
ok - branch pushed only to the no-mistakes mirror is refused as unlanded
ok - local-only worktree with unpushed work is torn down under --force (escape hatch)
ok - fm-pr-check publishes the PR-ready line on a secondmate's parent channel once
ok - fm-pr-check withholds the PR-ready line until checks are green when config/ready-after-green is present
ok - fm-pr-check releases the PR-ready line on a checks-green report that carries surrounding text
ok - a secondmate home's teardown delivers the child's final line or refuses until it can
ok - teardown completes when an exact busy-state sidecar is already absent
ok - teardown retires a polytoken task's generated worktree wiring on pool return
ok - teardown never deletes a tracked .polytoken hook layer
ok - teardown never deletes a .polytoken hook layer firstmate did not generate
ok - teardown scopes .polytoken wiring removal to polytoken tasks
ok - herdr teardown removes pane-owned escalation dedupe state
ok - herdr flat teardown refuses before returning the isolated copy under lock contention and the retry completes cleanly
ok - herdr flat teardown never erases records when pane presence is unparseable
ok - herdr flat teardown preflight refuses before every destructive change
ok - herdr teardown refuses a foreign-owned per-account namespace (owner-shim arms need the non-Darwin stat branch; skipped on Darwin)
ok - secondmate retirement clears a pooled home's identity before returning the lease
ok - a failed lease return restores the preserved secondmate home's identity
ok - forced secondmate teardown preflights every Herdr child before cleanup mutation
ok - forced secondmate teardown holds every descendant lifecycle and metadata lock
ok - forced secondmate teardown retains Herdr child identity until exact pane disappearance
ok - forced teardown retains a nested secondmate home and its grandchild's Herdr identity when the grandchild close is unconfirmed
ok - herdr projection teardown retires its journal only after confirming the exact recorded pane is gone
ok - herdr projection teardown retains every record when post-close presence is unknown
ok - herdr projection teardown surfaces failed focus restoration without turning confirmed cleanup into a hard failure
ok - herdr projection teardown closes its exact pane, restoring focus, before returning the copy that holds its shell
ok - herdr projection teardown retains the task, pane shell, and leased copy after a refused close
ok - teardown retires the task's own watcher markers and orphaned presentation journal, leaving other tasks' markers alone
ok - teardown retains a presentation journal bound to a pane other than the closed endpoint
ok - teardown retires a v1 presentation journal once its token workspace is confirmed gone
ok - teardown retains a v1 presentation journal while its token workspace is still present
ok - teardown retains a v1 presentation journal when the workspace query is ambiguous
ok - squash-merged + deleted-branch worktree (PR merged) is torn down (the fix)
ok - squash-merged PR accepts a local HEAD that is an ancestor of the final PR head
ok - teardown discovers a merged PR by branch name and tears down when no pr= was ever recorded
ok - squash-merged PR accepts replayed unpushed local patches contained in the PR head
ok - merged PR patch matching preserves indentation, allows exact replays, and refuses unsupported Git
ok - diverged-after-remote-rebase branch is landed only when every local patch matches exactly
ok - merged PR does not allow teardown after a later local commit
ok - squash-merged task whose local branch followed the pipeline rebase is torn down
ok - teardown proves a Forgejo task landed from the merged pull request when the content check is inconclusive
ok - squash-merged same-path different content still refuses
ok - squash-merged rebased local still refuses a genuinely unlanded follow-up commit
ok - squash-merged stale local still refuses when the forge is unreachable
fm-contributions: data directory unavailable
contributions: observation not armed; coverage is unconfirmed
fm-contributions: data directory unavailable
contributions: observation not armed; coverage is unconfirmed
ok - fm-pr-check does not refresh PR head after HEAD moves
fm-contributions: data directory unavailable
contributions: observation not armed; coverage is unconfirmed
ok - fm-pr-check records the remote PR head when the local worktree lags
ok - worktree whose content already landed in the default branch is torn down (content fallback)
ok - the content-landed fallback checks a task's recorded base branch, not the default branch
ok - content fallback refreshes origin default before comparing trees
ok - dirty worktree is refused even when its committed work has landed (dirty always wins)
ok - untracked/no-mistakes: dirty refusal classifies leftovers and preserves work
ok - untracked/local-only: dirty refusal classifies leftovers and preserves work
ok - tracked/no-mistakes: dirty refusal classifies leftovers and preserves work
ok - tracked/local-only: dirty refusal classifies leftovers and preserves work
ok - mixed/no-mistakes: dirty refusal classifies leftovers and preserves work
ok - mixed/local-only: dirty refusal classifies leftovers and preserves work
ok - scout copy with a nested clone and a scratch file returns with no untracked entries
ok - ship copy with a nested clone is refused and its bytes stay
ok - a return that leaves residue names the lost slot and the remaining paths
ok - a dirty return is reported even when a later teardown step refuses
ok - a forced secondmate teardown returns a child scout copy with a nested clone clean
ok - a forced secondmate teardown warns about a dirty child return and still completes
ok - a return that leaves no readable copy reports the slot as unverified, not clean
ok - ignored files survive the scratch clean and plain scratch does not
ok - gh lookup error with content not in default refuses (fail-safe)
ok - a record predating spawn_gen refuses teardown until --legacy-record is passed
ok - a windowless leftover with no spawn_gen and no worktree tears down without --legacy-record
ok - a windowless leftover with no spawn_gen also tears down when --legacy-record is passed
ok - a windowless leftover still refuses while its worktree holds unlanded work
ok - a windowless record with a spawn_gen, a non-tmux backend or endpoint identity, no backlog validation, or ambiguous, foreign, or malformed identity still refuses
ok - a windowless leftover retries its retained legacy stamp without --legacy-record
ok - a landed legacy record with a dead endpoint tears down and logs its accepted incarnation
ok - --legacy-record never relaxes the unlanded-work refusal
ok - an endpoint that cannot be confidently read as dead refuses --legacy-record teardown
ok - --legacy-record teardown rolls its stamp back when the close marker write fails
ok - a legacy stamp a failed rollback left behind still faces the endpoint gate
ok - a corrupt spawn_gen is never accepted as a legacy record
ok - a legacy record whose endpoint is the recorded worktree cleans up once its work has landed
ok - a legacy record whose endpoint matches the worktree still refuses while that work is unlanded
ok - a legacy endpoint that is not the recorded worktree still refuses without --legacy-record
ok - provably-stale worktree index.lock (old, no live holder) is cleared and teardown succeeds
ok - live-held worktree index.lock is never removed and teardown refuses
ok - lsof errors leave worktree index.lock in place and refuse teardown
ok - stale lock cleanup rechecks and refuses dirty worktree before return
ok - normal repo index.lock is resolved from the worktree and cleared when stale
ok - index-lock mtime fault injection is PATH-based; skipped on Darwin where stat is /usr/bin/stat
ok - transient index.lock cleared after first failed return is retried successfully without force-remove
ok - persistent index.lock exhausts retries and refuses without force-removing the lock
ok - empty retry wait overrides use the default without aborting teardown
ok - fractional legacy retry wait remains supported without arithmetic
ok - teardown records the task's pipeline spend before removing its branch and record
ok - teardown skips all pipeline-spend recording when the home has not opted in
ok - teardown records unavailable pipeline spend for an owned ship task whose copy is gone
ok - a task's own parked no-mistakes run is aborted, not orphaned, before the worker is removed
ok - a parked run in a resolved workspace no-mistakes home is aborted before the worker is removed
ok - a run that lands on passed-with-override after abort is still recognized as terminal
ok - a run that lands on passed-with-skips after abort is still recognized as terminal
ok - a parked run the pipeline advanced past the task copy is still concluded from the runs ledger, not orphaned
ok - a ledger row for a different head never authorizes a parked-run abort
ok - a malformed ledger row never authorizes a parked-run abort
ok - an impossible ledger date never authorizes a parked-run abort
ok - a terminal status with a stale gate never reaches ledger cleanup
ok - an advanced head present locally aborts through the strict rule alone - the ledger fallback stays dormant
ok - an unresolvable active row with no same-branch anchor is never concluded (conservative refusal)
ok - an ancestor-only anchor never binds an advanced parked run to this task
ok - a terminal unfetched-head row is stale history and never concludes a run
ok - a terminal newest row anchored at this worktree's head never authorizes an abort
ok - a resolvable diverged newer same-branch row makes every older row stale history; no run is concluded
ok - consecutive unresolvable rows are ambiguous and never conclude a run
ok - a ledger-proven continuation is still left alone while the run is autonomously active
ok - teardown refuses before reap or removal when a task-owned run remains parked
ok - a different run cannot confirm the targeted abort
ok - empty post-abort status is not accepted as confirmation
ok - the CLI's exact run-not-found signal confirms completion
ok - a parked run on another branch is never aborted by this task's teardown (ownership is precise)
ok - a task-owned autonomous running step is left alone rather than aborted
ok - a leaked descendant process rooted under the task's worktree is reaped by teardown, not left surviving
ok - a leaked descendant process rooted under the task's per-task tasktmp is reaped by teardown too
ok - missing lsof falls back to reaping the tmux pane process group
ok - teardown reaps a leaked worktree process when lsof is only in a system directory off PATH
ok - an erroring lsof scan refuses teardown and preserves the task
ok - a reused pid with a different start time is never force-killed
ok - an exec change preserves birth identity and the process is reaped
ok - a process spawned during grace is reaped on a later pass
ok - persistent leaked processes refuse teardown after bounded retries
ok - a process exiting during identity lookup does not block teardown
ok - the run abort and the leaked-process reap both complete before the destructive worktree return
Evidence: fm-extension-binding serial transcript

Source: fm-extension-binding serial transcript

ok - unknown extension conformance section selectors fail before setup
not-autohandled: example-file (left for the handler; still unacknowledged)
not-autohandled: flow-source (left for the handler; still unacknowledged)
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 259: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-task-inbox-lib.sh: No such file or directory
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 261: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-backend.sh: No such file or directory
ok - the shipped file-signal package is a runnable end-to-end external adapter
ok - the section coordinator propagates ordered failures and bounded cleanup
ok - one external adapter registers, invokes, captures unhandled evidence, classifies, and terminally retires end to end
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 259: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-task-inbox-lib.sh: No such file or directory
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 261: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-backend.sh: No such file or directory
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 259: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-task-inbox-lib.sh: No such file or directory
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 261: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-backend.sh: No such file or directory
ok - register-extension and reconcile of an unhandled extension result take their locks in one order

all extension-binding tests passed
not-autohandled: example-symlinked (left for the handler; still unacknowledged)
not-autohandled: remote-source (left for the handler; still unacknowledged)
ok - a home reached through a symlinked ancestor captures external evidence normally
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 259: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-task-inbox-lib.sh: No such file or directory
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 261: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-backend.sh: No such file or directory
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 259: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-task-inbox-lib.sh: No such file or directory
/private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-procevent.sh: line 261: /private/var/folders/d9/2d5w27z5775c_r1qcw57vzzr0000gn/T/fm-extension-binding.557o9I/remote-root/bin/fm-backend.sh: No such file or directory
ok - serialized remote binding crosses fm-on through addressed-home capture and retirement

all extension-binding tests passed
ok - inner result.silent host crash releases the parent lifecycle lock before terminal retry
ok - handshake execution rejects and reaps foreground descendants

all extension-binding tests passed
ok - local binding retirement requires its exact identity and disables invocation
ok - ownerless readiness recovers only dead exact-token groups and refuses unsafe or unproved ownership
ok - reconcile durably announces cleanup uncertainty once and recovers both extension sources
ok - attached start and live-owner recovery renew cleanup failure wakes with delivered failure headlines

all extension-binding tests passed
ok - independent extension conformance sections complete through isolated public homes

all extension-binding tests passed
- Outcome: ⚠️ 1 info across 1 run (14m35s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 info
  • ℹ️ Four test cases fail the same way on this merge, on fork base 50dbd42 and on upstream bf05a4f, so the merge did not cause them: fm-watch-triage 'expired stream did not enter inspection timer', fm-watch-triage-pause 'stale suppressor not advanced on paused absorb', fm-watch-wedge-cap 'wedge round 1 (default config) failed to exit', and fm-daemon 'bounded daemon recheck gave the wrong reason' (that log also shows date: &lt;epoch&gt;: No such file or directory, which suggests a BSD/GNU date difference). These were not compared on CI, so CI may report them.
  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Merged fm-pr-merge.sh (kept fork version) still has upstream's GitHub update-branch merge flow: behind PR, consent required, head pinned, waits refused on draft/closed/conflict ✅ pass live fm-pr-merge.log (stubbed gh/forge, real script): 'fm-pr-merge immediately refuses draft, closed, conflicting, or unreadable updated heads despite pending or missing checks' plus 136 other ok, exit 0
Adversarial: --update-branch is rejected on a non-GitHub forge and when given a value ✅ pass live pr-merge-cli.txt: 'applies only to GitHub' / 'takes no value', exit 2
The kept docs/pi-supervision-branch.md row is accurate: fm-spawn's cap uses fm-afk-contract.sh live-workers ✅ pass live fm-afk-contract.sh live-workers on a scratch state prints 0; fm-spawn.sh:2308 calls it
Upstream teardown refreshes stale remote refs before refusing landed work (kunchenguid#8030) ✅ pass live fm-teardown.log exit 0
Upstream timeout lib cleans up Perl timeout processes on interruption (kunchenguid#7922) ✅ pass live fm-timeout-lib.log exit 0
Upstream dispatch-resolve accepts configurable TypeSafe base URLs (kunchenguid#7957) ✅ pass live fm-dispatch-resolve.log exit 0
Watcher marker keys and triage, merged with upstream kunchenguid#7923, keep their behavior ✅ pass live Most fm-watch-triage cases pass, including the new distinct-marker-key cases. The single 'expired stream did not enter inspection timer' failure also occurs on base 50dbd42 and upstream bf05a4f, so…
  • bash tests/fm-pr-merge.test.sh (merge resolution; 137 ok, exit 0)
  • bash tests/fm-teardown.test.sh (upstream #8030 remote-ref refresh; exit 0)
  • bash tests/fm-timeout-lib.test.sh (upstream #7922 Perl timeout cleanup; exit 0)
  • bash tests/fm-dispatch-resolve.test.sh (upstream #7957 TypeSafe base URLs; exit 0)
  • bash tests/fm-extension-binding.test.sh (upstream #8210; exit 0 when run serially)
  • bash tests/fm-wake-queue.test.sh (exit 0)
  • bash tests/fm-watch-triage.test.sh, fm-watch-triage-pause, fm-watch-wedge-cap, fm-daemon on the merge, then the same four on git archive copies of 50dbd428 and bf05a4fc to compare
  • FM_HOME=&lt;scratch&gt; bin/fm-pr-merge.sh t1 &lt;gitlab MR&gt; --update-branch and --update-branch=x argument guards
  • bin/fm-afk-contract.sh live-workers on a scratch state dir (this is the command the kept docs row names)
  • git diff 50dbd428 dee3c3dc -- bin/fm-pr-merge.sh docs/pi-supervision-branch.md (empty, so the fork version was kept) and a grep for upstream's update-branch logic in the fork
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

tiago-peixoto and others added 11 commits November 5, 2026 11:16
…henguid#8191)

* Refresh owner presence before detached process-event startup

* no-mistakes(review): Correct lease documentation and CI evidence claims
…d#8104) (kunchenguid#8187)

* fix: recover remote inheritance generations after counter loss

* no-mistakes(review): Restore inheritance pushes to older receivers

* no-mistakes(document): Document inheritance counter recovery

* test: cover inheritance selection and mutation kill boundary

* no-mistakes(document): Clarify receiver generation query documentation
…uid#6330)

* fix: update green behind PR before merge

* no-mistakes(review): Update behind PRs for any method; await UNKNOWN

* no-mistakes(review): Cap update-branch wait under merge locks

* no-mistakes(review): Fix stale update-wait header comment

* docs: clarify branch update authority

* fix(merge): require branch-update consent and stop on failure

* no-mistakes(review): Await UNKNOWN after waivers; report unreadable post-update state

* fix(merge): pin branch update to checked head

Send expected_head_sha with the REST update so a concurrent push cannot
advance an unchecked replacement head.

Refuse a head mismatch without retrying against the new head.

* no-mistakes(document): Clarify branch-update consent, head pinning, and polling guidance

* fix(bin): stop waits on non-check refusals

Pending or missing checks must not mask draft, state, conflict, or required-check read refusals after a branch update.

* no-mistakes(review): Refuse blockers while awaiting updated pull request heads

* no-mistakes(document): Document immediate refusals during branch update polling
* fix: reap Perl timeout groups when callers are interrupted

* no-mistakes(review): Preserve caller signal handlers after timeout runner cleanup

* no-mistakes(review): Prevent startup interrupt loss and remove parent-death cancellation

* no-mistakes(document): Correct timeout fallback comments and remove stale duplication

* fix: preserve interruption status and use monotonic timeout clocks

* no-mistakes(document): Correct timeout contract references and document monotonic timing

* no-mistakes(review): Preserve active traps in Perl timeout cleanup

* no-mistakes(document): Clarify Perl timeout trap restoration
…#7923)

* Preserve independent watcher history for distinct endpoints

* no-mistakes(review): Complete shared watcher-marker key migration

* no-mistakes(document): Document shared watcher marker identity

* no-mistakes(ci): Fixed SC1091 by adding the daemon’s missing ShellCheck source annotation. Focused full-analysis lint, bash syntax validation, and git diff --check passed. Tier 2: the existing lint gate enforces this correction; no runtime redesign was needed

* no-mistakes(ci): Implemented bounded SHA-256 endpoint keys and a failing-first long-endpoint regression, which now passes. ci-1 remains unchanged as unrelated. Incomplete: focused lint reports SC2030/SC2031 in fixture setup. The command guard rejected focused testing as indirect execution. Stopped without bypassing or retrying. Pipeline must resolve lint and finish verification

* test: scope watcher fixture environment to child commands

* docs: explain watcher key upgrade reset and cache cleanup

* no-mistakes(test): Confirm six required scenarios pass; exclude optional Codex probe

* chore: remove accidental validation scratch

* no-mistakes(document): Replace obsolete watcher-key comment with owner pointer

* no-mistakes(review): Use shared keys in Pi-stream fixtures

* no-mistakes(document): Deduplicate watcher marker cleanup guidance
* test: wait for recovered orphan-readiness runners instead of a fixed marker poll

The lifecycle-orphan-readiness section polled each recovered source's
handled marker for a fixed 10s after reconcile. Reconcile only confirms
each launch; each runner then polls, captures, takes a silent verdict and
a terminal verdict, and the two runners take their verdicts in turn under
the home's extension lifecycle lock. On a CPU-starved host that chain of
short host and fixture processes can exceed 10s, so the section flaked.

Wait for the recorded runner process groups to exit, bounded by the
coordinator's section-lane deadline, then assert the handled markers,
retirement and claim release. On timeout, kill the recorded runner groups
and sweep the home before failing, and track the home so any exit sweeps
it.

* no-mistakes(review): Bound recovered-runner wait to coordinator deadline
… (kunchenguid#8192)

* test: cover TypeSafe dispatch base URL configuration

* test: compare the recorded TypeSafe endpoint argument

* feat: allow an explicit TypeSafe dispatch base URL

* no-mistakes(review): Use literal TypeSafe endpoint test expectations

* no-mistakes(document): Correct TypeSafe base URL documentation

* no-mistakes(ci): Implemented ci-2 and ci-3: malformed TypeSafe addresses fail before credential lookup, and both curl paths disable URL globbing. Added focused regressions. Tier 1 fixes address the shared boundaries. Configured local lint passed. Required ci-box tests and the documentation audience check remain unverified. The command guard rejected the inspection/preflight command as “Privilege escalation in chained command.” No retry or bypass was attempted

* fix: reject brackets in TypeSafe base paths

* no-mistakes(review): Narrow TypeSafe host validation

* no-mistakes(document): Clarify TypeSafe base URL documentation

* test: isolate dispatch base from exported settings
…rk (kunchenguid#8030)

* fix(teardown): refresh remote refs before refusing work as unlanded

Teardown read landed work from the task copy's remote-tracking refs, so work
pushed from another checkout was refused until someone fetched by hand. Refresh
each remote, bounded and without pruning, when the refs do not show the work.
A failed refresh leaves the refs as they were, still refuses, and names the
remote in the refusal.

* no-mistakes(review): Use fixed 30-second fetch bound, removing timeout override

* no-mistakes(ci): Final state, replacing the earlier reports: the fix is in the worktree, uncommitted. The full run of tests/fm-teardown.test.sh did NOT complete: it was stopped at the 20-minute background limit after about 126 of 156 tests. All 126 passed with no failures, including the new test. The remaining ~30 did not run, so the outer test phase must run the full file. Change: validate_worktree_teardown_safety re-runs the dirty check through read_worktree_dirt right after refresh_remote_refs and refuses the same way if it fails or finds work. Added one test, test_edit_saved_during_refresh_refuses, covering local-only, direct-PR and no-mistakes modes. Kept the timed-out agent's code change; removed its extra second test and fake-git hook, per the one-test instruction. Verified: the new test failed with the recheck removed and passed with it restored. bash -n on bin/fm-teardown.sh passed. Not verified: shellcheck is not on PATH, so it did not run. The path where the recheck itself cannot read the copy has no test, per the one-test instruction. Partial log: /tmp/fm-teardown-full.log
…0261107

# Conflicts:
#	bin/fm-pr-merge.sh
#	docs/pi-supervision-branch.md
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e9906c6-72cd-4001-83f3-8dd064673fe0
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

… change. The Full suite check failed only because those shards failed, so it should clear with them. No production code changed. **Root cause:** upstream commit 10b7163 (kunchenguid#7923) moved the watcher's marker key to a hashed `v3.` format, built by `window_key` in the new `bin/fm-watch-key-lib.sh`. Upstream updated its own tests to use the `watch_window_key` helper. Five fork-only test fixtures still built the key the old way (`tr ':/.' '___'`). Their `.hash-`/`.stale-`/`.count-` setup files therefore landed under names the watcher no longer reads: - **Shard 2** (`fm-watch-triage`): "current done worker did not advance the stale suppressor". - **Shard 3** (`fm-watch-triage-wedge-defer`): "the counter did not reach the bound". - **Shard 8** (`fm-watch-wedge-cap`): "round 2 escalated a finished worker as a wedge". **Invariant:** every test fixture that sets up or checks a per-window watcher marker must get its key from the one shared derivation, not a copy of it. I checked every place a fixture computes a watcher window key: - The five stale sites: `tests/fm-watch-triage.test.sh` lines 2266, 2293 and 2321, `tests/fm-watch-triage-wedge-defer.test.sh:762` and `tests/fm-watch-wedge-cap.test.sh:1945`. Each now uses `watch_window_key "$window"`. - The other old-format keys left in the repo are also in upstream. They are task-keyed or backend-keyed families outside the window-key change, or upstream's deliberate legacy-key test (`.count-s_a_b`). - `bin/fm-wake-decision-lib.sh` builds the old key too, but only for its own `.wake-decision-surfaced-` file, which it both writes and reads that way. It's consistent and outside this failure, so I left it alone. **Verification (local, macOS):** - `fm-watch-triage-wedge-defer.test.sh` passes in full (14 tests). - On macOS the watcher harness gets reaped before it polls the window, because file timestamps are only accurate to the second. Some cases in these files fail locally even without my change, including the first wedge-cap case. To get past that I ran the target cases from scratch copies that add a few seconds of sleep, then deleted the copies. - With that padding, the done-worker triage case fails without the fix and passes with it. - The wedge-cap cases (finished worker not escalated, and a truly wedged worker still escalates) pass with the fix. The unfixed version also passes locally, because the old-key marker is simply ignored there. So only Linux CI showed that failure. - The stale-wake provenance cases pass. - shellcheck is clean on all three files. I couldn't run Linux: Docker is installed but its daemon isn't running. Shard 12 (cancelled) was left for a decision and I didn't touch it
@trillium
trillium merged commit 9397d95 into main Nov 7, 2026
52 of 54 checks passed
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.

6 participants