Skip to content

fix(bin): show reported checks when a pull request's base requires none - #7450

Merged
kunchenguid merged 1 commit into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-7311-reported-checks
Oct 17, 2026
Merged

kunchenguid merged 1 commit into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-7311-reported-checks

Conversation

@tiago-peixoto

@tiago-peixoto tiago-peixoto commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7311.

Intent

Work the open-source lane: fix upstream issue #7311, which carries the maintainer's ready-for-pr label and has no open pull request.

The issue: bin/fm-pr-state.sh reads checks only through gh pr checks --required. When a pull request's base branch has no required checks (for example a stacked pull request targeting another pull request's branch), gh answers "no required checks reported" even while a reported check on that head has already failed, so the script prints only that readiness is unconfirmed and the failure reaches nobody. Kun's firstmate confirmed it on main 24f3a6b8 on 2026-10-14 and labelled it ready-for-pr.

What Changed

  • bin/fm-pr-state.sh now runs a second check lookup when gh pr checks --required answers "no required checks reported", for example on a stacked pull request whose base is an unprotected branch. Under the existing "readiness unconfirmed" line, it prints each failing or pending check as REPORTED CHECK: <name> (<state>). Passing and skipped checks stay hidden. If that second lookup fails, the script stops with an error and does not hide the failure.
  • The script puts both lookups behind one unsettled_checks helper. Pull requests that have reported required checks still show only REQUIRED CHECK lines, and their advisory checks stay omitted. The header comment now describes the new behavior.
  • tests/fm-pr-state.test.sh adds tests for four cases: a failing reported check, a pending reported check with a skipped one hidden, an error from the reported-check lookup, and a protected base that never runs the reported-check lookup.

Risk Assessment

✅ Low: The fallback runs only on gh's "no required checks reported" error, which gh v2.101.0 emits only when the check list is non-empty, so the unfiltered read reliably lists the failing or pending checks; any other gh failure still stops the script with an error.

Testing

I ran the real script, using the machine's real gh login, against live public pull requests in read-only mode, at both the base commit and the target commit. On three pull requests whose base has no required checks, the old script hid the failing checks. The new script lists each failing or pending check as a REPORTED CHECK, and its exit status stays 0. On two pull requests whose base has required checks and also has failing advisory checks, the output was byte-identical before and after the fix. Only the required checks were listed. The focused test file tests/fm-pr-state.test.sh passes. The case where the fallback read of reported checks fails was not driven live. The change has no UI, so no screenshots apply.

  • Live validation: ✅ go - 3 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Operator runs fm-pr-state.sh on an open pull request whose base has no required checks and has a failed check; the failure is printed as REPORTED CHECK ✅ pass live live-no-required-checks.txt: MergeFi/frontend#803, xbmc/xbmc#29941 and dubzzz/fast-check#7456 print REPORTED CHECK ... (FAILURE). The base commit printed only the readiness-unconfirmed line.
Pending reported checks on an unprotected base are also surfaced, and the script still exits 0 ✅ pass live live-no-required-checks.txt: fast-check#7456 lists IN_PROGRESS/PENDING checks with exit=0. gh pr checks --json exits 0 even when checks fail or are pending.
Adversarial: a protected-base pull request that has a failing advisory check still reports only required checks (no REPORTED leak) ✅ pass live live-required-checks-unchanged.txt: librariarr#466 has a failing advisory check (code/snyk) that is not printed. On openclaw#175592, only openclaw/ci-gate is printed. Both outputs are IDENTICAL to the…
If the fallback read of reported checks fails, the script refuses with a non-zero exit ⏸️ untested no The prior payload did not establish a live result for this scenario. Making a live gh lookup fail only on the second call is not possible without stubbing gh. Only the repository's stubbed test 'a fai…
Evidence: Live before/after on PRs with no required checks

Source: Live before/after on PRs with no required checks

=== https://github.com/dubzzz/fast-check/pull/7456
--- gh pr checks (all, unsettled):
pending Warm up pnpm cache (macOS)
pending Warm up pnpm cache (Linux)
pending Warm up pnpm cache (Windows)
pending Analyse
fail renovate/artifacts
pending renovate/stability-days
gh exit=0
--- before fix (base 66c300bd):
CHECKS: no required check has reported; readiness unconfirmed
exit=0
--- after fix (44c5b680):
CHECKS: no required check has reported; readiness unconfirmed
REPORTED CHECK: Warm up pnpm cache (macOS) (IN_PROGRESS)
REPORTED CHECK: Warm up pnpm cache (Linux) (IN_PROGRESS)
REPORTED CHECK: Warm up pnpm cache (Windows) (IN_PROGRESS)
REPORTED CHECK: Analyse (IN_PROGRESS)
REPORTED CHECK: renovate/artifacts (FAILURE)
REPORTED CHECK: renovate/stability-days (PENDING)
exit=0
=== https://github.com/xbmc/xbmc/pull/29941
--- gh pr checks (all, unsettled):
fail Mergeable
pending CodeRabbit
pending default
gh exit=0
--- before fix (base 66c300bd):
CHECKS: no required check has reported; readiness unconfirmed
exit=0
--- after fix (44c5b680):
CHECKS: no required check has reported; readiness unconfirmed
REPORTED CHECK: Mergeable (FAILURE)
REPORTED CHECK: CodeRabbit (PENDING)
REPORTED CHECK: default (PENDING)
exit=0
=== https://github.com/MergeFi/frontend/pull/803
--- gh pr checks (all, unsettled):
fail build-and-lint
fail Vercel
gh exit=0
--- before fix (base 66c300bd):
CHECKS: no required check has reported; readiness unconfirmed
exit=0
--- after fix (44c5b680):
CHECKS: no required check has reported; readiness unconfirmed
REPORTED CHECK: build-and-lint (FAILURE)
REPORTED CHECK: Vercel (FAILURE)
exit=0
Evidence: Live before/after on protected-base PRs (unchanged)

Source: Live before/after on protected-base PRs (unchanged)

=== https://github.com/ahembree/librariarr/pull/466 (required checks reported; 9 unsettled checks, 6 of them required)
--- all unsettled checks:
pending Lint & Type Check
pending Browser E2E (compose)
pending Analyze (javascript-typescript)
pending Unit Tests
pending Integration Tests
pending Build
pending Docker Build
fail code/snyk (ahembree)
--- after fix:
REQUIRED CHECK: Lint & Type Check (IN_PROGRESS)
REQUIRED CHECK: Browser E2E (compose) (IN_PROGRESS)
REQUIRED CHECK: Unit Tests (IN_PROGRESS)
REQUIRED CHECK: Integration Tests (IN_PROGRESS)
REQUIRED CHECK: Build (IN_PROGRESS)
REQUIRED CHECK: Docker Build (IN_PROGRESS)
exit=0
IDENTICAL to before fix
=== https://github.com/openclaw/openclaw/pull/175592 (required checks reported; 18 unsettled checks, 1 of them required)
--- all unsettled checks:
pending security-fast
pending control-ui-i18n
pending check-docs
pending check-additional-boundaries
pending check-plan
pending check-guards-architecture
pending check-source-contracts
pending check-guards
pending checks-node-changed-compact-large-17
pending check-additional-extension-package-boundary
pending checks-node-compact-small-1
pending checks-fast-baseline-ratchets
pending checks-node-changed-boundary
pending checks-node-changed-extensions-config
pending checks-node-compact-small-2
pending checks-node-changed
pending auto-response
pending openclaw/ci-gate
--- after fix:
REQUIRED CHECK: openclaw/ci-gate (PENDING)
exit=0
IDENTICAL to before fix
Evidence: Excerpt: MergeFi/frontend#803
before fix:
CHECKS: no required check has reported; readiness unconfirmed
after fix:
CHECKS: no required check has reported; readiness unconfirmed
REPORTED CHECK: build-and-lint (FAILURE)
REPORTED CHECK: Vercel (FAILURE)

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.

  • Live validation: ✅ go - 3 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Operator runs fm-pr-state.sh on an open pull request whose base has no required checks and has a failed check; the failure is printed as REPORTED CHECK ✅ pass live live-no-required-checks.txt: MergeFi/frontend#803, xbmc/xbmc#29941 and dubzzz/fast-check#7456 print REPORTED CHECK ... (FAILURE). The base commit printed only the readiness-unconfirmed line.
Pending reported checks on an unprotected base are also surfaced, and the script still exits 0 ✅ pass live live-no-required-checks.txt: fast-check#7456 lists IN_PROGRESS/PENDING checks with exit=0. gh pr checks --json exits 0 even when checks fail or are pending.
Adversarial: a protected-base pull request that has a failing advisory check still reports only required checks (no REPORTED leak) ✅ pass live live-required-checks-unchanged.txt: librariarr#466 has a failing advisory check (code/snyk) that is not printed. On openclaw#175592, only openclaw/ci-gate is printed. Both outputs are IDENTICAL to the…
If the fallback read of reported checks fails, the script refuses with a non-zero exit ⏸️ untested no The prior payload did not establish a live result for this scenario. Making a live gh lookup fail only on the second call is not possible without stubbing gh. Only the repository's stubbed test 'a fai…
  • gh search prs --state open --checks failure filtered to pull requests where gh pr checks --required answers "no required checks reported"
  • Before/after run of bin/fm-pr-state.sh (base 66c300bd vs target 44c5b680) on dubzzz/fast-check#7456, xbmc/xbmc#29941, MergeFi/frontend#803
  • Before/after run of bin/fm-pr-state.sh on protected-base pull requests with advisory failures: ahembree/librariarr#466, openclaw/openclaw#175592
  • gh pr checks &lt;url&gt; --json name,bucket exit status checked with failing checks present (exit 0)
  • bash tests/fm-pr-state.test.sh (all ok, 0 not ok)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Port the reported-check fallback and regressions from df60538. Preserve required-only reporting when required checks exist and refuse failed fallback reads.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @tiago-peixoto. This is a small, well-aimed fix, and the before/after runs on real public PRs make it easy to trust.

Checked head 44c5b680 against main 11990a20: the body says Fixes #7311, and the diff delivers it. The second, unfiltered gh pr checks read runs only on gh's "no required checks reported" answer. It prints failing and pending checks as REPORTED CHECK and hides passing and skipped ones. If that read fails, the script stops loudly. PRs whose required checks have reported keep the old output, so advisory checks stay hidden there. Tests cover all four cases. Live validation is present (3 of 4 scenarios run live; the failing-fallback case is tested with stubs only).

Contract-class: restore. fm-pr-state.sh already promises to surface check readiness. Hiding a failing check on an unprotected (for example stacked) base broke that existing path, and the new lines are additive and clearly labelled REPORTED, not REQUIRED.

VISION.md: One captain: aligns (failures no longer stay invisible). Authority: aligns (reporting only, no new grant). Scripts own mechanics: aligns (exact enumeration in the script). Restart is a non-event: aligns. Delegation with a spine: aligns (validation failures reach the supervisor). Outlives any vendor: aligns (forge adapter no longer buries failures). Scope: aligns.

Status: waiting on CI, nothing needed from you right now. The only red was Behavior portable serial 2, cancelled at the 30-minute ceiling (known infra issue, #7255). I've re-run it once. Everything else is green, including no-mistakes. The PR is MERGEABLE.

@kunchenguid
kunchenguid merged commit 56074d0 into kunchenguid:main Oct 17, 2026
38 of 39 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @tiago-peixoto — really appreciate you taking the time on this.

max-metaplanet added a commit to max-metaplanet/firstmate that referenced this pull request Oct 19, 2026
## Commits taken

- d20196a feat(herdr): opt-in project groups with status tags and a sorted agents view (kunchenguid#7434)
- ce69740 fix(bin): pin LC_ALL=C for remote job process identity reads (kunchenguid#7410)
- 64dddf6 fix(opencode): ignore child stdin EPIPE in guard and encoder (kunchenguid#7447)
- 11becbb fix(bin): ignore crew state overrides for other tasks (kunchenguid#5881)
- eeeeb91 fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (kunchenguid#7415)
- 66c300b feat: support version URLs for watched tool updates (kunchenguid#7449)
- 3094475 fix(pi): keep a live session's extension markers when a nested Pi command loads them (kunchenguid#7287)
- f05b628 fix: reclaim orphaned Claude auto-arm claims (kunchenguid#5939)
- c4f4333 feat(bin): add Polytoken crewmate/scout worker adapter (kunchenguid#7321)
- 11990a2 Fix away branch relaunch admission (kunchenguid#7444)
- 56074d0 fix(bin): show reported checks when a pull request's base requires none (kunchenguid#7450)
- 0791268 fix: support durable per-secondmate account pins (kunchenguid#7452)
- 4e6b9f5 feat(bin): consult operator evidence guards before wedge escalation (kunchenguid#6958)
- c7b7798 fix(bin): make inbox listing succeed when the inbox is empty (kunchenguid#7460)
- 63fc5eb fix: bound remote secondmate convergence and preserve owed re-reads (kunchenguid#7394)
- 8ba34f1 fix: require positive daemon running status in crew-state (kunchenguid#7317)
- 1aa2a21 fix(tests): stabilize supervision host drain and offer fixtures (kunchenguid#7467)
- 69f9d09 fix(bin): refuse spawn into a project with an unborn HEAD (kunchenguid#6987)
- 45dd50a feat(bin): add GitLab --allow-no-pipeline merge waiver and close backlog items for GitLab MRs (kunchenguid#7462)

## Conflict decisions

- `.agents/skills/operational-home-layout/SKILL.md`: Fork seat configuration; upstream per-secondmate account configuration. Decision: Keep both configuration entries.
- `bin/backends/herdr.sh`: Fork send-failure/recovery semantics and harness variable; upstream Polytoken busy override. Decision: Keep fork send-failed and recovery handling; add Polytoken busy identity without losing the fork harness variable.
- `bin/fm-backlog-transition-lib.sh`: Fork cached library directory; upstream GitLab completion support. Decision: Keep cached source path and extend forge ownership comment to GitLab; accept GitLab completion path.
- `bin/fm-config-inherit-lib.sh`: Fork Claude/Codex seat inheritance; upstream Herdr project groups. Decision: Union the allowlist; per-secondmate account pins remain local to the primary home.
- `bin/fm-control.sh`: Fork pre-stop seat checks; upstream per-mate pins and Polytoken launch checks. Decision: Select the per-mate pin while retaining its returned account for seat conflict validation; keep all Polytoken pre-stop checks. A valid explicit pin supersedes the old recorded Claude store on relaunch.
- `bin/fm-harness.sh`: Fork in-process HARNESS_VERDICT result; upstream echo-based Polytoken detection. Decision: Add Polytoken through the fork verdict convention, retaining existing adapter detection.
- `bin/fm-lock.sh`: Fork handover reservation and runtime publication; upstream session re-anchor lease/auto-arm locks. Decision: Share the existing claim lock and release helper, add lease/auto-arm locking, then publish runtime and clear an admitted handover before releasing locks.
- `bin/fm-pr-state.sh`: Fork shared required-check evaluator from dbe11b1 and 91371c8; upstream 56074d0 adds a second gh pr checks fallback. Decision: Keep one evaluator through fm-pr-checks.sh and fm-pr-checks-lib.sh. It already checks non-advisory reported checks on unprotected bases, includes missing configured requirements, and fails closed on read errors. Adapt upstream regressions to this API; preserve the fork REQUIRED CHECK label and advisory policy.
- `bin/fm-spawn.sh`: Fork parked-session resume, seats, unclaimed-worktree guard and ticket hook; upstream Polytoken, per-mate accounts and Herdr groups. Decision: Compose both paths, retain validate_spawn_worktree_unclaimed, seat gates, profile trust and metadata, and both hooks. Extend pin/seat refusal to the selected per-mate pin while retaining the primary-home seat guard. The selected durable Claude pin owns trust and recorded store on relaunch so old seats cannot override it.
- `bin/fm-teardown.sh`: Fork merged-at/park record cleanup and isolation protections; upstream generated Polytoken wiring cleanup. Decision: Keep fork cleanup and guards; add only task-owned Polytoken files and generated untracked wiring to existing guarded teardown.
- `bin/fm-test-run.sh`: Fork timing entries and pipeline-spend suite; upstream Herdr-group and Polytoken suites. Decision: Union suite entries, preserve fork timing measurements for existing suites.
- `bin/fm-wake-lib.sh`: Fork single-read auto-arm ledger parser; upstream session-owner identity fields. Decision: Extend the single-read parser with owner_session_id and the third-line lock identity; retain orphan recovery and lease logic.
- `bin/fm-watch.sh`: Fork bounded run-activity deferral and escalation wording; upstream operator evidence guard. Decision: Keep both bounded deferrals and append operator guard evidence to both ordinary and deep-inspection escalations. Keep exact owned watcher termination semantics.
- `docs/agent-control.md`: Fork seat relaunch policy; upstream per-mate account selection. Decision: Describe both policies with account pin checked before stopping the live agent.
- `docs/configuration.md`: Fork seat sections and ticket timeout; upstream per-mate pins and remote convergence settings. Decision: Keep all sections, place per-mate pins under worker accounts before the seat sections, and retain all timeout entries.
- `tests/fm-control-relaunch.test.sh`: Fork fixture cleanup and seat regressions; upstream account and away-admission regressions. Decision: Keep fixture-scoped cleanup and all regression calls; extend the changed-pin case to check trust in the new store and recorded profile.
- `tests/fm-crew-state.test.sh`: Fork no-fork metadata parsing test; upstream override-identity tests. Decision: Keep both test bodies and calls, plus upstream positive daemon-status cases.
- `tests/fm-pr-merge.test.sh`: Fork named-case local selector; upstream GitLab waiver test definitions. Decision: Place upstream definitions before the named-case selector and retain every case.
- `tests/fm-supervision-host.test.sh`: Fork split helper/suite layout; upstream snapshot-aware offer fixture. Decision: Update the shared supervision-host-helpers.sh implementation and retain its split consumers rather than duplicate the helper in one suite.
- `tests/fm-teardown.test.sh`: Fork collision/released-claim cases; upstream Polytoken cleanup cases. Decision: Keep all regression calls.
- `tests/fm-watch-triage.test.sh`: Fork split classifier/stale/delivery suites; upstream unsplit suite with four new operator-guard cases. Decision: Keep the split and move only new guard fixtures/cases into fm-watch-triage-stale.test.sh; do not resurrect duplicated legacy test bodies.

## Additional integration and verification decisions

- Preserve fork teardown, merge, push, worktree ownership/isolation, and exact-owned watcher termination guards. GitLab no-pipeline waiver remains explicit, attended-only, GitLab-only, and only accepts an explicit null pipeline; default and existing-pipeline safety checks remain in force.
- Existing pull-request CI selects subsets and cannot prove the requested full suite. Add a manual CI workflow trigger using the existing full-suite fallback, so the feature head can run every required lane before landing; document that entry point. No local full suite or real Herdr lifecycle run is authorized.
max-metaplanet added a commit to max-metaplanet/firstmate that referenced this pull request Oct 19, 2026
* feat(herdr): opt-in project groups with status tags and a sorted agents view (kunchenguid#7434)

* feat(herdr): opt-in project groups with status tags and a sorted agents view

Add config/herdr-project-groups (absent or off: unchanged behavior). When on,
Firstmate tags each Herdr task pane, and its own projected workspace, with
display-only fm_group/fm_state/fm_task/fm_sort tokens, sets a Herdr agents
view sorted by group then status (needs-captain, problem, running, done), and
places a new projected task at the end of its own group inside the parent
block with the same single verified move as before.

The watcher reconciles tags once per poll and a spawn tags its task at once;
bin/fm-herdr-groups.sh also previews (plan), clears, and prints or appends
suggested sidebar rows with a backup. The agents view helper needs python3.
The only test-runner change is the serial weight hint for the new suite.

* docs(herdr): record the live lab check of project groups

The four hand checks for tags, the sorted agents view, placement at the
end of the group, and clear passed against a real Herdr 0.9.5 server
(protocol 22) in a guarded lab session.

* docs(herdr): align project group verification notes with the live check

* fix(bin): pin LC_ALL=C for remote job process identity reads (kunchenguid#7410)

ps -o lstart= renders in the caller's locale, so a lock or claim owner
recorded under one locale (de_DE renders "Di Okt 13 ...") failed identity
verification under another, was declared dead, and a second worker split
the queue: two serve loops reclaimed and reaped each other's live jobs,
which vanished mid-claim and failed staged jobs with exit 125 and no
output. Pin LC_ALL=C in fm_remote_job_process_start and pin the
cross-locale invariant with a regression test.

Co-authored-by: researchworldwide2026 <[email protected]>

* fix(opencode): ignore child stdin EPIPE in guard and encoder (kunchenguid#7447)

* fix(bin): ignore crew state overrides for other tasks (kunchenguid#5881)

* Guard fm-crew-state overrides by task-name basename

bin/fm-crew-state.sh honours FM_CREW_STATE_META_OVERRIDE and FM_CREW_STATE_STATUS_OVERRIDE only when the override's basename is the requested task's own .meta or .status file name.
An override naming a different task, for example one inherited through a server started inside another task's snapshot child, falls through to the task's own records under the state directory.
A snapshot's own override, which names the task it was captured for, is still honoured.
This is complementary to kunchenguid#5622, which keeps the overrides out of the Herdr server launch: whatever path leaks an override, the reader never trusts one that names a different task.
Regression tests cover a mismatched override being ignored and a matching one being honoured.

* no-mistakes(review): Make metadata override tests behaviorally distinct

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership (kunchenguid#7415)

* fix(bin): re-anchor a Claude session's lock so /clear keeps ownership

A same-session confirmation over a live lock line 1 outside the current
harness ancestry now rewrites line 1 to the session's CLAUDE_PID anchor
under the claim lock, so a later /clear re-key in the same process is
still proven by ancestry instead of being refused as a foreign owner.

Fixes kunchenguid#6820

* fix(bin): move task leases with a session-lock re-anchor

A same-session re-anchor rewrote lock line 1 off a live pid while task
leases still named that pid, so a lease held by main or the supervision
branch read as stale and the other actor could claim the task. The
re-anchor now takes the lease-command lock after the claim lock and,
in the same critical section as the line-1 write, rewrites leases
recorded against the old pid to the new anchor (fm_lease_rekey_holder).
If the lease-command lock stays busy past a short bound, the
confirmation keeps line 1 as before and a later acquisition re-anchors.

The foreign-owner reproduction now asserts the re-anchor contract: the
same trusted id from a live process outside the owner's ancestry moves
line 1 onto that process's CLAUDE_PID, and a different id is refused
against it afterwards. The ancestry membership loop is shared through
one session-lock lib helper.

The earlier commit dropped the ancestry suite's dead-front-end reclaim
phase; that coverage lives in the existing reclaim tests
(test_verified_reclaim_keeps_new_sidecar and the Stop auto-arm's
test_reclaims_stale_session_lock_before_arming).

* fix(bin): record the lock holder for a lease pinned before a re-anchor

The supervision host pins FM_LEASE_HOLDER_PID to lock line 1 at the
start of each engine turn. A same-session re-anchor inside that turn
moved line 1 to a new pid while the pinned holder stayed alive, so a
later claim or same-actor refresh in the turn recorded the old pid and
the lease read stale, letting main claim the branch's task.

A claim now records the live line 1 when the pinned holder is alive but
is no longer line 1. Another session takes the lock only from a dead
owner, so that state comes from a re-anchor; a dead pin is still
recorded as before and its lease stays stale.

* no-mistakes(review): Move auto-arm rewake session pid with lock re-anchor

* no-mistakes(review): Align startup-network downgrade test and lock-rewrite comment

* no-mistakes(review): Correct lock takeover and re-anchor signal-window comments

* no-mistakes(review): Record re-anchor rewake and pinned-claim verification evidence

* no-mistakes(document): Update network-checks diagnostic for re-anchored lock holder

* feat: support version URLs for watched tool updates (kunchenguid#7449)

* feat(bin): watch a tool's published version through version_url

A watched tool whose CLI never announces its own updates can name a version_url; the document is fetched read-only inside the probe bound, its first dotted number is the published version, and an update is reported when that is newer than the version PATH resolves. Claude Code is the shipped example entry.

* no-mistakes(review): Compare published versions against newest installed tool copy

* no-mistakes(document): Clarify watched-tool version URL documentation

* fix(pi): keep a live session's extension markers when a nested Pi command loads them (kunchenguid#7287)

* fix(pi): keep a live session's extension markers when a nested Pi command loads them

A short-lived Pi command started from inside a live session, such as the
`pi --help` capability probe, auto-loads the two primary extensions. Both
treated the session lock as owned because an ancestor holds it, so the child
rewrote `.pi-watch-extension-loaded` and `.pi-turnend-extension-loaded` with
its own pid and exited. Session start then rejected the markers and printed a
false `PI_WATCH_EXTENSION: not loaded` alarm.

Before writing, each extension now reads the marker's pid and leaves the
marker untouched when that pid is a live strict ancestor of the current
process. A missing marker, a dead pid, the current pid, or a live pid outside
the ancestry still writes as before, so a fresh start and a relaunch over a
dead session bind unchanged. Lock ownership and the reader are untouched.

Fixes kunchenguid#5202.

* fix(tests): drop apostrophes from the nested-load marker heredocs so stock Bash 3.2 parses them

* fix: reclaim orphaned Claude auto-arm claims (kunchenguid#5939)

* fix(bin): supersede an orphaned Claude auto-arm claim after a session restart

An auto-arm claim is open only while its owner still descends from the session-lock pid.
A hook whose session exited mid-cycle stays alive with no parent to receive its exit 2, so deferring to its claim left the home unsupervised until the next session turn.
The replacement session's first Stop now takes the next generation, attaches to the running watcher, and delivers the wake itself, while the orphan goes silent.
A claim with no readable numeric session lock is never open.

* no-mistakes(review): accept pid-1 ancestor and session-id-matched autoarm claims

* no-mistakes(review): pin autoarm session-id claim signal to lock holder pid

* no-mistakes(review): exercise real lock recovery in orphan supersession tests

* no-mistakes(review): record lock-holder pid-identity instead of bare pid

* no-mistakes(document): complete autoarm claim-open coverage list

* no-mistakes(ci): Greptile finding ci-1 (hidden session-lock dependency in bin/fm-wake-lib.sh) fixed. Invariant: every function fm-wake-lib.sh calls must either be defined in that file or explicitly loaded by it before the call, so a caller sourcing only the wake library cannot silently degrade. Violating sites in the changed area: fm_autoarm_claim_open's fm_session_lock_recorded_session_id call, and the sibling writer fm_autoarm_claim_next's fm_session_lock_trusted_session_id call (which would otherwise silently omit the two new ledger fields). Both fixed at one shared boundary: a new lazy loader _fm_wake_require_session_lock (bin/fm-wake-lib.sh:38), matching the file's existing _fm_wake_require_classify/_fm_wake_require_timeout idiom, invoked immediately before each call. Lazy rather than top-level source so the ~40 scripts sourcing the wake library pay no harness-identity machinery cost; no circularity (fm-session-lock-lib.sh sources only fm-cursor-lib.sh). No new behaviour, state, or fallback. Verification: sourcing only fm-wake-lib.sh, a claim with broken ancestry plus matching sidecar id and matching recorded lock-holder identity now reads OPEN and the session-lock library is loaded on demand; ordinary descent path unaffected. Suites tests/fm-claude-stop-autoarm.test.sh, tests/fm-turnend-guard.test.sh, tests/fm-wake-queue.test.sh all pass; shellcheck -S warning reports only the pre-existing SC2034 present on HEAD. tests/fm-session-lock-ancestry.test.sh fails its final case ("the pty-host was not reparented to init after the daemon ended") identically with the change reverted, so that failure is a pre-existing WSL environment behaviour, not caused by this fix

* no-mistakes(document): Clarify auto-arm claim documentation

* feat(bin): add Polytoken crewmate/scout worker adapter (kunchenguid#7321)

* wip: polytoken worker adapter (detection, launch, wiring, control, composer; tests mid-iteration)

* feat: verify the polytoken worker adapter (crewmate + scout)

Add polytoken 0.8.19 as a verified crewmate/scout adapter on the
captain-approved TUI-pane-plus-REST hybrid: the pane keeps inspection
and backend parity while the control verbs ride the session daemon's
typed REST API.

Detection is ancestry alone on the anchored polytoken comm (a tool
subprocess's parent is the session daemon, verified live), with the
launch boundary clearing every foreign ORCA_/FM_ marker plus the fixed
harness-identity set. The launch generates the per-task worker config
dir (mirrored operator config with the unattended permission posture
enforced, because a project config.yaml fully replaces the global
config), the worker role-contract facet (no model pin, delegation and
facet switching denied at the tool registry), and the worktree hook
layer binding the verified busy pair - pre_user_prompt and
pre_model_turn open, stop closes - to a no-argv generated writer. The
readiness gate binds the session id, port, and credential into task
metadata through sessions --format json and fails loudly on any
first-start dialog, because the license terms are a blocker by captain
decision and --accept-license-terms is never passed.

Interrupt is POST /turn/cancel with its typed settle (the TUI has no
interrupt chord, so no key is ever improvised), exit is /quit, and a
cancelled turn's busy close is written by the control plane because no
stop hook fires. The composer is the verified separated shape with
polytoken as its second owner, and Enter mid-turn queues, so the
busy-queued conversion applies. Crewmate and scout only: a secondmate
launch is refused, and a project's own .polytoken/hooks.json is refused
rather than clobbered.

* no-mistakes(review): Fix polytoken launch flag order, token argv, live guard

* no-mistakes(document): Correct polytoken REST doc comment and token-on-stdin invariant

* no-mistakes(lint): Silence intentional SC2016 in polytoken live guard treehouse shim

* no-mistakes(review): Retire polytoken pool wiring, drop FIFO config, test env clearing

* no-mistakes(review): Scope polytoken teardown wiring removal to untracked polytoken files

* no-mistakes(review): Refuse existing polytoken hook layer before writing any wiring

* no-mistakes(document): Note teardown as consumer of harness wiring-path table

* no-mistakes(review): Retire only firstmate-generated polytoken worktree wiring

* no-mistakes(review): Guard polytoken hook layer before relaunch cleanup arms

* no-mistakes(document): Note relaunch also skips git-tracked wiring paths

* test: stub polytoken in the refused-relaunch fixture

The refused relaunch onto polytoken resolves the polytoken binary before
its hook-layer refusal, so the case failed on CI hosts without the real
CLI installed. A no-op stub on the fixture PATH stands in; it is never
launched.

* no-mistakes(review): Guard polytoken interrupt close; refuse whitespace hook paths

* no-mistakes(review): Snapshot busy record after cancel settles before idle close

* no-mistakes(review): Guard interrupt close with pre-cancel snapshot and sync recheck

* no-mistakes(test): Clear inherited AGENT at the polytoken launch boundary

* no-mistakes(document): Document guarded polytoken interrupt close and whitespace refusal

* test: preserve Polytoken hook refusal coverage with explicit pins

* no-mistakes(review): Refuse invalid Polytoken relaunch profiles before stopping the worker

* no-mistakes(document): Document Polytoken relaunch refusals before stopping the worker

* fix: scope worker wiring cleanup to Polytoken

* fix(bin): point Polytoken workers away from tool_flow for the task directory

Polytoken 0.9.0 offers no launch-time path grant: tool_flow's file_read
refuses the Firstmate task directory while the direct file tools reach it
under the generated bypass matcher. The worker facet now says so, and the
verification record carries the live evidence.

* fix(bin): leave the pool as found when a fresh spawn fails

A fresh spawn that fails and leaves no task record now closes the endpoint
it opened before its launch was delivered, so the shell whose treehouse get
leases the slot ends and the pool gets the slot back. It also removes the
harness wiring, task temp root, and staged launch file it wrote, and drops
its slot claim under a retaken project lock after metadata publication.

* no-mistakes(review): Stop pre-launch refusals pointing at windows abort cleanup closes

* fix(bin): scope failed-spawn cleanup and the Running-for busy row to Polytoken

The failed-spawn pool cleanup and the Running-for busy row now apply only to
Polytoken, so every other harness keeps main's abort behavior, header text,
operator messages, and harness-less busy union. Tests prove the Polytoken
path cleans up and a non-Polytoken refused launch behaves as on main.

* no-mistakes(review): Scope submit-core busy reads to Polytoken pane identity

* no-mistakes(review): Stop polytoken treehouse isolation refusal pointing at closed window

* test: track the spawned window in the Polytoken harness tmux stand-in

Main now requires exact tmux window membership before sending keys
(aa9ab04), and the Polytoken harness stand-in listed no windows, so the
merged spawn could never deliver Enter. Record the created window, list
it, and forget it on kill, as tests/fixtures.sh does.

* no-mistakes(document): Scope fresh-endpoint abort comment to Polytoken spawns

* no-mistakes(ci): Lint 1 (ci-3) was caused by this PR, and I fixed it. Commit d18014e added the in_polytoken_submit_pane() subshell helper to tests/fm-polytoken-harness.test.sh. That helper sources bin/fm-tmux-lib.sh without the `# shellcheck source=/dev/null` line that every other source in the file carries (lines 55-63 and 200). With --external-sources, ShellCheck followed the library into the subshell and flagged `local pid=$!` at line 690 as SC2031. The fix is that one missing line, added above the source at line 318. After the fix, `shellcheck -x` reports nothing on the file, `bin/fm-lint.sh tests/fm-polytoken-harness.test.sh` passes with full extended analysis, and the Polytoken harness test passes. Behavior portable serial 2 (ci-1) and serial 5 (ci-2) failed in timing-sensitive tests this PR does not touch, so I made no code change for them. I reran both test files in full on this branch on macOS, and both passed (rc=0, no failures). tests/fm-supervision-host.test.sh passed, including the 'host-only transition veto changed Pi's existing offer rule' check that failed in CI. tests/fm-remote-secondmate-lifecycle-e2e.test.sh passed, including 'watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake'. Main's own recent CI runs (38950070853, 38719784765) also failed on different timing assertions in these serial shards. Together that points to runner flakes rather than a defect in this change

* no-mistakes(review): Retake per-id spawn lock before Polytoken abort deletions

* no-mistakes(document): Document per-id lock guard on Polytoken abort cleanup

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* Fix away branch relaunch admission (kunchenguid#7444)

* fix(bin): show reported checks when a pull request's base requires none (kunchenguid#7450)

Port the reported-check fallback and regressions from df60538. Preserve required-only reporting when required checks exist and refuse failed fallback reads.

* fix: support durable per-secondmate account pins (kunchenguid#7452)

* fix(tests): clean read-only relaunch fixtures

Use the shared fixture cleanup so generated read-only Git hook directories do not leave permission errors and temporary trees behind.

* fix(accounts): support durable per-secondmate account pins

Resolve optional primary-home secondmate account files through the worker pin parser and checks. Preserve existing defaults when no override exists and re-read the selected pin on spawn, relaunch, and recovery.

* no-mistakes(review): Name the rejected pin file in account refusals

* no-mistakes(document): Document per-secondmate account pins in relaunch and layout docs

* feat(bin): consult operator evidence guards before wedge escalation (kunchenguid#6958)

* feat(watch): consult opt-in operator guards before a wedge escalation

Add config/wedge-evidence-guards, an opt-in list of operator-owned guard
executables that the watcher's at-threshold wedge branch consults after the
wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL
answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX
consecutive deferrals recorded beside the other wedge-window records, and
the escalation that ends a capped run names the guard and its reason.
Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an
untrusted config or guard is never run. With the config absent the ladder is
unchanged.

Refs kunchenguid#6919

* no-mistakes(document): Document wedge-evidence-guards in home layout index

* no-mistakes(document): Align jev-guards CRITICAL verdict with bounded deferral

* fix(bin): make inbox listing succeed when the inbox is empty (kunchenguid#7460)

* fix(bin): make the brief's inbox listing succeed on an empty inbox

The worker brief told crewmates to list the inbox with a bare *.msg glob.
On an empty inbox that glob fails: bash ls exits 2 and zsh aborts with
'no matches found'. Use find piped to sort -V so the listing is silent on an
empty or absent inbox and keeps numeric order past 999.

Refs kunchenguid#7244

* no-mistakes(review): Make relaunch note inbox listing safe when empty

* fix: bound remote secondmate convergence and preserve owed re-reads (kunchenguid#7394)

* fix(bin): fit remote second-mate convergence inside the startup network bound

The deferred startup network stage (120s) timed out once four second mates
were remote: the mates already converge concurrently, but each mate's
inheritance push sent its fifteen allowlisted items one SSH round trip after
another, so a single mate's convergence took 64-76s after a ~16s liveness
pass.

- fm-remote-inherit-push.sh validates and snapshots every item locally first,
  so a local refusal now sends nothing, then sends the items up to
  FM_REMOTE_INHERIT_PUSH_JOBS (default 4) at a time and replays their output in
  allowlist order. A failed item still fails the push with its own error, and
  no further item is started after it. The receiver is unchanged: each item is
  its own file and generation record, and the host's job worker still runs one
  home's commands one at a time.
- fm-bootstrap.sh gives each remote mate's convergence its own budget,
  FM_SECONDMATE_CONVERGENCE_TIMEOUT (default 75s). A mate whose sync or push
  hits it is reported as that mate's SECONDMATE_SYNC skip and keeps its retry
  marker, instead of holding the whole stage past its bound.

* fix(bin): nudge a remote second mate to re-read only when something changed

Each remote convergence attempt records its retry marker before it starts,
so a sweep cut off by the startup network bound or failing before any change
left a marker that made the next session start nudge every remote mate even
though its instructions and inherited files were unchanged. The marker now
records whether a re-read is owed, set only once an attempt actually changed
the home, and a tracked-file sync that moved nothing under AGENTS.md, bin/,
or .agents/skills/ no longer counts as a change.

* fix(bin): keep a remote mate's re-read owed when its convergence is cut short

A convergence step stopped by the per-mate budget loses its output, so a
push that had already applied an item reported nothing and left the retry
marker with no re-read owed; the next start then saw every item unchanged
and never told the mate to re-read. A step cut off by the budget now marks
the re-read owed, and so does a failed push whose output shows items it had
already pushed or removed.

The lifecycle e2e suite runs every remote leg through the real entrypoint
and job worker on the test machine, so it now gives convergence ample time;
the budget's own behavior is pinned in fm-bootstrap-network-parallel, whose
budget and failure cases are also made independent of machine load.

* no-mistakes(review): Keep re-read owed on partial or unknown completion

* no-mistakes(review): Persist owed re-read when killed mid-mutation

* no-mistakes(document): Fix stale remote re-read owed docs

* test: send inherited items one at a time in the remote lifecycle e2e fixture

Behavior portable serial 5 failed on the watcher auto-relaunch leg of
tests/fm-remote-secondmate-lifecycle-e2e.test.sh after the inheritance push
started overlapping its sends. Across 14 recent main CI runs that suite's
remote-spawn leg took 30.8-35.6s and the watcher leg 27.3-34.5s, already close
to its 30s wait; on the PR run remote spawn took 42.1s, well outside that range,
while legs that push nothing were only 5-10% slower. The wa