Skip to content

feat: allow configurable TypeSafe dispatch base URLs (#7957) - #8192

Merged
kunchenguid merged 11 commits into
kunchenguid:mainfrom
WTF-Am-ID:fm/up-fm-7957
Nov 6, 2026
Merged

kunchenguid merged 11 commits into
kunchenguid:mainfrom
WTF-Am-ID:fm/up-fm-7957

Conversation

@WTF-Am-ID

@WTF-Am-ID WTF-Am-ID commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Written by Codex and reviewed by Claude Opus through no-mistakes.

An earlier cancelled no-mistakes Test phase executed runtime checks on the Mac in deviation from the CI-box-only instruction.

Intent

Ok go find 5 more firstmate issues we can close and start working on them

Context: this task is one of the five picks from that selection, issue #7957. The selection report's entry for it:

P5. Allow an explicit TypeSafe base URL

Issue: #7957

Problem: TS_BASE is hard-coded, preventing an otherwise supported gateway from receiving the typed dispatch request.

Home value: data/learnings.md:5 establishes that the primary home uses typed dispatch and its declared credential source.
Gateway demand is generic.
No local gateway, Vercel account, or paid-plan need was established.

Acceptance evidence: maintainer triage welcomes the setting and specifies precedence, URL validation, default preservation, and documentation.
The class is opt-in.
The reporter supplied the live gateway proof already.
Our contribution can validate URL construction with synthetic fixtures, without acquiring an account or reproducing that live integration.

Competing-work check: the final 7957 in:title,body query returned [].
The TYPESAFE_BASE in:title,body mechanism query also returned [].
No author-history, backlog, or earlier-ranked-pick exclusion matches.

Source evidence: bin/fm-dispatch-resolve.sh:156 still fixes the base to the direct service.
Line 284 constructs the TypeSafe endpoint from that value.
tests/fm-dispatch-resolve.test.sh already uses fake curl and isolated configuration for credential/environment precedence.

Likely files: bin/fm-dispatch-resolve.sh, tests/fm-dispatch-resolve.test.sh, and docs/configuration.md.
Reuse bin/fm-env-lib.sh rather than adding another configuration reader.

Closure test: fake curl records the destination and returns a canned valid typed response.
Unset configuration must keep the direct default.
An explicit environment value must override a fixture dotenv value.
A valid custom base with a path and trailing slash must produce exactly one /v1/systemone suffix.
Unsupported schemes, userinfo, queries, and fragments must refuse before any request.
An invalid setting must give a configuration error rather than silently selecting the default.
Keep provider/key selection and private-key transport unchanged.
Run bin/fm-test-run.sh tests/fm-dispatch-resolve.test.sh and the documentation audience check.
Use synthetic fixture credentials only.

Test step: do not execute tests or probes on this machine. Verify only that the cited CI-box console (sha256 12d7b50f...) ran at this exact head with PROOF_EXIT=0, and report that.

The cited CI-box console is /tmp/up-fm-7957-resume.KuT9Zp/ls-up7957-export-console.txt, SHA256 12d7b50f550c624f363065338cf45cf1b954fa27aa1332a4da9af328d6495361. The exact head is 31bccc2. It records the previous suite failing with TYPESAFE_BASE exported, the candidate focused suite and documentation audience check passing, PROOF_EXIT=0, and deletion of the disposable guest.

What Changed

  • Added TYPESAFE_BASE with environment-over-.env precedence, the existing default, and trailing-slash normalization before appending /v1/systemone.
  • Reject invalid TypeSafe URLs before credential lookup and disable curl URL expansion for dispatch requests.
  • Documented the setting and added synthetic coverage for URL validation, precedence, endpoint construction, and private-key transport.

Risk Assessment

✅ Low: Opt-in setting with default preserved, validation runs before credential lookup in both TypeSafe arms, other providers and key transport are untouched, and the latest commit only isolates the suite from an exported TYPESAFE_BASE.

Testing

Verified the existing CI-box evidence only, as instructed. It records the baseline regression and successful candidate checks. No local tests, probes, file changes, scratch files, or background processes were created.

  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Inherited TYPESAFE_BASE does not contaminate the focused suite's default-endpoint assertions ⏸️ untested no The archived evidence records the regression and successful candidate run. The explicit test ruling prohibits local execution, and archived tests are not live validation in this run.
Configure TypeSafe bases while preserving validation, provider selection, and private-key transport ⏸️ untested no The hash-verified console records synthetic-fixture checks at the exact candidate revision. No product execution occurred in this run because the explicit ruling permits evidence inspection only.
Documentation passes the required audience check ⏸️ untested no The exact-head archived check succeeded. It was not rerun, as required by the evidence-only test ruling.
Evidence: Verified archived CI-box console
SHA256=12d7b50f550c624f363065338cf45cf1b954fa27aa1332a4da9af328d6495361
CANDIDATE_HEAD=31bccc22fcd5302c124efbffda56be9b026f74db
BASELINE_EXIT=1
FOCUSED_EXPORTED_EXIT=0
DOC_AUDIENCE_EXIT=0
=== PROOF_EXIT 0
=== deleted ls-up7957-export
  • Outcome: ⚠️ 1 warning across 1 run (1m14s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-dispatch-resolve.sh:270 - The TYPESAFE_BASE configuration error lists userinfo, query, fragment, whitespace, and path brackets, but the validator also rejects backslashes, out-of-range ports (1-65535), and invalid bracketed IPv6 hosts, which docs/configuration.md:1968-1969 documents. A user setting TYPESAFE_BASE=https://gateway.example:99999 or https://[abc] gets a message that does not name the actual cause. Extend the message to mention backslash, port range, and IPv6 host (still without echoing the rejected value).
⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (0 of 3 scenarios were driven live against the product); untested: Inherited TYPESAFE_BASE does not contaminate the focused suite's default-endpoint assertions, Configure TypeSafe bases while preserving validation, provider selection, and private-key transport, Documentation passes the required audience check
  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Inherited TYPESAFE_BASE does not contaminate the focused suite's default-endpoint assertions ⏸️ untested no The archived evidence records the regression and successful candidate run. The explicit test ruling prohibits local execution, and archived tests are not live validation in this run.
Configure TypeSafe bases while preserving validation, provider selection, and private-key transport ⏸️ untested no The hash-verified console records synthetic-fixture checks at the exact candidate revision. No product execution occurred in this run because the explicit ruling permits evidence inspection only.
Documentation passes the required audience check ⏸️ untested no The exact-head archived check succeeded. It was not rerun, as required by the evidence-only test ruling.
  • git rev-parse HEAD confirmed 31bccc22fcd5302c124efbffda56be9b026f74db.
  • git status --short showed a clean worktree.
  • git diff 3b00a81ef932eafc462447076767c6b7622f773f 31bccc22fcd5302c124efbffda56be9b026f74db -- tests/fm-dispatch-resolve.test.sh confirmed the follow-up adds unset TYPESAFE_BASE.
  • shasum -a 256 /tmp/up-fm-7957-resume.KuT9Zp/ls-up7957-export-console.txt matched the supplied digest.
  • Read the cited console and verified baseline failure, exact-head focused-suite success, documentation-check success, PROOF_EXIT 0, and disposable guest deletion.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Issues

Closes #7957

@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; the previous test-isolation issue is fixed.

Reviews (4) · Last reviewed commit: "test: isolate dispatch base from exporte..." · Reviewed by Greptile

Comment thread bin/fm-dispatch-resolve.sh Resolved
Comment thread bin/fm-dispatch-resolve.sh Resolved
…ses 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
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @WTF-Am-ID. This is my first look, at head 7811c22b against main b77b66cb.

What I checked: select_typesafe_base and the --globoff change in bin/fm-dispatch-resolve.sh, the TYPESAFE_BASE docs in docs/configuration.md, and the new resolver tests. The shape matches the issue triage. The environment wins over .env, the default stays https://api.typesafe.ai when unset, a rejected value exits 2 before key lookup without echoing the value, and trailing slashes are stripped before /v1/systemone. Greptile's two P2s (invalid ports or bracketed hosts, and curl URL globbing) are fixed and resolved. The attestation binds this head with no skipped steps, the quick checks pass, and the branch merges cleanly. There are no workflow or credential-handling changes beyond the new base.

Contract-class: opt-in. Nothing changes unless TYPESAFE_BASE is set. VISION: it aligns. The setting is captain-owned and off by default, and it keeps the fleet from depending on a single access path to one vendor.

Waiting on you for two things:

  1. Live evidence. The Test step reports live validation as inconclusive, with 0 of 4 scenarios driven, because your probe was blocked. Since this URL receives the TypeSafe key, I'd like to see the real resolver and real curl run against a disposable localhost endpoint with a synthetic key. Please show that: (a) unset or empty keeps the default destination; (b) a custom base with a path and a trailing slash gets exactly one request at <base>/v1/systemone, and the environment beats .env; (c) invalid values (bad scheme, userinfo, query or fragment, bad port, [/] in the path) exit 2 and send nothing; (d) the key still travels only on the fd header. Post that evidence here, or re-raise through no-mistakes with live validation at go.
  2. Test evidence for this head. The CI-box console in the body covers 0e8f7b1d, and the 7811c22b commit message says the CI-box tests and the documentation audience check were not re-run after the malformed-address and globbing fixes. A focused run of tests/fm-dispatch-resolve.test.sh plus the doc audience check at the current head (or the same no-mistakes re-raise) covers this.

The red "Full suite" check is our label gate, so you don't need to do anything about it. Thanks again, this is close.

@WTF-Am-ID WTF-Am-ID changed the title feat: allow a custom TypeSafe dispatch base URL feat: allow a custom TypeSafe base URL for dispatch (#7957) Nov 6, 2026
Comment thread tests/fm-dispatch-resolve.test.sh Resolved
@WTF-Am-ID

Copy link
Copy Markdown
Contributor Author

The requested path-bracket refusal is implemented, and review also narrowed host validation so Docker-style names such as typesafe_gateway are accepted. The current candidate is 3b00a81ef932eafc462447076767c6b7622f773f. It preserves the published commits and keeps --globoff on both curl paths.

The exact candidate passed the focused resolver suite, documentation audience check and all 47 live cases in one disposable Ubuntu 24.04.5 KVM guest, running as the existing ubuntu user (uid 1000). These checks executed the unchanged resolver and real /usr/bin/curl 8.5.0 with synthetic credentials. The localhost HTTP/TLS endpoints existed only inside that guest, which the protected runner deleted afterward.

Requested case Observed result
(a) Unset, empty environment and empty dotenv Each made exactly one request with URL https://api.typesafe.ai/v1/systemone and Host api.typesafe.ai. The no-key case stayed off with zero requests.
(b) Custom base, path and trailing slashes Each made one request with one appended /v1/systemone suffix. Environment beat dotenv; empty environment fell back to dotenv. A braces-only path remained literal with globbing disabled.
(c) Invalid values Bad scheme, userinfo, query, fragment, bad port, malformed bracketed host, paired path brackets and either lone path bracket all exited 2 before sending. All 36 combinations across environment/dotenv and key/no-key passed without echoing rejected values.
(d) Private-key transport All ten real curl descendants used -H @/dev/fd/3 with fd 3 open. The synthetic key was absent from curl argv and environment and matched the Authorization header received by the endpoint. Logs redact it.
Underscore acceptance http://typesafe_gateway:43263/service/ produced exactly one request to http://typesafe_gateway:43263/service/v1/systemone, with Host typesafe_gateway:43263.

For default HTTPS, a guest-only curl config mapped api.typesafe.ai:443 to the guest's local TLS endpoint using an ephemeral CA. The underscore service name used the same guest-only transport mapping to localhost. These mappings preserved the actual constructed URLs and Host headers. Other custom bases used localhost directly. No fake curl, resolver modification, external model request, host service or system trust/hosts-file change was involved.

Current-head console totals:

EXACT_CANDIDATE=3b00a81ef932eafc462447076767c6b7622f773f
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=21357
FOCUSED_EXIT=0
fm-doc-audience-check: ok surfaces=141 local_links=1188
DOC_AUDIENCE_EXIT=0
{"endpoint_requests":10,"failed":0,"fd_transport_cases":10,"invalid_no_request_cases":36,"live_cases":47,"live_result":"PASS"}
LIVE_EXIT=0
PROOF_EXIT=0

The full current-head console below contains all case results and the redacted request transcript. It also records the exact clone path, commands' output, image, runner and source hashes, and guest deletion. The commands were bash bin/fm-test-run.sh tests/fm-dispatch-resolve.test.sh, bash bin/fm-doc-audience-check.sh and the bounded real-curl fixture.

The earlier 7811c22b evidence gap was also closed by an exact-revision protected Debian guest run: both focused tests and the audience check passed with zero failures or skipped gates. Its complete console is included separately below. The later bracket regression was reproduced against that baseline before fixing it. No full suite was run or full-ci label added.

Full current-head box console and live transcript: 3b00a81
=== runner ls-proof-run.sh a1e02205dfc1eb46e634fb03ff2e96a0882bf3bc11d5021e8841c6f18443e339
=== source af9d0b636574499dc64797e5143e2e640167aa87b6a3cdd42e192cc1ea11d399  /home/fmagent/up7957-3b00-source.tar.gz
=== guest script cc445b7acb8859ec16a75799978e75aa4107ead90c6e03714b7cd97c53981cd1  /home/fmagent/up7957-3b00-guest.sh
=== launch 2026-11-06T00:40:39Z ci-bench-202610201338 ls-up7957-3b00-live project ls-ci-scratch as_user=ubuntu
=== ready wait up to 180s for root growth to finish
=== ready obs 1 t=0s ready=1 uptime=3.80 unit=loaded/inactive/dead result=success job=none exit_mono=2979472 exit_status=0 root=/dev/sda2 disk=/dev/sda part=2 kernel_bytes=21368913408 ondisk_bytes=21368913408 root_avail=18409291776
=== ready obs 2 t=1s ready=1 uptime=4.88 unit=loaded/inactive/dead result=success job=none exit_mono=2979472 exit_status=0 root=/dev/sda2 disk=/dev/sda part=2 kernel_bytes=21368913408 ondisk_bytes=21368913408 root_avail=18409291776
=== ready after 1s
=== host_boot 56499120-68e6-43e9-b731-4cb022666369 guest_boot 00484659-872e-49c6-b3a5-a56408bb9b38
=== guest PRETTY_NAME="Ubuntu 24.04.5 LTS"
=== guest VERSION_ID="24.04"
=== guest kvm
=== guest systemd
=== running as ubuntu uid=1000 gid=1000 home=/home/ubuntu
=== PROOF_EXIT 0
--- stdout
PROOF_USER=ubuntu UID=1000
EXACT_CANDIDATE=3b00a81ef932eafc462447076767c6b7622f773f
FM_TEST_BEGIN 2026-11-06T00:40:51Z tests/fm-dispatch-resolve.test.sh family=standalone expected_gate_skip=none
ok - invalid preferred_provider: null
ok - invalid preferred_provider: false
ok - invalid preferred_provider: 42
ok - invalid preferred_provider: []
ok - invalid preferred_provider: {}
ok - invalid preferred_provider: ""
ok - invalid preferred_provider: "Codex"
ok - invalid preferred_provider: "codex\\n"
ok - invalid preferred_provider: " codex"
ok - preferred provider: astra-82-claude-26
ok - preferred provider: work-account
ok - preferred provider: exhausted
ok - preferred provider: unknown
ok - preferred provider: unknown-one-known-one
ok - preferred provider: claude-only
ok - preferred provider: config-override
ok - preferred provider: prose-why
ok - preferred provider: absent
ok - preferred provider: approval
ok - preferred provider: tie
ok - preferred provider: floor
ok - absent key is off: one stderr line, exit 0, no network call
ok - TYPESAFE_API_KEY= in .env activates the tool; environment and config overrides work
ok - clear: one rule Choice request, key on the fd header only, spendPriority argmax over every candidate
ok - TypeSafe base supports environment and .env overrides and rejects unsafe URLs before sending
ok - OpenRouter clear uses the same output contract and keeps its key out of argv and child environments
ok - OpenRouter ambiguous, malformed, HTTP, and missing-model paths are handled
ok - mapping: a declared macos-keychain service and optional account become the lookup, and the key rides the fd header
ok - precedence: environment, then .env, then the declared source, which is read only when needed
ok - provider isolation: each provider reads only its own declared service, and a declaration never selects a provider
ok - effective-home isolation: only the effective config directory's declaration is consulted
ok - failure distinctions: off, a configuration error, and an unavailable source each read differently and send nothing
ok - secret containment: the declared key is on no argv, in no output, environment, or file, and only on the fd header
ok - capability probe: supported or unsupported, with no declaration read and no credential tool run
ok - with no provider set, other providers' settings leave the original off line unchanged
ok - systemone posts the unchanged request to its base URL with an optional fd-3 key
ok - systemone configuration errors, never-send base URL, partial response, and transport failure are handled
ok - openai maps the Choice request to the Decisions API and its answer back, key on fd 3 only
ok - the never-send check runs on the final openai request body
ok - openai malformed, partial, refused, ambiguous, HTTP, and transport paths return to normal intake
ok - never-send list withholds the request on a match or a bad list, and never prints the value
ok - rules snapshots and shell quoting preserve the profile protocol
ok - quota_scope binds an agy candidate to its declared tier row
ok - no-rule fallback, Agy, Gemini, and documented configurations resolve
ok - ambiguous: confidence below the fixed floor hands the decision back
ok - per-rule confidence floors fall to the most probable runner-up that clears its own floor
ok - only the brief's task sections and scout tag reach the model, with a whole-brief fallback
ok - escalate: a rule declared approval: captain never yields a profile
ok - rule floor: known shortfall falls through while unavailable evidence escalates
ok - declared provider and profile floor evidence are applied in code
ok - nonnumeric spendPriority evidence is never ranked
ok - partial and missing quota evidence remain eligible but unranked
ok - provider-wide and exact quota rows combine into one limiting candidate
ok - default: no rule matched resolves among the default profiles
ok - tie: equal spendPriority never breaks by array order
ok - no rankable candidate: the tool escalates instead of guessing
ok - native Codex binds to codex-home before default, independently of Pi accounts and row order
ok - Pi native adapters bind to codex-home with existing fallbacks and schema 5 compatibility
ok - schema 6: each candidate binds to its account row; schema 5 is unchanged
ok - quota evidence comes from one quota-axi --json read, and its failure is an error outcome
ok - API, transport, and response failures are error outcomes with exit 0
ok - configuration errors exit 2 before any network call
ok - shared-quota opt-out: no quota snapshot, deterministic declared-order pick, opt-out stated on every candidate
ok - shared-quota bypasses an unmet rule-level floor: the rule's own profile wins with no quota call
ok - shared-quota bypasses an unmet profile-level floor: the first declared profile wins with no quota call
ok - shared-quota keeps preferred_provider narrowing: the preferred family wins in declared order with no quota call
ok - shared_quota false keeps the unchanged quota-ranked behavior
# all fm-dispatch-resolve tests passed
FM_TEST_END 2026-11-06T00:41:12Z tests/fm-dispatch-resolve.test.sh exit=0 duration_ms=21316 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=21357
FM_TEST_SUMMARY_FAMILY family=standalone count=1 duration_ms=21316 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-dispatch-resolve.test.sh duration_ms=21316
FOCUSED_EXIT=0
fm-doc-audience-check: ok surfaces=141 local_links=1188
DOC_AUDIENCE_EXIT=0
LIVE_HEAD=3b00a81ef932eafc462447076767c6b7622f773f
REAL_CURL=curl 8.5.0 (x86_64-pc-linux-gnu) libcurl/8.5.0 OpenSSL/3.0.13 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 (+libidn2/2.3.7) libssh/0.10.6/openssl/zlib nghttp2/1.59.0 librtmp/2.3 OpenLDAP/2.6.10
TRANSPORT: HTTP cases use localhost directly; default HTTPS authority is mapped to localhost with a guest-only curl config and ephemeral CA. No fake curl or resolver changes.
{"case": "S1-unset", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S1-empty-environment", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S1-empty-dotenv", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S1-no-key", "exit": 0, "requests": 0, "result": "PASS"}
{"case": "S2-path", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S2-trailing", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S2-braces-globoff", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S2-dotenv", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S2-environment-wins", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S2-empty-falls-to-dotenv", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S2-underscore-service", "exit": 0, "requests": 1, "result": "PASS"}
{"case": "S3-scheme-environment-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-scheme-environment-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-scheme-dotenv-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-scheme-dotenv-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-userinfo-environment-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-userinfo-environment-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-userinfo-dotenv-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-userinfo-dotenv-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-query-environment-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-query-environment-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-query-dotenv-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-query-dotenv-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-fragment-environment-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-fragment-environment-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-fragment-dotenv-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-fragment-dotenv-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bad-port-environment-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bad-port-environment-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bad-port-dotenv-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bad-port-dotenv-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bad-host-environment-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bad-host-environment-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bad-host-dotenv-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bad-host-dotenv-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-pair-environment-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-pair-environment-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-pair-dotenv-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-pair-dotenv-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-open-environment-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-open-environment-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-open-dotenv-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-open-dotenv-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-close-environment-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-close-environment-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-close-dotenv-no-key", "exit": 2, "requests": 0, "result": "PASS"}
{"case": "S3-bracket-close-dotenv-key", "exit": 2, "requests": 0, "result": "PASS"}
S4: every successful request used @/dev/fd/3; the synthetic key was absent from real curl argv and environment, and matched only the received Authorization header.
REQUEST_LOG_REDACTED
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S1-unset", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "https://api.typesafe.ai/v1/systemone"}, "host": "api.typesafe.ai", "method": "POST", "path": "/v1/systemone"}
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S1-empty-environment", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "https://api.typesafe.ai/v1/systemone"}, "host": "api.typesafe.ai", "method": "POST", "path": "/v1/systemone"}
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S1-empty-dotenv", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "https://api.typesafe.ai/v1/systemone"}, "host": "api.typesafe.ai", "method": "POST", "path": "/v1/systemone"}
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S2-path", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "http://127.0.0.1:43263/typesafe/v1/systemone"}, "host": "127.0.0.1:43263", "method": "POST", "path": "/typesafe/v1/systemone"}
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S2-trailing", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "http://127.0.0.1:43263/nested/proxy/v1/systemone"}, "host": "127.0.0.1:43263", "method": "POST", "path": "/nested/proxy/v1/systemone"}
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S2-braces-globoff", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "http://127.0.0.1:43263/tenant/{a,b}/v1/systemone"}, "host": "127.0.0.1:43263", "method": "POST", "path": "/tenant/{a,b}/v1/systemone"}
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S2-dotenv", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "http://127.0.0.1:43263/dotenv/v1/systemone"}, "host": "127.0.0.1:43263", "method": "POST", "path": "/dotenv/v1/systemone"}
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S2-environment-wins", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "http://127.0.0.1:43263/environment/v1/systemone"}, "host": "127.0.0.1:43263", "method": "POST", "path": "/environment/v1/systemone"}
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S2-empty-falls-to-dotenv", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "http://127.0.0.1:43263/dotenv/v1/systemone"}, "host": "127.0.0.1:43263", "method": "POST", "path": "/dotenv/v1/systemone"}
{"authorization": "Bearer <redacted>", "authorization_matches_synthetic_key": true, "case": "S2-underscore-service", "choice_request": true, "curl": {"binary": "/usr/bin/curl", "fd3_open": true, "fd_header_argument": true, "globoff": true, "key_absent_from_argv": true, "key_absent_from_environment": true, "private_key_names_absent": true, "url": "http://typesafe_gateway:43263/service/v1/systemone"}, "host": "typesafe_gateway:43263", "method": "POST", "path": "/service/v1/systemone"}
{"endpoint_requests": 10, "failed": 0, "fd_transport_cases": 10, "invalid_no_request_cases": 36, "live_cases": 47, "live_result": "PASS"}
LIVE_EXIT=0
--- stderr
Cloning into '/tmp/up7957-3b00-proof.syLBSX/repo'...
Note: switching to '7811c22bad4ef737e00fdd7bab95a08f4ae67b4b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

From /opt/src/up7957-3b00-delta.bundle
 * branch              FETCH_HEAD -> FETCH_HEAD
Previous HEAD position was 7811c22b 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
HEAD is now at 3b00a81e no-mistakes(document): Clarify TypeSafe base URL documentation
=== deleted ls-up7957-3b00-live
=== scratch now: 
Full earlier-head box console: 7811c22
=== runner ls-proof-run.sh 01752dd8824ac5d0719be750a25b6db565014cfdee964b0a49fe25e37bea1b2b
=== source 7e33fc00ff371baa43f18779bf6cd701ee52f97d90264b35fa4a565bdc7d0a4f  /home/fmagent/up7957-7811-verified.tar.gz
=== guest script b53c439467f5b0dec42c01f4f3fe5040cc393ca01032f1e7761be420d1d9bd26  /home/fmagent/up7957-7811-guest.sh
=== launch 2026-11-05T16:58:42Z images:debian/13 ls-up7957-7811 project ls-ci-scratch
=== ready wait up to 180s for root growth to finish
=== ready obs 1 t=0s ready=0 uptime=3.71 unit=loaded/inactive/dead result=success job=112 exit_mono=0 exit_status=0 root=/dev/sda2 disk=/dev/sda part=2 kernel_bytes=4189044224 ondisk_bytes=4189044224 root_avail=3223130112
=== ready obs 2 t=1s ready=1 uptime=4.80 unit=loaded/inactive/dead result=success job=none exit_mono=4220760 exit_status=0 root=/dev/sda2 disk=/dev/sda part=2 kernel_bytes=21368913408 ondisk_bytes=21368913408 root_avail=19874557952
=== ready obs 3 t=2s ready=1 uptime=5.90 unit=loaded/inactive/dead result=success job=none exit_mono=4220760 exit_status=0 root=/dev/sda2 disk=/dev/sda part=2 kernel_bytes=21368913408 ondisk_bytes=21368913408 root_avail=19874553856
=== ready after 2s
=== prep dpkg_exit=0
=== prep git-man_1%3a2.47.3-0+deb13u1_all.deb
=== prep git_1%3a2.47.3-0+deb13u1_amd64.deb
=== prep jq_1.7.1-6+deb13u4_amd64.deb
=== prep libbrotli1_1.1.0-2+deb13u1_amd64.deb
=== prep libbz2-1.0_1.0.8-6_amd64.deb
=== prep libcom-err2_1.47.2-3+b12_amd64.deb
=== prep libcrypt1_1%3a4.4.38-1_amd64.deb
=== prep libcurl3t64-gnutls_8.14.1-2+deb13u7_amd64.deb
=== prep libdb5.3t64_5.3.28+dfsg2-9_amd64.deb
=== prep liberror-perl_0.17030-1_all.deb
=== prep libffi8_3.4.8-2_amd64.deb
=== prep libgdbm-compat4t64_1.24-2_amd64.deb
=== prep libgdbm6t64_1.24-2_amd64.deb
=== prep libgmp10_2%3a6.3.0+dfsg-3_amd64.deb
=== prep libgnutls30t64_3.8.9-3+deb13u4_amd64.deb
=== prep libgssapi-krb5-2_1.21.3-5+deb13u1_amd64.deb
=== prep libhogweed6t64_3.10.1-1_amd64.deb
=== prep libidn2-0_2.3.8-2_amd64.deb
=== prep libjq1_1.7.1-6+deb13u4_amd64.deb
=== prep libk5crypto3_1.21.3-5+deb13u1_amd64.deb
=== prep libkeyutils1_1.6.3-6_amd64.deb
=== prep libkrb5-3_1.21.3-5+deb13u1_amd64.deb
=== prep libkrb5support0_1.21.3-5+deb13u1_amd64.deb
=== prep libldap2_2.6.10+dfsg-1_amd64.deb
=== prep liblzma5_5.8.1-1+deb13u2_amd64.deb
=== prep libnettle8t64_3.10.1-1_amd64.deb
=== prep libnghttp2-14_1.64.0-1.1+deb13u1_amd64.deb
=== prep libnghttp3-9_1.8.0-1_amd64.deb
=== prep libngtcp2-16_1.11.0-1+deb13u1_amd64.deb
=== prep libngtcp2-crypto-gnutls8_1.11.0-1+deb13u1_amd64.deb
=== prep libonig5_6.9.9-1+b1_amd64.deb
=== prep libp11-kit0_0.25.5-3_amd64.deb
=== prep libperl5.40_5.40.1-6+deb13u1_amd64.deb
=== prep libpsl5t64_0.21.2-1.1+b1_amd64.deb
=== prep librtmp1_2.4+20151223.gitfa8646d.1-2+b5_amd64.deb
=== prep libsasl2-2_2.1.28+dfsg1-9_amd64.deb
=== prep libsasl2-modules-db_2.1.28+dfsg1-9_amd64.deb
=== prep libssh2-1t64_1.11.1-1+deb13u2_amd64.deb
=== prep libssl3t64_3.5.7-1~deb13u3_amd64.deb
=== prep libtasn1-6_4.20.0-2+deb13u1_amd64.deb
=== prep libunistring5_1.3-2_amd64.deb
=== prep libzstd1_1.5.7+dfsg-1_amd64.deb
=== prep openssl-provider-legacy_3.5.7-1~deb13u3_amd64.deb
=== prep perl-modules-5.40_5.40.1-6+deb13u1_all.deb
=== prep perl_5.40.1-6+deb13u1_amd64.deb
=== prep xz-utils_5.8.1-1+deb13u2_amd64.deb
=== prep zlib1g_1%3a1.3.dfsg+really1.3.1-1+b1_amd64.deb
=== host_boot 56499120-68e6-43e9-b731-4cb022666369 guest_boot e3fd877b-fe50-434f-9fc3-28b1d89c77a6
=== guest PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
=== guest VERSION_ID="13"
=== guest kvm
=== guest systemd
=== PROOF_EXIT 0
--- stdout
EXACT_CANDIDATE=7811c22bad4ef737e00fdd7bab95a08f4ae67b4b
FM_TEST_BEGIN 2026-11-05T16:59:03Z tests/fm-dispatch-resolve.test.sh family=standalone expected_gate_skip=none
ok - invalid preferred_provider: null
ok - invalid preferred_provider: false
ok - invalid preferred_provider: 42
ok - invalid preferred_provider: []
ok - invalid preferred_provider: {}
ok - invalid preferred_provider: ""
ok - invalid preferred_provider: "Codex"
ok - invalid preferred_provider: "codex\\n"
ok - invalid preferred_provider: " codex"
ok - preferred provider: astra-82-claude-26
ok - preferred provider: work-account
ok - preferred provider: exhausted
ok - preferred provider: unknown
ok - preferred provider: unknown-one-known-one
ok - preferred provider: claude-only
ok - preferred provider: config-override
ok - preferred provider: prose-why
ok - preferred provider: absent
ok - preferred provider: approval
ok - preferred provider: tie
ok - preferred provider: floor
ok - absent key is off: one stderr line, exit 0, no network call
ok - TYPESAFE_API_KEY= in .env activates the tool; environment and config overrides work
ok - clear: one rule Choice request, key on the fd header only, spendPriority argmax over every candidate
ok - TypeSafe base supports environment and .env overrides and rejects unsafe URLs before sending
ok - OpenRouter clear uses the same output contract and keeps its key out of argv and child environments
ok - OpenRouter ambiguous, malformed, HTTP, and missing-model paths are handled
ok - mapping: a declared macos-keychain service and optional account become the lookup, and the key rides the fd header
ok - precedence: environment, then .env, then the declared source, which is read only when needed
ok - provider isolation: each provider reads only its own declared service, and a declaration never selects a provider
ok - effective-home isolation: only the effective config directory's declaration is consulted
ok - failure distinctions: off, a configuration error, and an unavailable source each read differently and send nothing
ok - secret containment: the declared key is on no argv, in no output, environment, or file, and only on the fd header
ok - capability probe: supported or unsupported, with no declaration read and no credential tool run
ok - with no provider set, other providers' settings leave the original off line unchanged
ok - systemone posts the unchanged request to its base URL with an optional fd-3 key
ok - systemone configuration errors, never-send base URL, partial response, and transport failure are handled
ok - openai maps the Choice request to the Decisions API and its answer back, key on fd 3 only
ok - the never-send check runs on the final openai request body
ok - openai malformed, partial, refused, ambiguous, HTTP, and transport paths return to normal intake
ok - never-send list withholds the request on a match or a bad list, and never prints the value
ok - rules snapshots and shell quoting preserve the profile protocol
ok - quota_scope binds an agy candidate to its declared tier row
ok - no-rule fallback, Agy, Gemini, and documented configurations resolve
ok - ambiguous: confidence below the fixed floor hands the decision back
ok - per-rule confidence floors fall to the most probable runner-up that clears its own floor
ok - only the brief's task sections and scout tag reach the model, with a whole-brief fallback
ok - escalate: a rule declared approval: captain never yields a profile
ok - rule floor: known shortfall falls through while unavailable evidence escalates
ok - declared provider and profile floor evidence are applied in code
ok - nonnumeric spendPriority evidence is never ranked
ok - partial and missing quota evidence remain eligible but unranked
ok - provider-wide and exact quota rows combine into one limiting candidate
ok - default: no rule matched resolves among the default profiles
ok - tie: equal spendPriority never breaks by array order
ok - no rankable candidate: the tool escalates instead of guessing
ok - native Codex binds to codex-home before default, independently of Pi accounts and row order
ok - Pi native adapters bind to codex-home with existing fallbacks and schema 5 compatibility
ok - schema 6: each candidate binds to its account row; schema 5 is unchanged
ok - quota evidence comes from one quota-axi --json read, and its failure is an error outcome
ok - API, transport, and response failures are error outcomes with exit 0
ok - configuration errors exit 2 before any network call
ok - shared-quota opt-out: no quota snapshot, deterministic declared-order pick, opt-out stated on every candidate
ok - shared-quota bypasses an unmet rule-level floor: the rule's own profile wins with no quota call
ok - shared-quota bypasses an unmet profile-level floor: the first declared profile wins with no quota call
ok - shared-quota keeps preferred_provider narrowing: the preferred family wins in declared order with no quota call
ok - shared_quota false keeps the unchanged quota-ranked behavior
# all fm-dispatch-resolve tests passed
FM_TEST_END 2026-11-05T16:59:23Z tests/fm-dispatch-resolve.test.sh exit=0 duration_ms=20171 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=20210
FM_TEST_SUMMARY_FAMILY family=standalone count=1 duration_ms=20171 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-dispatch-resolve.test.sh duration_ms=20171
FOCUSED_EXIT=0
fm-doc-audience-check: ok surfaces=141 local_links=1188
DOC_AUDIENCE_EXIT=0
--- stderr
Cloning into '/opt/check'...
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
Note: switching to '7811c22bad4ef737e00fdd7bab95a08f4ae67b4b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

=== deleted ls-up7957-7811
=== scratch now: 

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @WTF-Am-ID — the live evidence on 3b00a81e is exactly what I needed. All 47 cases passed in the disposable guest with real curl: default base, custom base/path/trailing-slash and env-over-dotenv precedence, invalid values exiting 2 before any request without echoing, private-key fd-header transport, and underscore Docker-style hosts. Path-bracket refusal and the narrowed host validation are in. Focused resolver suite and doc audience check passed on this head. The attestation binds with every step completed, quick checks pass, and the branch merges cleanly with main 8b1618a4. Contract-class: opt-in. VISION aligns.

Waiting on you for Greptile's open P2 (unresolved threads block the Full suite):

  • tests/fm-dispatch-resolve.test.sh — "Exported settings break tests". If an operator has TYPESAFE_BASE exported, the .env / default-base cases inherit it and fail. Please clear TYPESAFE_BASE at suite startup (before cases set their own values), resolve the thread, and re-raise through no-mistakes so the attestation binds the new head.

The red Full suite check is our label gate.

@WTF-Am-ID WTF-Am-ID changed the title feat: allow a custom TypeSafe base URL for dispatch (#7957) feat: allow configurable TypeSafe dispatch base URLs (#7957) Nov 6, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @WTF-Am-ID — 31bccc22 clears TYPESAFE_BASE at suite startup (unset TYPESAFE_BASE), and Greptile's P2 thread is resolved. The attestation binds this head with every step completed, prior 47/47 live guest-curl evidence still covers the product path, quick checks pass, and the branch merges cleanly with main 65a9a51f (a couple commits behind from an unrelated merge — ours if anything). Contract-class: opt-in. VISION aligns (fleet-outlives-vendor / authority). Greptile is 5/5.

Next: the author work is done. The next step is ours: we run the Full suite, and if it's green this can land as an opt-in. The red Full suite check before then is our label gate, so there's nothing for you to fix there.

@kunchenguid kunchenguid added the full-ci Maintainer go-ahead: run the full CI suite on this outside pull request label Nov 6, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: adding full-ci so the Full suite runs on 31bccc22. Contract-class opt-in — auto-merge-if-Full-green.

@kunchenguid

Copy link
Copy Markdown
Owner

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

@kunchenguid
kunchenguid merged commit 998c19f into kunchenguid:main Nov 6, 2026
36 of 37 checks passed
trillium added a commit to trillium/firstmate that referenced this pull request Nov 7, 2026
* fix: sync record exports with empty overrides and hidden state files (kunchenguid#8188)

* fix: refresh owner lease before detached process-event launches (kunchenguid#8191)

* Refresh owner presence before detached process-event startup

* no-mistakes(review): Correct lease documentation and CI evidence claims

* fix: recover remote inheritance after sender counter loss (kunchenguid#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

* feat: support explicit GitHub branch updates before merging (kunchenguid#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: clean up Perl timeout processes on interruption (kunchenguid#7922)

* 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

* fix: prevent watcher marker collisions between endpoints (kunchenguid#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: stabilize extension orphan recovery readiness (kunchenguid#8210)

* 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

* feat: allow configurable TypeSafe dispatch base URLs (kunchenguid#7957) (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

* fix(bin): refresh stale remote refs before teardown refuses landed work (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

* Record upstream merge resolution evidence

* no-mistakes(ci): I fixed the three failing CI shards with a test-only 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

---------

Co-authored-by: Tiago <[email protected]>
Co-authored-by: WTF Am I Doing ? <[email protected]>
Co-authored-by: jazz127 <[email protected]>
Co-authored-by: Laszlo Horanszky <[email protected]>
Co-authored-by: jbarol <[email protected]>
Co-authored-by: Trillium Smith <[email protected]>
kayis-rahman pushed a commit to kayis-rahman/firstmate that referenced this pull request Nov 8, 2026
… (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
lstutzman referenced this pull request in lstutzman/firstmate Nov 9, 2026
…, PR merge hardening) (#191)

* fix: recover remote inheritance after sender counter loss (#8104) (#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

* feat: support explicit GitHub branch updates before merging (#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: clean up Perl timeout processes on interruption (#7922)

* 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

* fix: prevent watcher marker collisions between endpoints (#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: stabilize extension orphan recovery readiness (#8210)

* 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

* feat: allow configurable TypeSafe dispatch base URLs (#7957) (#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

* fix(bin): refresh stale remote refs before teardown refuses landed work (#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

* fix(bin): bind crewmate spawns to the recorded dispatch selection (#8262)

* fix(spawn): bind launch flags to dispatch selection

* no-mistakes(review): Bind spawn to resolver-recorded dispatch selection

* no-mistakes(review): Bind spawn to per-task dispatch resolution record

* no-mistakes(document): Document relaunch exemption and fix task record heading

* no-mistakes(ci): Fixed the selected Greptile findings ci-2 and ci-3. Changes are left uncommitted in the worktree. ci-2 rule: a spawn under a clear recorded dispatch selection launches only that selection unless the task records an override. A raw launch command (a full command line instead of a harness name) keeps its own --model/--effort options, so matching flags beside it proved nothing. bin/fm-spawn.sh now refuses any raw launch command under a clear record unless --dispatch-override <reason> is given. The error message now says "with no raw launch command". This check gates both the single-task path and the batch path. Raw commands under ambiguous/escalate/error/off records still work, so the manual path is unchanged. ci-3 rule: the resolver writes the task record where fm-spawn.sh reads it, which is FM_DATA_OVERRIDE, else $FM_HOME/data. bin/fm-dispatch-resolve.sh used to look for a folder literally named "data". It now records only when the brief is <data root>/<id>/brief.md, comparing real directory paths. As a side effect, a data/<id>/ folder outside the configured root no longer gets a record. The resolver header comment and docs/configuration.md now describe the override. Tests added: - tests/fm-spawn-dispatch-profile.test.sh: the reviewer's case is refused (record selects claude/haiku/low; raw command "claude --model opus --effort high" with --model haiku --effort low). The same command launches with an override, and the reason is saved in the .meta file. - tests/fm-dispatch-resolve.test.sh: a brief under FM_DATA_OVERRIDE gets its record. A data/ folder outside the configured root does not. The existing task-record test now puts its brief under $FM_HOME/data. Verification: both full suites passed locally. For the spawn suite I put the real Python and Node install folders ahead of mise's wrapper scripts on PATH, because those wrappers fail on this host when a test changes HOME. That is a host problem, not a product defect. Shellcheck shows only info notes about sourced files it was not asked to follow. I did not run the new tests against the old code. From reading the old checks, each would have failed there. ci-1 and ci-4 were not touched, because the user chose to ignore both

* fix(procevent): stop launch confirmation starving the runner it awaits (#8265)

A runner needs the source lock to claim. ensure-listening and reconcile
both polled that lock every 50ms while waiting for the claim, so on a
loaded host the confirmation competed with the launch it was confirming.
At a load average near 50 a healthy runner claimed in 1.0-1.7s under a
lock-free observer and took 3.3-5.6s under ensure-listening, past the
default confirm window.

The miss was not harmless. arm then retired its own registration, half of
the arms in a twelve-run sample failed on a correct board, and a later
ensure-listening reported the source as not registered. reconcile announced
a launch failure for a source that was starting normally.

Take the lock only once a claim file exists, since until then there is
nothing to confirm. The same sample then armed twelve of twelve. The
regression test holds a runner just before its first lock acquisition and
asserts nothing else takes the lock, so it does not depend on timing.

Co-authored-by: Frederik Hagelund <[email protected]>

* fix: restore Claude supervision after API-error turn ends (#8134)

* fix(bin): re-arm supervision on Claude StopFailure so error-ended turns are not blind

A Claude turn that ends on an API error runs no Stop phase, so the
Stop-owned auto-arm never fired and the home had no watcher coverage
until external input (observed as 15h and 4.7h blind gaps). Claude
2.1.317 fires StopFailure for those turn ends and honors the same
asyncRewake/exit-2 rewake as Stop, verified live on a herdr-hosted
primary: the tracked auto-arm under StopFailure armed a real watcher,
delivered the queued wake as an unprompted turn, and the chained error
end was suppressed by the new per-cooldown rewake bound instead of
storming.

* no-mistakes(review): Pace StopFailure continuations instead of dropping

* no-mistakes(review): Recheck AFK and need after StopFailure pacing

* no-mistakes(document): Document StopFailure supervision continuity

* no-mistakes(ci): Normalized the validated StopFailure cooldown to base 10. Updated the behavioral pacing regression to use 08 after a cooldown marker exists; it failed before the fix and passes afterward. Full auto-arm test suite, Bash syntax checks, and git diff --check pass. Changes remain local; nothing published

* no-mistakes(ci): Fixed the watcher-lock test’s flaky STOP-and-scan synchronization by pausing at the lock-free poll sleep. Full watcher-lock suite, repeated focused regressions, Bash syntax, and diff checks pass. Full suite failure was downstream of the shard failure. Changes remain local; nothing published

* fix: prevent Codex Stop hook JSON contamination (#7231)

* fix: keep Codex Stop responses free of login-shell output

* no-mistakes(document): Consolidate Codex Stop documentation under authoritative owners

* no-mistakes(ci): Fixed both Pi before_agent_start handlers to narrow prompt-bearing events before accessing event.prompt, addressing the two TS2339 CI errors. Custom events now bypass user-prompt handling; ordinary prompt events and existing message_start paths remain unchanged. Local verification is blocked: tsc is not on PATH. No tools were installed and no other pipeline phases were executed

* fix: keep Codex Stop responses free of login-shell output

* no-mistakes(document): Consolidate Codex Stop documentation under authoritative owners

* no-mistakes(document): Correct Codex verification prerequisites and guard coverage

* fix(calm): leave one blank row above the Claude Code working boat (#7253)

* fix(calm): leave one blank row above the Claude Code working boat

Refs #7160

* no-mistakes(review): Assert spinner Box padding by walking tree

* fix(bin): refuse to relaunch a worker into a primary home or checkout (#8127)

* fix(spawn): refuse to relaunch a worker into a primary home or checkout

A relaunch trusted the recorded worktree and started the worker there. After a machine restart the restored record could point at the primary home or a repository's primary checkout, so a worker was relaunched inside it. Relaunch now refuses with a named error when the recorded worktree is the home, the code root, or a repository's primary checkout (git dir equals git common dir).

* no-mistakes(document): Document relaunch refusal of primary home or checkout worktrees

* no-mistakes(ci): Fixed ci-2 (the Greptile P1 finding). ci-1, the Full suite failure, is the expected maintainer-label gate; the user chose to leave it alone, so nothing was changed for it. Invariant: the relaunch refusal must judge whether the recorded worktree is a primary checkout from the directory's own layout on disk. Inherited Git location variables must not be able to change the answer. In this change, the only place that probes Git for that decision is the git-dir and common-dir check in the `--relaunch` refusal in `bin/fm-spawn.sh`. The home and code-root comparison doesn't use git, so it can't be affected. Fix in `bin/fm-spawn.sh`: both probes now run in a single subshell. That subshell first unsets the same Git variables that `bin/fm-claude-trust.sh` clears (`GIT_DIR`, `GIT_WORK_TREE`, `GIT_COMMON_DIR`, `GIT_OBJECT_DIRECTORY`, `GIT_INDEX_FILE`, `GIT_ALTERNATE_OBJECT_DIRECTORIES`, `GIT_CEILING_DIRECTORIES`, `GIT_NAMESPACE`, `GIT_DISCOVERY_ACROSS_FILESYSTEM`, `GIT_CONFIG*`). It then runs one `git rev-parse --path-format=absolute --git-dir --git-common-dir` and splits the two output lines. The unset is scoped to the subshell, so the environment the rest of the script and the launched worker see is unchanged. When git fails, the result is empty and the code falls through exactly as before. Regression test in `tests/fm-control-relaunch.test.sh`: `test_relaunch_refuses_the_primary_checkout_under_inherited_git_overrides`. It records `worktree` as the project's primary checkout, then runs `fm-spawn --relaunch` with `GIT_DIR` set to the linked worktree's git directory and `GIT_WORK_TREE` set to the primary checkout. It asserts exit code 1, the "primary home or checkout" error, and that nothing was launched. The test is registered in the suite's run list. Verification: - `bash tests/fm-control-relaunch.test.sh` with the fix: rc=0, all tests pass, including the new one. - With the `fm-spawn.sh` change temporarily reverted: rc=1, and the new test fails with `missing: 'primary home or checkout'`. So it reproduces the reported bypass. - `shellcheck` on both files reports no warnings or errors

---------

Co-authored-by: Trillium Smith <[email protected]>

* fix(bin): read session-lock owner identity without the ps binary (#7609)

* fix(session-lock): read process identity without the ps binary

An EDR-style policy can deny the ps binary's exec itself - observed on
a hardened macOS host where /bin/ps was refused even for 'ps -V', while
kill, head, sysctl, pgrep and lsof all ran. The session lock proved
identity by walking harness ancestry through ps, so the walk died at
its first call: every session in that home became a permanent
lock-refused read-only one, and a live lock owner looked reclaimable,
so a fresh process could take over a lock whose owner was still
running.

All identity reads now go through one fm_proc_info reader. ps stays
primary and is used verbatim wherever it executes, so a host where ps
works is byte-identical to before. Only a ps that cannot execute at
all - bash exit 126 for a refused exec, 127 for a missing binary,
while a pid merely being gone exits ps 1 - routes one read to an OS
provider: /proc on Linux, bin/fm-procinfo.py on macOS, which reads the
ppid through a self-verified KERN_PROC_PID chain and the identity
through the KERN_PROCARGS2 argv region.

That last point is a correctness requirement, not a preference. macOS
'ps -o comm=' reports argv[0] and 'ps -o args=' reports the full argv,
so the ps-free route keys both fields on the same argv region. A
helper that reported the resolved exec path instead disagreed with ps
for renamed, symlinked, or argv[0]-wrapped harnesses, and that
disagreement turns a lock refusal into a wrong take-ownership decision.

Every read fails closed and is verified against the requested pid: no
route guessing, foreign chains still refused, dead pids still stop the
walk. A record that is not exactly one line of three fields with a
numeric ppid is refused rather than loosely sliced.

Two defects found by diffing the change against the unchanged base on
a live host are fixed here as well:

1. A pid ps can see but cannot name - a live process whose comm was
   emptied - was reported as stale, which means reclaimable. The base
   reports unknown for that case, and reporting it stale let a fresh
   process take over a lock whose owner was still running. The ps route
   now reports the pid as present, and the provider route accepts a
   record whose comm field is legitimately empty so both routes agree.

2. The provider record parser rejected a record with an empty field,
   but the field COUNT is what it must pin: a TAB is IFS whitespace, so
   a record with a MISSING field parsed exactly like a record whose
   field was empty. The parser now rebuilds the record from the parsed
   fields and compares it to the original, which proves the count
   without rejecting a legitimate empty field.

Verified against the unchanged base: 120 identity reads and 200 lock
inspections across live pids show zero divergence, and the empty-comm
case reads unknown on both.

* no-mistakes(review): Refuse reclaiming session locks with unreadable owner identity

* no-mistakes(review): Reject partial process identity reads; reclaim non-pid locks

* no-mistakes(review): Preserve platform process identity byte rendering across routes

* no-mistakes(review): Normalize trailing empty argv elements across identity providers

* no-mistakes(document): Document session-lock recovery requirements

* no-mistakes(lint): Fix ShellCheck arithmetic array index style

* fix(session-lock): decide the owner verdict from liveness first, not identity

The review rounds that closed the "a live owner can be taken over" hole
inverted the order of the two facts the verdict is built from: the
provider read decided whether the recorded owner was alive, and liveness
was only consulted afterwards. That order breaks two cases the base
already handled.

A pid this session cannot signal is not a live owner it may reclaim
over, whatever a process table still says about it. A recorded owner
that is gone therefore has to read as gone, or the stale lock can never
be reclaimed and the session stays lock-refused read-only for good -
the exact wedge this change exists to remove. The repository's own
suites pin that: tests/fm-session-lock-ancestry.test.sh asserts that a
recorded pid whose kill -0 fails is left for the ordinary reclaim, and
tests/fm-session-lock-ancestry.test.sh's sibling case asserts that a
recorded pid of 1 - which this session may not signal - is still
reclaimable.

The verdict now asks liveness first and identity second:

  kill -0 succeeds, the provider reads   -> readable
  kill -0 succeeds, the provider fails   -> unreadable: alive, identity
                                            not readable, so the lock
                                            must not be reclaimed
  kill -0 fails, the provider reads      -> unknown: the process exists
                                            but this session may not
                                            signal it, so it is not a
                                            harness this session can
                                            prove - the base's "no live
                                            harness owner"
  kill -0 fails, the provider fails      -> dead

That keeps the protection the review rounds were after - a live owner
whose identity cannot be read is never reclaimable - while restoring the
base's reclaim behaviour for the cases the base handled. The new case
"kill -0 succeeds, the provider fails" is the one that closes the
reported takeover path, and it is unchanged.

Verified on this host: tests/fm-session-lock-ancestry.test.sh exits 0
again (it exits 1 on the previous head, where the recorded-dead-pid case
failed), tests/fm-session-lock-ps-denied.test.sh exits 0, and
tests/fm-gotmp.test.sh exits 0. tests/fm-secondmate-harness.test.sh and
tests/fm-session-start.test.sh still exit 1 with exactly the failures
they have on the unchanged base: this host's restricted PATH lacks
dirname, cat and awk.

* no-mistakes(review): Preserve successful status for unreadable owner verdicts

* fix(session-lock): keep the ppid a walk input, not an identity field

The review round that made a partial identity read refuse the reclaim
extended the rule from the arguments to the parent pid as well: a read
that could not answer ps -o ppid= was treated as an unreadable
identity, so the whole read failed.

The parent pid is not an identity field. The identity the matcher reads
is comm and args, and both of those are still fail-closed: a live
harness whose arguments cannot be read is not reduced to a bare
interpreter name, and its lock is still not reclaimable. The parent pid
is a walk input, and a parent pid that cannot be read only ends the
ancestry walk one hop early - the walk finds no harness and the
session refuses the lock rather than taking one it cannot prove, which
is the conservative direction.

The base read the parent pid exactly this tolerant way, and the
repository's own suites pin it: tests/fm-grok-harness.test.sh and
tests/fm-kimi-harness.test.sh stub ps so that it answers comm= and
args= and refuses every other question, and both expect the lock to be
recognised as held by a live harness. Under the stricter rule both
suites failed with "fm-lock did not recognize grok as a live holder"
and "fm-lock did not acquire from Kimi ancestry".

The provider route is unchanged and stays all-or-nothing: on Linux the
parent pid comes from the same /proc read as the command name, and on
macOS from the same KERN_PROC_PID chain, so a provider read is either
complete or unreadable. The case that proves it - a /proc entry with no
readable cmdline - still refuses the reclaim.

The new test case is corrected rather than dropped: the failed-args
case still has to refuse the reclaim, and the failed-ppid case now
pins the tolerant contract - the verdict stays readable and the parent
pid is empty.

The same commit restores the shellcheck directives on the assignments
inside fm_session_lock_inspect's verdict switch. The globals are read
by bin/fm-lock.sh and bin/fm-inbox.sh, but the assignments inside the
switch had lost their disable comments, so 'Lint 1' failed with SC2034
on FM_LOCK_INSPECT_STATE and FM_LOCK_INSPECT_LIVE_HARNESS.

Verified on this host: tests/fm-session-lock-ps-denied.test.sh exits 0,
tests/fm-session-lock-ancestry.test.sh exits 0,
tests/fm-grok-harness.test.sh exits 0 (it exits 1 before this commit),
tests/fm-kimi-harness.test.sh exits 0 (it exits 1 before this commit),
tests/fm-gotmp.test.sh exits 0, and bin/fm-lint.sh exits 0.

* no-mistakes(document): Clarify session-lock recovery ownership

* no-mistakes(lint): Fix single-iteration ShellCheck loop

* test(session-lock): drop the unused loop variable from the partial-identity case

The failed-args case no longer runs through a loop, so the local that
held the field name is never read, and the lint partition reports it as
an unused variable (SC2034). The declaration loses it; nothing else
about the case changes.

* no-mistakes(review): Protect tagged lock owners; preserve Cygwin identity reads

* no-mistakes(review): Fix zero-form locks; focused tests fail pty-host, ShellCheck warnings

* fix(session-lock): read a classified live harness holder as held

fm_session_lock_inspect lost its identity check on the readable verdict,
so every live holder was classified unknown instead of held: grok and
kimi holders failed the live-holder assertions, and a claude-named
holder made fm-inbox report unknown for a lock that was held.

Decide held from the single fm_harness_process_matches call on the
readable branch. The Windows-tagged pre-block that made the same
decision a second time is removed: fm_session_lock_pid_verdict already
resolves the tagged pid through the Windows table and leaves the same
FM_PROC_COMM/FM_PROC_ARGS, so re-reading it could only let the two
answers diverge, and its winpid/win_rc were the unused bindings
ShellCheck flagged as SC2034.

* no-mistakes(document): Align session-lock docs with the shared reclaim verdict

* fix(session-lock): emit the denied-ps diagnostic once per run

`FM_OS_PROC_DIAG_SHOWN` was set by the diagnostic inside
`triple=$(fm_os_proc_triple "$pid")`, so it died with that
command-substitution subshell and every later ancestor read reprinted the
same cause during one lock acquisition.

`fm_proc_info` now spends the once-per-run guard in the shell that owns
the walk. A cause line exists only on the provider's failure routes, so a
failed read is exactly where that budget is used up; a readable read
leaves it unspent for a later failure.

The new case drives three failing reads in one shell and asserts one
stderr line, then repeats with a readable first pid to prove a successful
read does not spend the budget.

* no-mistakes(document): Correct the denied-ps diagnostic scope to per shell

* no-mistakes(review): Preserve UTF-8 process identity in Linux fallback

* no-mistakes(document): Record the ps-free identity byte rule and helper inventory

* test(session-lock): compare control-byte argv by shape, not by ps bytes

The control-byte route-equivalence case compared the provider record and
the ps record byte for byte. That pins one procps build's choice of byte
for a control byte: 4.0.x writes a space where an argument's newline was
and '?' for other controls, while other builds write '?' for the newline
too, so the same two routes agree on one build and differ on the other
even when both make the same identity decision.

Fold each route's separator byte onto the placeholder the /proc route
writes before comparing, keep the ppid and comm fields a raw comparison,
and assert the fixture's words still straddle the control bytes on both
routes so the case cannot pass by matching a loss. Pin the fold against
both Linux renderings of this fixture's newline and assert those
renderings really differ, so a return to raw bytes fails here instead of
only on the other procps build.

* no-mistakes(document): Align session-lock reclaim docs with the shared verdict

* test(session-lock): keep the base PATH when no python3 shim is added

The e2e blocked-ps case built the child PATH from fakebin alone on a host
without python3, dropping the inherited base path with it. On Linux that
left the /proc provider without the cat and tr it reads through, so the
walk failed for a reason unrelated to the denied ps and the case failed
spuriously on exactly the host it is meant to cover.

Set the base path unconditionally and let the python3 branch only insert
the shim ahead of it.

* no-mistakes(document): Correct session-lock verdict comments and library ownership header

* no-mistakes(document): Correct stale issue pointer in session-lock scope comment

* no-mistakes(document): Correct malformed-lock reclaim wording and ps-denied nudge limit

* fix(session-lock): parse /proc stat fields as stat_fields so rex.sh lints clean

ShellCheck follows source directives: bin/backends/rex.sh sources
bin/fm-agent-process-lib.sh, which sources bin/fm-session-lock-lib.sh, so the
new array local named `fields` made rex.sh's string use of its own `fields`
read as an array/string clash (SC2178/SC2128) and failed CI lane Lint 2 on
6e26ecb, while main's same lane passes.

Rename the array to stat_fields, the name the repo's other /proc stat readers
(bin/fm-remote-job-lib.sh, bin/fm-teardown.sh) already use. Verified with
`shellcheck --norc --external-sources bin/backends/rex.sh` (was rc=1, now
rc=0) and `bin/fm-lint.sh --partition 2of2` locally (rc=0, rex.sh reason=ok).

* no-mistakes(document): Sync session-lock docs and stat-parser comment

* test(run): hint fm-session-lock-ps-denied so the coverage guard stays under its unmeasured share

The new session-lock denial script left 43 of 284 portable serial scripts
without a measured duration hint on CI (main: 42), one past the guard's 15%
bound. Record the 3012ms this run measured, in sorted order beside its
ancestry sibling.

* fix(bin): keep every custom check wake line and payload before acknowledgement (#8031)

* fix(watch): print multi-line check output as one wake line

A custom check that printed several lines queued one row with the lines
joined, but the watcher printed the raw lines, and wake consumers that keep
only prefixed lines (such as the Claude Stop-hook banner) dropped every line
after the first. Flatten the wake line the same way the queued row is
flattened, so both carry every line.

* fix(wake): present every distinct check payload before acknowledgement

The drain kept only the newest row per kind and key, and its acknowledgement
then consumed the hidden rows too. Two different wakes queued by one check
before a drain therefore lost the earlier payload unread. Collapse check
rows only when their payload is identical; signal, stale and heartbeat rows
keep their existing newest-wins collapse.

* feat(bin): check watched tools against published npm and GitHub releases (#3841)

* feat: check published releases for watched tools

* no-mistakes(review): Restore whole-registry validation while retaining published-release checks

* no-mistakes(document): Clarify successful installed-version probe requirement

* fix: retain completed tool sweeps at the budget boundary

* no-mistakes(review): Restore unconditional sweep recording and cadence; focused tests pass

* no-mistakes(review): Correct incomplete sweep recording and cadence documentation

* no-mistakes(document): Drop stale conditional sweep-recording wording from configuration docs

* no-mistakes(review): Require successful probes only for published-release comparison

* test: expect a newer announced version beside the published source

Upstream now reports an announcement naming an installed version only as
update not in effect, so the composition test announces 0.8.4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* no-mistakes(review): Compare published releases with the newest installed copy

* no-mistakes(review): Reject watched tools setting both published and version_url

* no-mistakes(document): Scope curl hardening note to published release reads

---------

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

* fix(bin): restore Claude slash-command submission on Herdr (#6695)

* fix(bin): read a typed slash command above Claude 2.1.291's marked popup row

Claude Code 2.1.291 draws the selected row of its slash-command popup with the
same `❯` marker as its composer, so that row below the composer's closing rule
became the bottom-most bare composer candidate and the whole popup list was
read as the typed command. The Herdr Claude payload proof then judged the
payload unsent, cleared it, and reported send-failed, so `fm-control exit` and
every slash command sent through `fm-send` failed on Herdr.

Demote that row to the proven envelope above it, but only when the envelope's
own glyph row holds typed `/` text (the fallback read can never be empty) and
the row has the popup shape: a leading `/` or a truncated `…` name, then a gap
of two or more spaces before its description. Numbered-choice dialog rows,
one-word drafts, empty composers, and typed prose keep their old reading, and
the head-truncation and placeholder-remainder refusals are unchanged.

Regression tests run against real captures of the 2.1.291 screens. The live
guard gains a /context scenario, and the dated verification record is updated.

* no-mistakes(review): Ghost-strip popup demotion guard; relocate 2.1.291 docs

* no-mistakes(review): Match popup guard to fallback's plain glyph row

* no-mistakes(review): Narrow box popup test; note box follow-up in docs

* no-mistakes(document): Point same-glyph footer rule at 2.1.291 popup exception

* no-mistakes(ci): Both selected Greptile findings are fixed. Only the live test and the verification doc changed; product code and box handling are untouched. The changes are left uncommitted for the outer executor. **ci-2** (tests/fm-herdr-submit-confirm-live-e2e.test.sh) - Invariant: a live delivery check must show that the command actually ran, through its rendered output. An empty composer and a registered agent are not enough. - Fix: after the `/context` verdict, the test now polls the pane the same way the earlier reply check does, until `/context`'s `Context Usage` heading renders. Any other result fails. - I confirmed that heading with a probe in an isolated `fm-lab-` session. The popup's description says "context usage" in lowercase, so the case-sensitive match cannot hit the popup. - The read window is 1000 lines (`--source recent --lines 1000`). The report runs to hundreds of rows here with its heading at the top, so the 200-line window the reply check uses would lose it. - The existing agent-registered and composer-empty checks are kept. The header comment, block comment and pass message were updated to match. **ci-3** (docs/verification/runtime-backends.md) - Invariant: only tests that fail against the previous classifier may be called before-and-after regressions. - I ran each of the five tests on its own against base 5838f105's `bin/fm-composer-lib.sh`: - These 3 fail there and are now labelled before-and-after regressions: `marked_row_is_not_a_second_composer`, `composer_content_..._not_the_composer`, and `send_text_submit_..._proven_and_submitted` (the last one returned 'unknown'). - These 2 pass there and are now labelled guards: `demotion_only_ever_refuses` and `popup_still_refuses_a_partial_payload`. - I corrected one more claim in the same paragraph. It said the live guard fails against the old classifier "at the `/exit` scenario". A live run against the old classifier (session `fm-lab-herdr-submit-con-1106578-15406`) actually fails earlier, at `/context`, with `send-failed`. The doc now says that. - The doc's recorded live output was replaced with the real output of the new run. **Verification** - Live guard on HEAD: `FM_HERDR_SUBMIT_CONFIRM_LIVE=1 ANTHROPIC_MODEL=claude-haiku-4-5-20251001` passed all 4 checks, including "...proves and submits a typed /context behind its command popup and renders its report". It ran in its own session, `fm-lab-herdr-submit-con-1098793-23839`. - Every live run used only its own `fm-lab-` session. Afterwards `herdr session list` shows only `default`, which was never touched. - `tests/fm-composer-lib.test.sh` returned 0 with 47 ok, and `tests/fm-backend-herdr.test.sh` returned 0 with 233 ok. - With the opt-in off, the live test skips with rc 0. - `bin/fm-lint.sh` returned 0 (ShellCheck 0.11.0, actionlint 1.7.12). - Temporary directories were removed. **Gap:** the new check's failure path was never triggered in a live run, because the old classifier fails earlier, at the verdict. That the check can tell a run from no run rests on the probe: the heading is not on screen before submission, and the popup text is lowercase

* no-mistakes(document): Include Tern in popup classifier inheritance documentation

* fix(bin): tolerate slow Herdr worktree entry in fm-spawn (#8139)

* fix(spawn): tolerate slow Herdr worktree entry

Restore shell startup tolerance after out-of-pane leasing, resend the worktree cd once, and diagnose a pane that never moves. Cover delayed and dropped entry portably and ordinary/delayed projected spawns in an isolated real-Herdr lab.

Fixes https://github.com/kunchenguid/firstmate/issues/8138

* no-mistakes(document): Document Herdr worktree cd resend in agent-control

* no-mistakes(ci): I fixed Greptile ci-1. On supported Herdr releases below the presentation floor (0.8.0, including pinned 0.7.4), the live test `tests/fm-herdr-projected-cd-live-e2e.test.sh` reported a correct flat spawn as a failure. Now it skips clearly on those releases. **Invariant:** the test may expect a projected spawn only when the same floor classifier `fm-spawn` uses says projection is the default. **Where it must hold:** the one decision point before the case loop. Both cases (delay 0 and delay 1) assert the `.herdr-presentation` marker, and both sit after that check. **Change (test file only):** after the lab is provisioned, the test calls the existing `fm_backend_herdr_presentation_release_supported` from `bin/backends/herdr.sh`. It goes through the test's fake `herdr`, which routes every call to the named lab session, so the check covers the same client and server `fm-spawn` sees. The result is handled three ways: - **At or above the floor:** the projected and delayed cases run as before. - **Below the floor:** the test prints `skip: Herdr <release> is below the 0.8.0 presentation floor, so spawns stay flat` and exits 0. The cleanup trap still tears down the lab. - **Can't be classified:** the test fails. No production code changed, and the overall Herdr support floor is unchanged. **Verification** (Herdr was only run through `bin/fm-herdr-lab.sh` on its own `fm-lab-` session): - **Above the floor:** on the installed Herdr 0.9.5, both cases pass: "Herdr 0.9.5 projected spawn enters its recorded copy" for delayed=0 and delayed=1. - **Below the floor:** I pointed `HERDR_LAB_HELPER` at a temporary wrapper around the real lab helper. It changes only the `status --json` reply so the client and server report 0.7.4, protocol 17. The test printed "skip: Herdr server version 0.7.4 (protocol 17) is below the 0.8.0 presentation floor, so spawns stay flat" and exited 0. This is simulated, not a real 0.7.4 install. - Afterwards no lab sessions were left over. - `tests/fm-spawn-herdr-lease.test.sh` passed through `bin/fm-test-run.sh`. - `bash -n` is clean. shellcheck shows only the existing SC1091 info note about the sourced `tests/fixtures.sh`. I did not edit the PR body, so its links to issue #8138 are untouched

* no-mistakes(document): Document live projected-cd test's below-floor skip

* feat: report worker status through OSC 7501 (#8011)

* feat(bin): report worker state via OSC 7501 for firstmate-launched agents

Stage 2 of the herdr-core/app staged plan: agents firstmate launches now
report idle/working/blocked/done to their terminal through the OSC 7501
Program Status Protocol, so 7501-aware terminals (herdr-core, the Herdr
app, Ghostty, Rex) show task state without screen inference.

bin/fm-osc7501.sh is armed inside the launch command before the agent
starts. Its watcher folds the task's durable signals (status log,
busy-state, unhandled inbox) into root records with
app=firstmate-<harness> and title=fm-<id>, and parks the record on exit.
Arm emits nothing unless the terminal is known-aware (HC_TERMINAL_ID,
REX_BLOCK/REX_SESSION, TERM_PROGRAM=ghostty) or answers the capability
query, stands down for natively reporting harnesses (claude >= 2.1.295,
pi >= 1.1.0), and never writes to worker input. The env -i floor now
forwards the HC_* pane markers so detection survives an allowlist.

config/osc7501-status gates the feature per home (default on).
The herdr backend is untouched; core/app integration stays Stage 3.

* no-mistakes(review): Fix OSC 7501 reporter tty identity, lifetime, mapping, and stty restore

* no-mistakes(review): Honor hc terminals under herdr; retire superseded status declarations

* no-mistakes(review): Retire stale declarations on any newer busy record

* no-mistakes(review): Drop report command; retire declarations on later inbox steers

* no-mistakes(review): Classify activity via busy lib; confirm reporter retirement

* no-mistakes(review): Order retirement by nanosecond times; drop pull-source turn guess

* no-mistakes(review): Retire declarations only on later steers, with stable thresholds

* no-mistakes(review): Drop probe cache; restore hc socket pinning in floor

* no-mistakes(review): Drop declared-wait mapping; report from single-source signals only

* no-mistakes(review): Give the watcher backend capture for pane-classified harnesses

* no-mistakes(document): Clarify OSC 7501 documentation ownership and Rex compatibility

* no-mistakes(review): Newline-delimit launch disarm; keep arm warnings visible

* no-mistakes(review): Require stand-in pidfile before checking disarm

* no-mistakes(review): Skip status-bridge records in Rex activity readers

* no-mistakes(ci): Fixed Cortex launch assertions mistaking the OSC reporter’s --config for an unsupported Cortex flag, including the sibling xhigh check. Reproduced failure before fix; Cortex suite, bash syntax, and diff checks pass afterward. Full suite failure was downstream of this test failure

* no-mistakes(ci): Removed active terminal capability queries, tty reads/mode changes, and the unused query timeout. Unknown terminals now silently no-op; passive detection remains. Updated docs and behavioral tests. Regression rejects pre-fix code; all 18 reporter tests, syntax checks, ShellCheck (excluding source-resolution notices), and diff checks pass

* no-mistakes(review): Exclude native codex and gate records on activity

* no-mistakes(review): Never write bridge records without known activity

* no-mistakes(review): Probe the launched binary for native reporters

* no-mistakes(review): Arm no reporter for raw launch commands

* no-mistakes(review): Report raw launches only with established agents

* no-mistakes(document): Consolidate OSC reporting documentation ownership

* no-mistakes(ci): Fixed standing captain holds to report blocked kind=question before activity fallback. Added behavioral coverage for idle/busy holds and supersession; confirmed regression fails before the fix and full OSC suite passes afterward. Shell syntax and diff checks passed

* no-mistakes(ci): Fixed the flaky startup-teardown fixture in tests/fm-watcher-lock.test.sh: replace racing recursive deletion with a checked atomic rename, retaining the old inode. Full suite failure was downstream of this shard failure. Complete watcher-lock suite, shell syntax, and git diff checks passed locally

* fix(osc7501): keep the bridge's own record honest when activity reads unknown

The unknown-activity silence that protected a native writer's root record
also left the bridge's own working/blocked on the pane forever - including
past the agent's exit, which never emitted its final record. While the
bridge's last write still stands, the durable signals now keep it honest:
they fold the same way with idle activity and the result is written once
per change, with no hold and no heartbeat. A watcher that never wrote
still stays silent so a native owner is never touched. The final record
likewise lands whenever the bridge's last write stands, keeping done/error
and parking the rest at idle. Rovo and Antigravity, whose only activity
source resolves busy or unknown, thereby still reach idle, blocked, done,
and error. Arm also writes one idle record once every gate passes, clearing
whatever a watcher that died without its final write left on the pane.

* no-mistakes(review): Carry arm-time ownership into watcher, trim osc_seq

* no-mistakes(document): Clarify OSC status lifecycle documentation

* fix(osc7501): park stale terminal lines and clear leftovers on unarmed relaunches

A done/failed status line carries the phase that wrote it, not the turn
now in flight: under unknown activity the fold now reports a terminal line
only when it was stamped at or after the reading that last proved the
worker busy, so an earlier phase's result parks at idle instead of
displaying done or error for a whole turn. A same-second stamp still
counts - a truly older line can never coincide with the last busy reading.

arm's residue clear now runs once the pane's terminal proves 7501-aware
and a leftover pidfile marks the record as the bridge's own, before the
config and native gates - so off and native relaunches retire a dead
watcher's record too, while panes that never armed still see no bytes.

* no-mistakes(review): Order stale results by append; keep result at exit

* no-mistakes(document): Clarify OSC status reporting documentation

* no-mistakes(ci): Replaced the version probe’s unbounded TERM/wait loop with shared fm_run_timed process-group termination and KILL escalation. Added a regression proving worker launch proceeds despite a TERM-resistant probe and descendant; reproduced failure before the fix. All 31 OSC tests pass, including the regression with the bash timeout fallback. Shell syntax and git diff checks pass

* fix(osc7501): disarm writes the final record a dead watcher never could

fm-spawn runs disarm after the agent command returns, so a SIGKILLed
watchers pidfile is removed there - before the next launch ever sees it,
which left the dead watcher's working/blocked record standing on off and
native relaunches. disarm now writes that final record itself (idle,
keeping done/error, exactly osc_final's fold) when the pidfile names no
live reporter; the pidfile carries harness and kind so the write names
the right app= and folds decisions under the worker's real kind. The
real-order regression now exercises SIGKILL -> disarm -> off/native
relaunch.

* no-mistakes(review): Write final record when retirement kills watcher

* no-mistakes(review): Always write final record once retirement confirms

* no-mistakes(lint): Suppress intentional generated-script expansion warning

* feat(bin): add opt-in Linux container check for changed shell tests (#8148)

* feat(bin): add opt-in Linux container check for changed shell tests

* no-mistakes(review): Run Linux check as host user with git clone

* no-mistakes(review): Remove locally deleted files from Linux scratch copy

* no-mistakes(review): Use keep-id for podman in Linux test check

* no-mistakes(ci): Fixed the three selected review findings locally (nothing committed or pushed). ci-2: bin/fm-test-linux.sh now clones with --no-hardlinks, so the container cannot write the host object files. ci-3: tests/linux/Dockerfile now installs python3, nodejs and curl (tools the ordinary suites require); tests/fm-test-linux.test.sh container case adds a tools.test.sh fixture that runs python3, node and curl. ci-4: both the overlay check (line 100) and the prune check (line 104) treat [ -L ] as present; the same fixture commits a dangling symlink and asserts it survives in the container. Verified with FM_TEST_LINUX_CONTAINER=1 bash tests/fm-test-linux.test.sh on Docker: all 4 pass. Mutation check: removing the [ -L ] at line 104 turns the fixture red ("dangling link lost"). Removing it at line 100 alone does not, because the clone already carries committed symlinks; that check only matters for untracked dangling links, which has no fixture. The check stays opt-in

* feat(bin): accept a caller-supplied expected PR head in fm-pr-merge (#8157)

* feat(bin): accept a caller-supplied expected PR head

The merge path read the live head again and used that value for the forge
head match. A push after review could replace the tested commit.
--expected-head takes one full commit, refuses a different live head, and
sends that same value to GitHub, GitLab, and Forgejo.
Callers that omit it keep the live-head match.

Closes #8124

* no-mistakes(review): Drop no-op head pin; test authority and identity refusals

* no-mistakes(review): Inline merge head assignment

* fix(bin): re-arm supervision on Claude StopFailure so error-ended turns are not blind

A Claude turn that ends on an API error runs no Stop phase, so the
Stop-owned auto-arm never fired and the home had no watcher coverage
until external input (observed as 15h and 4.7h blind gaps). Claude
2.1.317 fires StopFailure for those turn ends and honors the same
asyncRewake/exit-2 rewake as Stop, verified live on a herdr-hosted
primary: the tracked auto-arm under StopFailure armed a real watcher,
delivered the queued wake as an unprompted turn, and the chained error
end was suppressed by the new per-cooldown rewake bound instead of
storming.

* no-mistakes(review): Pace StopFailure continuations instead of dropping

* no-mistakes(review): Recheck AFK and need after StopFailure pacing

* no-mistakes(document): Document StopFailure supervision continuity

* no-mistakes(ci): Normalized the validated StopFailure cooldown to base 10. Updated the behavioral pacing regression to use 08 after a cooldown marker exists; it failed before the fix and passes afterward. Full auto-arm test suite, Bash syntax checks, and git diff --check pass. Changes remain local; nothing published

* no-mistakes(ci): Fixed the watcher-lock test’s flaky STOP-and-scan synchronization by pausing at the lock-free poll sleep. Full watcher-lock suite, repeated focused regressions, Bash syntax, and diff checks pass. Full suite failure was downstream of the shard failure. Changes remain local; nothing published

* no-mistakes(document): Clarify StopFailure continuity documentation

---------

Co-authored-by: Michal Zuber <[email protected]>
Co-authored-by: Lewis Mazzei <[email protected]>
Co-authored-by: Trillium Smith <[email protected]>
Co-authored-by: Trillium Smith <[email protected]>
Co-authored-by: Martin Kessler <[email protected]>
Co-authored-by: c6aw <[email protected]>
Co-authored-by: AgardnerAU <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Symphony <[email protected]>
Co-authored-by: Alexander Goldstein <[email protected]>
Co-authored-by: Tim Kleinschmidt <[email protected]>

* feat: support custom fleet sessions in Herdr labs (#8277)

* fix(bin): let the Herdr lab tripwire protect a custom-named fleet session

fm-herdr-lab.sh only accepted a running session literally named "default"
as the fleet-state tripwire, so a home whose fleet runs in a custom-named
Herdr session could not provision any lab.

FM_HERDR_LAB_FLEET_SESSION (default "default") now names the fleet session
the tripwire records and compares, with the same {name, default, running,
socket_path} snapshot and exactly-one-running-row rule. The name must be a
plain session name and can never be an fm-lab- session. Every Herdr call the
helper makes now clears the inherited HERDR_SOCKET_PATH, HERDR_PANE_ID,
HERDR_TAB_ID and HERDR_WORKSPACE_ID pane variables.

Fixes #8268

* no-mistakes(review): Isolate lab tests from inherited fleet-session configuration

* no-mistakes(document): Clarify Herdr fleet-session documentation and ownership

* no-mistakes(document): Correct configurable fleet-session safety wording

* no-mistakes(lint): Suppress ShellCheck warning for intentional literal backticks

* fix(pi): keep the Pi watcher armed after a successor or arm child dies (#7255)

* fix: require a live Pi watcher successor

* no-mistakes(document): Document Pi dead-but-ready successor regression coverage

* no-mistakes(review): Retry Pi watcher arms on process exit, not close

* fix(pi): preserve actionables across exit drain

* no-mistakes(document): Document Pi exit-drain actionable regression coverage

* test: improve macOS portability and isolation of process tests (#8217)

* test(remote): run FIFO holders from a non-platform jq copy

macOS hides a platform binary's environment from ps -E. On a host whose
jq is Apple's /usr/bin/jq, the holder markers were unreadable, so
fm-remote-doctor and fm-remote-herdr-guard failed.

tests/lib.sh gains fm_test_nonplatform_binary, which copies the binary
and ad-hoc signs the copy on Darwin. Both suites run their holders from
that copy.

* test(omp): run the no-omp-ancestor case under a named claude shell

The leaked-marker case ran under a plain bash, so its verdict came from
the harness that ran the suite. Under a Codex ancestor it detected codex
and failed. A claude-named shell now gives the case its own nearest
harness ancestor.

* test(procevent): start the draining holder with the portable perl setsid

macOS ships no setsid binary, so the draining-holder case failed with
"setsid: command not found" before it could read the holder's
identity. The suite already starts its other new-session holders with
perl's POSIX::setsid; this one now does the same.

* no-mistakes(ci): Captain, added the marker-only case using fm_fake_blind_ancestry and preserved the named Claude case. Mutation verification confirmed the new case rejects unguarded OMP markers. All 19 OMP checks, repository lint, shell syntax, and diff checks passed. Runtime code remains unchanged

* test(omp): clear inherited gemini and rovo markers in the blind-ancestry case

harness_marker checks GEMINI_CLI, ATLASSIAN_AGENT_TYPE and ROVODEV_CLI
before CLAUDECODE. With ancestry hidden, no process name outranks them,
so a suite that inherited one of them failed the marker-only case with
'gemini' or 'rovo'. The case now clears those markers as well.

---------

Co-authored-by: Karan Manoharan <[email protected]>

* fix: export active home to ship and scout workers (#8273)

* fix(bin): export the active FM_HOME onto ship and scout launches

The tmux/herdr daemon that owns a worker's pane does not inherit the
spawner's environment, and fm-spawn.sh set FM_HOME only for secondmates.
A ship or scout therefore started with no FM_HOME, so any bin/*.sh script
it ran resolved its own code root as the home and read and wrote the
wrong home's state. Set the spawner's resolved FM_HOME on every ship and
scout launch, in both the pane launch command and the T3 Code env.

Fixes #8271

* no-mistakes(ci): Fixed ship/scout launch FM_HOME export; secondmate branch unchanged. Updated launch-shape assertions and added an executed compound-launch environment probe. Passed FM_LIVE=0 compact-adviser test, Kimi harness test, fm-lint, and git diff --check. Dispatch-profile suite not run as instructed

* no-mistakes(ci): Updated only tests/fm-spawn-compact-adviser-disable.test.sh: the executed compound-launch probe reports both COMPACT_ADVISER_DISABLE and FM_HOME; assertions require 1 and $HOME_DIR, and the pass message names both. Verified with FM_LIVE=0 bash tests/fm-spawn-compact-adviser-disable.test.sh and bin/fm-lint.sh. Both passed

* fix(bin): quiet relayed captain-hold reminders and keep backoff on republish (#8283)

* fix(watch): quiet relayed captain holds and keep reminder backoff on republish

The opt-in open-decision reminder tick only suppressed a key when its own
task was paused or held, so a secondmate's captain-hold-<task>-<n> key
relayed into the parent status file always reminded, and every republish
of a still-open key with a new [at=] restarted its backoff at the threshold.

- Exempt keys with the structured captain-hold- prefix, decided from the
  key alone.
- fm-captain-hold.sh hold --until now publishes a structured
  [until=YYYY-MM-DD] field on the relayed line; the timed fold view carries
  it and the tick re-arms the key from 00:00 UTC on that date. A malformed
  field re-arms at once; note prose is never read.
- Ledger rows now also record verb and note, so an unchanged republish keeps
  its first opened time, last reminder and next delay, while a changed verb
  or note starts a new episode. Legacy five-column rows still match on their
  opened time and are rewritten in place.

* no-mistakes(review): Keep republish epoch in fold, not reminder ledger

* no-mistakes(ci): Fixes the Greptile P1 bug "repeated hold dates get ignored" (ci-1). The rule that was broken: a keyed parent-channel state update has to be compared with that key's latest line, not with every line in its history. Before the fix, `fm_parent_channel_append_once` searched the whole channel. So holding `--until A`, then `B`, then `A` dropped the final A line, and the parent watcher kept using B. Fix (the edits were in the worktree, uncommitted, when this round started - most likely from round 2's agent, which crashed on a rate limit; I reviewed them and kept them): - `bin/fm-parent-channel-lib.sh`: `fm_parent_channel_report` and `fm_parent_channel_append_once` take an optional `[key]` argument. With a key, the new line (without its `[at=]` stamp) is compared only with that key's latest line, found by the new `_fm_parent_channel_latest_for_key` using the existing `_fm_decision_key` and `_fm_status_untimed`. Without a key, the old history-wide dedupe is unchanged. - `bin/fm-captain-hold.sh`: `publish_parent_hold` passes `captain-hold-<id>-<n>`. It is the only publisher that sends keyed state updates (both the `needs-decision` and the `resolved` lines), so both go through the fixed path. The other callers (inactive-reconcile, pr-check, review-check, merge-outcome, pending-reply) publish one-off events and stay on the old behavior. I also re-wrapped one overlong line in the header comment. - `tests/fm-captain-hold-lifecycle.test.sh`: a behavior test that runs the real `hold` command A -> B -> A and checks that the latest line for the key carries `[until=A]`, plus a test that an exact retry adds no line (count stays 3). Verification is not finished: when this result was required, the full lifecycle test run and the shellcheck/`bash -n` run were still going in the background with no output yet. So I cannot yet confirm the tests pass or that shellcheck is clean, and I have not checked that the new test fails without the fix

* feat(capacity): opt-in adaptive lane budget from measured host vitals (#8286)

* feat(capacity): opt-in auto lane budget from measured host vitals

Add an `auto` first line to config/lane-capacity so fm-capacity.sh decides
how many ship and scout lanes a machine can take from its own vitals instead
of a hand-set integer cap. Open lanes are the smallest of a memory, cpu, and
disk budget built from learned per-lane footprints (p90 of this machine's
last 30 lanes once five are recorded), with an optional max-lanes ceiling.
Lanes younger than 180 s reserve a full lane, growth is damped to two lanes
per publish, and every local home on the machine is counted.

Gates for cpu, load, memory pressure, swap-in, io pressure, the Windows host
under WSL2, thermal limits, battery, and optionally GPU memory close
admission at once and reopen after three clean publishes. The published
fm-lane-capacity.v1 document gains additive budget, footprint, vitals,
gates, and a recommend-only reclaim list of idle lanes.

fm-spawn.sh applies the verdict only when the home declares admit-spawns,
under a machine-wide lock, deferring with exit 75 like a project-capacity
deferral; FM_SPAWN_IGNORE_LANE_CAPACITY=1 overrides one spawn. Probes live
in the new read-only bin/fm-lane-vitals-lib.sh. Fixed mode and homes
without the new keys are unchanged.

* no-mistakes(review): native Windows vitals, damped admission, drop capacity pins

* no-mistakes(review): label damped refusals, drop Cygwin alias, refresh scripts table

* no-mistakes(document): note lane-capacity spawn deferral in AGENTS.md, reflow headers

* no-mistakes(document): restore AGENTS.md line, say MSYS /proc not Cygwin

* test(capacity): end-to-end lane capacity integration suite and review fixes

Add tests/fm-lane-capacity-integration.test.sh, which drives the auto lane
budget through the real firstmate paths: bin/fm-spawn.sh admitting, deferring
with exit 75 and a queued backlog item, and re-admitting real spawns on the
verdict; eight spawns in one publish interval admitting exactly the damped
budget; the real bin/fm-watch.sh publish cycle damping growth across two
publishes and feeding the next spawn; idle-lane reclaim judged from real
worker processes without stopping any; the fixed-cap path compared byte for
byte against the merge base; and an opt-in live case that loads the host CPU
and records the verdict before, during, and after with timestamps.

Fixes found while testing and in review:
- a config/lane-capacity that exists but cannot be read now refuses the spawn
  gate instead of admitting, since it cannot show it does not ask for it
- in auto mode a pressure-file beat can only lower the live memory reading
- under WSL2 the Windows host's power reading closes the battery gate when
  Linux has no power_supply of its own
- the report names the first three reclaim candidates with their class, idle
  age, next step, and evidence

* no-mistakes(review): hold closed gates on unknown readings, pin fixed-cap tests

* no-mistakes(review): hold closed battery, thermal, pressure gates on unreadable probes

* test(capacity): inject memory in the portable integration cases

The portable cases sized their room from this host's live available memory,
so the four-lane watcher case failed on any machine with less than about
9 GB free even when the code was right. They now inject the memory reading
through the probe seams the unit suites use: a fake sysctl for hw.memsize
and kern.memorystatus_level on macOS, and on Linux an FM_PROC_ROOT_OVERRIDE
tree whose meminfo is a fixture and whose other entries link to the real
/proc. The spawn gate case asserts the budget reads the injected 11 GB. The
idle-reclaim case keeps the real process table and memory, and only the
opt-in live case reads this host's memory for admission.

* no-mistakes(review): Tighten burst deferral, probe_env watcher stop, reword floor messages

* test(capacity): keep the portable cases off the live Windows host view

* no-mistakes(review): Ignore peripheral batteries; skip unused probes on admission

* no-mistakes(ci): Fixed ci-3 (Greptile "Closed gates expire"). Before this fix, a published auto doc older than 300 s became null, and that dropped every closed gate along with the budget. So if the watcher stopped and powershell.exe stayed unreadable, the next spawn could be admitted on Linux headroom alone, with no clean host reading. Fix in bin/fm-capacity.sh (auto_budget jq): - `$pa` is now the last auto doc at any age. - `$pg` (its gates) comes from `$pa`. - `$pd` (the doc only while it is at most 300 s old) still feeds prev_free, since_publish, damping and the swap rate, so the budget's freshness is unchanged. - gate() now reads the previous gate state from `$pg`. A closed gate keeps its since_epoch and clear_count however old the doc is, and only real clean readings reopen it. Test: added test_closed_gate_survives_a_stale_publish to tests/fm-capacity-auto.test.sh and extended the header's coverage list. The test publishes with a starved WSL host so host-memory closes, ages the doc by 900 s, removes the host cache and makes powershell.exe fail. It then asserts that --spawn-gate exits 75 with "host-memory: Windows host unreadable" and that --json still reports the gate closed with admit false. It failed before the fix (exit 0) and passes after it. Checks run: fm-capacity-auto, fm-capacity, fm-project-capacity and fm-lane-capacity-integration all pass. Shellcheck shows only info-level SC1091 notes because it was run without -x. No em dashes were added. Docs needed no change because none of them tie gates to the 300 s window. ci-1 and ci-2 were not touched, as instructed

* test: align fork tests with the merged upstream behaviour

Dated captain-hold lines carry the fork's cause tag, watcher-marker tests use window_key,
the landing-lag batch message names lanes too, and upstream's TypeSafe TYPESAFE_BASE tests
are dropped because the for…
demy00 added a commit to demy00/firstmate that referenced this pull request Nov 14, 2026
* feat: report worker status through OSC 7501 (#8011)

* feat(bin): report worker state via OSC 7501 for firstmate-launched agents

Stage 2 of the herdr-core/app staged plan: agents firstmate launches now
report idle/working/blocked/done to their terminal through the OSC 7501
Program Status Protocol, so 7501-aware terminals (herdr-core, the Herdr
app, Ghostty, Rex) show task state without screen inference.

bin/fm-osc7501.sh is armed inside the launch command before the agent
starts. Its watcher folds the task's durable signals (status log,
busy-state, unhandled inbox) into root records with
app=firstmate-<harness> and title=fm-<id>, and parks the record on exit.
Arm emits nothing unless the terminal is known-aware (HC_TERMINAL_ID,
REX_BLOCK/REX_SESSION, TERM_PROGRAM=ghostty) or answers the capability
query, stands down for natively reporting harnesses (claude >= 2.1.295,
pi >= 1.1.0), and never writes to worker input. The env -i floor now
forwards the HC_* pane markers so detection survives an allowlist.

config/osc7501-status gates the feature per home (default on).
The herdr backend is untouched; core/app integration stays Stage 3.

* no-mistakes(review): Fix OSC 7501 reporter tty identity, lifetime, mapping, and stty restore

* no-mistakes(review): Honor hc terminals under herdr; retire superseded status declarations

* no-mistakes(review): Retire stale declarations on any newer busy record

* no-mistakes(review): Drop report command; retire declarations on later inbox steers

* no-mistakes(review): Classify activity via busy lib; confirm reporter retirement

* no-mistakes(review): Order retirement by nanosecond times; drop pull-source turn guess

* no-mistakes(review): Retire declarations only on later steers, with stable thresholds

* no-mistakes(review): Drop probe cache; restore hc socket pinning in floor

* no-mistakes(review): Drop declared-wait mapping; report from single-source signals only

* no-mistakes(review): Give the watcher backend capture for pane-classified harnesses

* no-mistakes(document): Clarify OSC 7501 documentation ownership and Rex compatibility

* no-mistakes(review): Newline-delimit launch disarm; keep arm warnings visible

* no-mistakes(review): Require stand-in pidfile before checking disarm

* no-mistakes(review): Skip status-bridge records in Rex activity readers

* no-mistakes(ci): Fixed Cortex launch assertions mistaking the OSC reporter’s --config for an unsupported Cortex flag, including the sibling xhigh check. Reproduced failure before fix; Cortex suite, bash syntax, and diff checks pass afterward. Full suite failure was downstream of this test failure

* no-mistakes(ci): Removed active terminal capability queries, tty reads/mode changes, and the unused query timeout. Unknown terminals now silently no-op; passive detection remains. Updated docs and behavioral tests. Regression rejects pre-fix code; all 18 reporter tests, syntax checks, ShellCheck (excluding source-resolution notices), and diff checks pass

* no-mistakes(review): Exclude native codex and gate records on activity

* no-mistakes(review): Never write bridge records without known activity

* no-mistakes(review): Probe the launched binary for native reporters

* no-mistakes(review): Arm no reporter for raw launch commands

* no-mistakes(review): Report raw launches only with established agents

* no-mistakes(document): Consolidate OSC reporting documentation ownership

* no-mistakes(ci): Fixed standing captain holds to report blocked kind=question before activity fallback. Added behavioral coverage for idle/busy holds and supersession; confirmed regression fails before the fix and full OSC suite passes afterward. Shell syntax and diff checks passed

* no-mistakes(ci): Fixed the flaky startup-teardown fixture in tests/fm-watcher-lock.test.sh: replace racing recursive deletion with a checked atomic rename, retaining the old inode. Full suite failure was downstream of this shard failure. Complete watcher-lock suite, shell syntax, and git diff checks passed locally

* fix(osc7501): keep the bridge's own record honest when activity reads unknown

The unknown-activity silence that protected a native writer's root record
also left the bridge's own working/blocked on the pane forever - including
past the agent's exit, which never emitted its final record. While the
bridge's last write still stands, the durable signals now keep it honest:
they fold the same way with idle activity and the result is written once
per change, with no hold and no heartbeat. A watcher that never wrote
still stays silent so a native owner is never touched. The final record
likewise lands whenever the bridge's last write stands, keeping done/error
and parking the rest at idle. Rovo and Antigravity, whose only activity
source resolves busy or unknown, thereby still reach idle, blocked, done,
and error. Arm also writes one idle record once every gate passes, clearing
whatever a watcher that died without its final write left on the pane.

* no-mistakes(review): Carry arm-time ownership into watcher, trim osc_seq

* no-mistakes(document): Clarify OSC status lifecycle documentation

* fix(osc7501): park stale terminal lines and clear leftovers on unarmed relaunches

A done/failed status line carries the phase that wrote it, not the turn
now in flight: under unknown activity the fold now reports a terminal line
only when it was stamped at or after the reading that last proved the
worker busy, so an earlier phase's result parks at idle instead of
displaying done or error for a whole turn. A same-second stamp still
counts - a truly older line can never coincide with the last busy reading.

arm's residue clear now runs once the pane's terminal proves 7501-aware
and a leftover pidfile marks the record as the bridge's own, before the
config and native gates - so off and native relaunches retire a dead
watcher's record too, while panes that never armed still see no bytes.

* no-mistakes(review): Order stale results by append; keep result at exit

* no-mistakes(document): Clarify OSC status reporting documentation

* no-mistakes(ci): Replaced the version probe’s unbounded TERM/wait loop with shared fm_run_timed process-group termination and KILL escalation. Added a regression proving worker launch proceeds despite a TERM-resistant probe and descendant; reproduced failure before the fix. All 31 OSC tests pass, including the regression with the bash timeout fallback. Shell syntax and git diff checks pass

* fix(osc7501): disarm writes the final record a dead watcher never could

fm-spawn runs disarm after the agent command returns, so a SIGKILLed
watchers pidfile is removed there - before the next launch ever sees it,
which left the dead watcher's working/blocked record standing on off and
native relaunches. disarm now writes that final record itself (idle,
keeping done/error, exactly osc_final's fold) when the pidfile names no
live reporter; the pidfile carries harness and kind so the write names
the right app= and folds decisions under the worker's real kind. The
real-order regression now exercises SIGKILL -> disarm -> off/native
relaunch.

* no-mistakes(review): Write final record when retirement kills watcher

* no-mistakes(review): Always write final record once retirement confirms

* no-mistakes(lint): Suppress intentional generated-script expansion warning

* feat(bin): add opt-in Linux container check for changed shell tests (#8148)

* feat(bin): add opt-in Linux container check for changed shell tests

* no-mistakes(review): Run Linux check as host user with git clone

* no-mistakes(review): Remove locally deleted files from Linux scratch copy

* no-mistakes(review): Use keep-id for podman in Linux test check

* no-mistakes(ci): Fixed the three selected review findings locally (nothing committed or pushed). ci-2: bin/fm-test-linux.sh now clones with --no-hardlinks, so the container cannot write the host object files. ci-3: tests/linux/Dockerfile now installs python3, nodejs and curl (tools the ordinary suites require); tests/fm-test-linux.test.sh container case adds a tools.test.sh fixture that runs python3, node and curl. ci-4: both the overlay check (line 100) and the prune check (line 104) treat [ -L ] as present; the same fixture commits a dangling symlink and asserts it survives in the container. Verified with FM_TEST_LINUX_CONTAINER=1 bash tests/fm-test-linux.test.sh on Docker: all 4 pass. Mutation check: removing the [ -L ] at line 104 turns the fixture red ("dangling link lost"). Removing it at line 100 alone does not, because the clone already carries committed symlinks; that check only matters for untracked dangling links, which has no fixture. The check stays opt-in

* feat(bin): accept a caller-supplied expected PR head in fm-pr-merge (#8157)

* feat(bin): accept a caller-supplied expected PR head

The merge path read the live head again and used that value for the forge
head match. A push after review could replace the tested commit.
--expected-head takes one full commit, refuses a different live head, and
sends that same value to GitHub, GitLab, and Forgejo.
Callers that omit it keep the live-head match.

Closes #8124

* no-mistakes(review): Drop no-op head pin; test authority and identity refusals

* no-mistakes(review): Inline merge head assignment

* test: add fail-closed test for the pinned Herdr installer (#7753)

* fix(bin): download pinned Herdr from its current repository

* no-mistakes(review): list installer test in pure-contract-unit family

* no-mistakes(ci): The Test coverage guard failure came from this PR, and I fixed it. Full suite also fails for a reason outside the code: it needs a maintainer's label. **Test coverage guard (ci-2):** The rule is that at most 15% of the portable-serial test scripts may lack a measured duration hint. The new `tests/fm-install-herdr.test.sh` had no hint, so 43 of 286 scripts lacked one (15.03%). Before this PR it was 42 of 285. The duration-hint table in `bin/fm-test-run.sh` is the only place this needs fixing. I added `tests/fm-install-herdr.test.sh 1000` to that table in alphabetical order. I also added one line to `docs/fm-test-portable-shards.md` recording it as a provisional local measurement: the slowest of five local runs took 223 ms (range 155-223 ms), and the next CI refresh will replace it with an Ubuntu measurement. Other new tests have been handled the same way. After the change, `bin/fm-test-run.sh --check-coverage` exits 0 with `serial_unhinted=42`. **Full suite (ci-1):** This job failed with `FM_CI_FULL=false`, which means the `full-ci` label is missing. Outside pull requests need a maintainer to add that label, so no code change can fix this part. The job also reported a failed lane, most likely the coverage guard fixed above. **Verification:** I ran `tests/fm-test-run.test.sh`. All the coverage, shard, partition and packing tests passed. One script failed: `tests/fm-session-lock-ancestry.test.sh`, which checks that the pty-host is reparented to init after its daemon ends. It is in a different test family, and its result depends on how processes are parented on the machine running it. This change only adds a duration hint, which affects how tests are spread across shards, not which tests run, so I don't think the change caused it. I did not rerun it on the base commit to confirm

---------

Co-authored-by: c-c6aw <[email protected]>

* fix(bin): record forced scout teardown as discarded instead of delivered (#8159)

* Fixes #8154 record forced scout discards

* no-mistakes(review): keep discarded note across close-marker replay

* no-mistakes(review): assert discarded note on row body, not task id

* Fixes #8154 preserve reports on held scout cleanup

* no-mistakes(document): document forced scout discard in teardown docs

* fix: preserve full captain-hold questions in decision snapshots (#8173)

* fix: preserve full Bearings decision questions

* no-mistakes(document): Document full decision question presentation

* fix(bin): canonicalize Windows drive-letter herdr socket paths before identity comparison (#8185)

* fix(bin): canonicalize Windows drive-letter herdr socket paths before identity comparison

* test(herdr): cover Windows drive-letter socket normalization

Adds the regression coverage the review asked for. `cygpath` ships only with
Git for Windows, so the cases stub it and therefore run on every platform; the
adapter guard matches only `[A-Za-z]:[\/]*`, a shape that cannot occur on
Linux or macOS.

Three cases: a drive-letter spelling normalizes to the same identity as the
POSIX spelling of the same socket, a failed `cygpath` is refused rather than
compared half-converted, and empty `cygpath` output is refused.

Verified the cases fail for the right reason: with the guard removed, the
normalization case reports an empty identity against the expected POSIX path.

---------

Co-authored-by: 3min-lang <[email protected]>

* fix: wait for busy-state locks to reach the stale threshold (#8177)

* fix(bin): outwait a fresh orphan busy-state lock before refusing

lock_acquire gave up after about two seconds, but only breaks a lock once
it is FM_BUSY_LOCK_STALE_SECS (default five) old. A writer killed inside its
critical section, such as a worker exit hook during teardown, leaves a fresh
orphan lock, so the first retire always failed with a lock timeout and only
a later retry succeeded.

A waiter now keeps polling until any lock that existed when it began has
had time to cross the stale bound, then breaks it as before. A lock that
stays younger than the bound for the whole wait still ends in a
lock-timeout refusal, about stale + 2 seconds after the wait began, and a
live writer that releases within the bound is waited for, never broken.

* no-mistakes(ci): Captain, fixed ci-2 by normalizing stale-lock settings to decimal before arithmetic. Added an 08 behavior regression that failed before the fix and passes afterward. Busy-state tests, focused lint, and diff checks pass. Workflow policy and labels remain unchanged

* fix: sync record exports with empty overrides and hidden state files (#8188)

* fix: refresh owner lease before detached process-event launches (#8191)

* Refresh owner presence before detached process-event startup

* no-mistakes(review): Correct lease documentation and CI evidence claims

* fix: recover remote inheritance after sender counter loss (#8104) (#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

* feat: support explicit GitHub branch updates before merging (#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: clean up Perl timeout processes on interruption (#7922)

* 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

* fix: prevent watcher marker collisions between endpoints (#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: stabilize extension orphan recovery readiness (#8210)

* 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

* feat: allow configurable TypeSafe dispatch base URLs (#7957) (#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

* fix(bin): refresh stale remote refs before teardown refuses landed work (#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

* fix(bin): bind crewmate spawns to the recorded dispatch selection (#8262)

* fix(spawn): bind launch flags to dispatch selection

* no-mistakes(review): Bind spawn to resolver-recorded dispatch selection

* no-mistakes(review): Bind spawn to per-task dispatch resolution record

* no-mistakes(document): Document relaunch exemption and fix task record heading

* no-mistakes(ci): Fixed the selected Greptile findings ci-2 and ci-3. Changes are left uncommitted in the worktree. ci-2 rule: a spawn under a clear recorded dispatch selection launches only that selection unless the task records an override. A raw launch command (a full command line instead of a harness name) keeps its own --model/--effort options, so matching flags beside it proved nothing. bin/fm-spawn.sh now refuses any raw launch command under a clear record unless --dispatch-override <reason> is given. The error message now says "with no raw launch command". This check gates both the single-task path and the batch path. Raw commands under ambiguous/escalate/error/off records still work, so the manual path is unchanged. ci-3 rule: the resolver writes the task record where fm-spawn.sh reads it, which is FM_DATA_OVERRIDE, else $FM_HOME/data. bin/fm-dispatch-resolve.sh used to look for a folder literally named "data". It now records only when the brief is <data root>/<id>/brief.md, comparing real directory paths. As a side effect, a data/<id>/ folder outside the configured root no longer gets a record. The resolver header comment and docs/configuration.md now describe the override. Tests added: - tests/fm-spawn-dispatch-profile.test.sh: the reviewer's case is refused (record selects claude/haiku/low; raw command "claude --model opus --effort high" with --model haiku --effort low). The same command launches with an override, and the reason is saved in the .meta file. - tests/fm-dispatch-resolve.test.sh: a brief under FM_DATA_OVERRIDE gets its record. A data/ folder outside the configured root does not. The existing task-record test now puts its brief under $FM_HOME/data. Verification: both full suites passed locally. For the spawn suite I put the real Python and Node install folders ahead of mise's wrapper scripts on PATH, because those wrappers fail on this host when a test changes HOME. That is a host problem, not a product defect. Shellcheck shows only info notes about sourced files it was not asked to follow. I did not run the new tests against the old code. From reading the old checks, each would have failed there. ci-1 and ci-4 were not touched, because the user chose to ignore both

* fix(procevent): stop launch confirmation starving the runner it awaits (#8265)

A runner needs the source lock to claim. ensure-listening and reconcile
both polled that lock every 50ms while waiting for the claim, so on a
loaded host the confirmation competed with the launch it was confirming.
At a load average near 50 a healthy runner claimed in 1.0-1.7s under a
lock-free observer and took 3.3-5.6s under ensure-listening, past the
default confirm window.

The miss was not harmless. arm then retired its own registration, half of
the arms in a twelve-run sample failed on a correct board, and a later
ensure-listening reported the source as not registered. reconcile announced
a launch failure for a source that was starting normally.

Take the lock only once a claim file exists, since until then there is
nothing to confirm. The same sample then armed twelve of twelve. The
regression test holds a runner just before its first lock acquisition and
asserts nothing else takes the lock, so it does not depend on timing.

Co-authored-by: Frederik Hagelund <[email protected]>

* fix: restore Claude supervision after API-error turn ends (#8134)

* fix(bin): re-arm supervision on Claude StopFailure so error-ended turns are not blind

A Claude turn that ends on an API error runs no Stop phase, so the
Stop-owned auto-arm never fired and the home had no watcher coverage
until external input (observed as 15h and 4.7h blind gaps). Claude
2.1.317 fires StopFailure for those turn ends and honors the same
asyncRewake/exit-2 rewake as Stop, verified live on a herdr-hosted
primary: the tracked auto-arm under StopFailure armed a real watcher,
delivered the queued wake as an unprompted turn, and the chained error
end was suppressed by the new per-cooldown rewake bound instead of
storming.

* no-mistakes(review): Pace StopFailure continuations instead of dropping

* no-mistakes(review): Recheck AFK and need after StopFailure pacing

* no-mistakes(document): Document StopFailure supervision continuity

* no-mistakes(ci): Normalized the validated StopFailure cooldown to base 10. Updated the behavioral pacing regression to use 08 after a cooldown marker exists; it failed before the fix and passes afterward. Full auto-arm test suite, Bash syntax checks, and git diff --check pass. Changes remain local; nothing published

* no-mistakes(ci): Fixed the watcher-lock test’s flaky STOP-and-scan synchronization by pausing at the lock-free poll sleep. Full watcher-lock suite, repeated focused regressions, Bash syntax, and diff checks pass. Full suite failure was downstream of the shard failure. Changes remain local; nothing published

* fix: prevent Codex Stop hook JSON contamination (#7231)

* fix: keep Codex Stop responses free of login-shell output

* no-mistakes(document): Consolidate Codex Stop documentation under authoritative owners

* no-mistakes(ci): Fixed both Pi before_agent_start handlers to narrow prompt-bearing events before accessing event.prompt, addressing the two TS2339 CI errors. Custom events now bypass user-prompt handling; ordinary prompt events and existing message_start paths remain unchanged. Local verification is blocked: tsc is not on PATH. No tools were installed and no other pipeline phases were executed

* fix: keep Codex Stop responses free of login-shell output

* no-mistakes(document): Consolidate Codex Stop documentation under authoritative owners

* no-mistakes(document): Correct Codex verification prerequisites and guard coverage

* fix(calm): leave one blank row above the Claude Code working boat (#7253)

* fix(calm): leave one blank row above the Claude Code working boat

Refs #7160

* no-mistakes(review): Assert spinner Box padding by walking tree

* fix(bin): refuse to relaunch a worker into a primary home or checkout (#8127)

* fix(spawn): refuse to relaunch a worker into a primary home or checkout

A relaunch trusted the recorded worktree and started the worker there. After a machine restart the restored record could point at the primary home or a repository's primary checkout, so a worker was relaunched inside it. Relaunch now refuses with a named error when the recorded worktree is the home, the code root, or a repository's primary checkout (git dir equals git common dir).

* no-mistakes(document): Document relaunch refusal of primary home or checkout worktrees

* no-mistakes(ci): Fixed ci-2 (the Greptile P1 finding). ci-1, the Full suite failure, is the expected maintainer-label gate; the user chose to leave it alone, so nothing was changed for it. Invariant: the relaunch refusal must judge whether the recorded worktree is a primary checkout from the directory's own layout on disk. Inherited Git location variables must not be able to change the answer. In this change, the only place that probes Git for that decision is the git-dir and common-dir check in the `--relaunch` refusal in `bin/fm-spawn.sh`. The home and code-root comparison doesn't use git, so it can't be affected. Fix in `bin/fm-spawn.sh`: both probes now run in a single subshell. That subshell first unsets the same Git variables that `bin/fm-claude-trust.sh` clears (`GIT_DIR`, `GIT_WORK_TREE`, `GIT_COMMON_DIR`, `GIT_OBJECT_DIRECTORY`, `GIT_INDEX_FILE`, `GIT_ALTERNATE_OBJECT_DIRECTORIES`, `GIT_CEILING_DIRECTORIES`, `GIT_NAMESPACE`, `GIT_DISCOVERY_ACROSS_FILESYSTEM`, `GIT_CONFIG*`). It then runs one `git rev-parse --path-format=absolute --git-dir --git-common-dir` and splits the two output lines. The unset is scoped to the subshell, so the environment the rest of the script and the launched worker see is unchanged. When git fails, the result is empty and the code falls through exactly as before. Regression test in `tests/fm-control-relaunch.test.sh`: `test_relaunch_refuses_the_primary_checkout_under_inherited_git_overrides`. It records `worktree` as the project's primary checkout, then runs `fm-spawn --relaunch` with `GIT_DIR` set to the linked worktree's git directory and `GIT_WORK_TREE` set to the primary checkout. It asserts exit code 1, the "primary home or checkout" error, and that nothing was launched. The test is registered in the suite's run list. Verification: - `bash tests/fm-control-relaunch.test.sh` with the fix: rc=0, all tests pass, including the new one. - With the `fm-spawn.sh` change temporarily reverted: rc=1, and the new test fails with `missing: 'primary home or checkout'`. So it reproduces the reported bypass. - `shellcheck` on both files reports no warnings or errors

---------

Co-authored-by: Trillium Smith <[email protected]>

* fix(bin): read session-lock owner identity without the ps binary (#7609)

* fix(session-lock): read process identity without the ps binary

An EDR-style policy can deny the ps binary's exec itself - observed on
a hardened macOS host where /bin/ps was refused even for 'ps -V', while
kill, head, sysctl, pgrep and lsof all ran. The session lock proved
identity by walking harness ancestry through ps, so the walk died at
its first call: every session in that home became a permanent
lock-refused read-only one, and a live lock owner looked reclaimable,
so a fresh process could take over a lock whose owner was still
running.

All identity reads now go through one fm_proc_info reader. ps stays
primary and is used verbatim wherever it executes, so a host where ps
works is byte-identical to before. Only a ps that cannot execute at
all - bash exit 126 for a refused exec, 127 for a missing binary,
while a pid merely being gone exits ps 1 - routes one read to an OS
provider: /proc on Linux, bin/fm-procinfo.py on macOS, which reads the
ppid through a self-verified KERN_PROC_PID chain and the identity
through the KERN_PROCARGS2 argv region.

That last point is a correctness requirement, not a preference. macOS
'ps -o comm=' reports argv[0] and 'ps -o args=' reports the full argv,
so the ps-free route keys both fields on the same argv region. A
helper that reported the resolved exec path instead disagreed with ps
for renamed, symlinked, or argv[0]-wrapped harnesses, and that
disagreement turns a lock refusal into a wrong take-ownership decision.

Every read fails closed and is verified against the requested pid: no
route guessing, foreign chains still refused, dead pids still stop the
walk. A record that is not exactly one line of three fields with a
numeric ppid is refused rather than loosely sliced.

Two defects found by diffing the change against the unchanged base on
a live host are fixed here as well:

1. A pid ps can see but cannot name - a live process whose comm was
   emptied - was reported as stale, which means reclaimable. The base
   reports unknown for that case, and reporting it stale let a fresh
   process take over a lock whose owner was still running. The ps route
   now reports the pid as present, and the provider route accepts a
   record whose comm field is legitimately empty so both routes agree.

2. The provider record parser rejected a record with an empty field,
   but the field COUNT is what it must pin: a TAB is IFS whitespace, so
   a record with a MISSING field parsed exactly like a record whose
   field was empty. The parser now rebuilds the record from the parsed
   fields and compares it to the original, which proves the count
   without rejecting a legitimate empty field.

Verified against the unchanged base: 120 identity reads and 200 lock
inspections across live pids show zero divergence, and the empty-comm
case reads unknown on both.

* no-mistakes(review): Refuse reclaiming session locks with unreadable owner identity

* no-mistakes(review): Reject partial process identity reads; reclaim non-pid locks

* no-mistakes(review): Preserve platform process identity byte rendering across routes

* no-mistakes(review): Normalize trailing empty argv elements across identity providers

* no-mistakes(document): Document session-lock recovery requirements

* no-mistakes(lint): Fix ShellCheck arithmetic array index style

* fix(session-lock): decide the owner verdict from liveness first, not identity

The review rounds that closed the "a live owner can be taken over" hole
inverted the order of the two facts the verdict is built from: the
provider read decided whether the recorded owner was alive, and liveness
was only consulted afterwards. That order breaks two cases the base
already handled.

A pid this session cannot signal is not a live owner it may reclaim
over, whatever a process table still says about it. A recorded owner
that is gone therefore has to read as gone, or the stale lock can never
be reclaimed and the session stays lock-refused read-only for good -
the exact wedge this change exists to remove. The repository's own
suites pin that: tests/fm-session-lock-ancestry.test.sh asserts that a
recorded pid whose kill -0 fails is left for the ordinary reclaim, and
tests/fm-session-lock-ancestry.test.sh's sibling case asserts that a
recorded pid of 1 - which this session may not signal - is still
reclaimable.

The verdict now asks liveness first and identity second:

  kill -0 succeeds, the provider reads   -> readable
  kill -0 succeeds, the provider fails   -> unreadable: alive, identity
                                            not readable, so the lock
                                            must not be reclaimed
  kill -0 fails, the provider reads      -> unknown: the process exists
                                            but this session may not
                                            signal it, so it is not a
                                            harness this session can
                                            prove - the base's "no live
                                            harness owner"
  kill -0 fails, the provider fails      -> dead

That keeps the protection the review rounds were after - a live owner
whose identity cannot be read is never reclaimable - while restoring the
base's reclaim behaviour for the cases the base handled. The new case
"kill -0 succeeds, the provider fails" is the one that closes the
reported takeover path, and it is unchanged.

Verified on this host: tests/fm-session-lock-ancestry.test.sh exits 0
again (it exits 1 on the previous head, where the recorded-dead-pid case
failed), tests/fm-session-lock-ps-denied.test.sh exits 0, and
tests/fm-gotmp.test.sh exits 0. tests/fm-secondmate-harness.test.sh and
tests/fm-session-start.test.sh still exit 1 with exactly the failures
they have on the unchanged base: this host's restricted PATH lacks
dirname, cat and awk.

* no-mistakes(review): Preserve successful status for unreadable owner verdicts

* fix(session-lock): keep the ppid a walk input, not an identity field

The review round that made a partial identity read refuse the reclaim
extended the rule from the arguments to the parent pid as well: a read
that could not answer ps -o ppid= was treated as an unreadable
identity, so the whole read failed.

The parent pid is not an identity field. The identity the matcher reads
is comm and args, and both of those are still fail-closed: a live
harness whose arguments cannot be read is not reduced to a bare
interpreter name, and its lock is still not reclaimable. The parent pid
is a walk input, and a parent pid that cannot be read only ends the
ancestry walk one hop early - the walk finds no harness and the
session refuses the lock rather than taking one it cannot prove, which
is the conservative direction.

The base read the parent pid exactly this tolerant way, and the
repository's own suites pin it: tests/fm-grok-harness.test.sh and
tests/fm-kimi-harness.test.sh stub ps so that it answers comm= and
args= and refuses every other question, and both expect the lock to be
recognised as held by a live harness. Under the stricter rule both
suites failed with "fm-lock did not recognize grok as a live holder"
and "fm-lock did not acquire from Kimi ancestry".

The provider route is unchanged and stays all-or-nothing: on Linux the
parent pid comes from the same /proc read as the command name, and on
macOS from the same KERN_PROC_PID chain, so a provider read is either
complete or unreadable. The case that proves it - a /proc entry with no
readable cmdline - still refuses the reclaim.

The new test case is corrected rather than dropped: the failed-args
case still has to refuse the reclaim, and the failed-ppid case now
pins the tolerant contract - the verdict stays readable and the parent
pid is empty.

The same commit restores the shellcheck directives on the assignments
inside fm_session_lock_inspect's verdict switch. The globals are read
by bin/fm-lock.sh and bin/fm-inbox.sh, but the assignments inside the
switch had lost their disable comments, so 'Lint 1' failed with SC2034
on FM_LOCK_INSPECT_STATE and FM_LOCK_INSPECT_LIVE_HARNESS.

Verified on this host: tests/fm-session-lock-ps-denied.test.sh exits 0,
tests/fm-session-lock-ancestry.test.sh exits 0,
tests/fm-grok-harness.test.sh exits 0 (it exits 1 before this commit),
tests/fm-kimi-harness.test.sh exits 0 (it exits 1 before this commit),
tests/fm-gotmp.test.sh exits 0, and bin/fm-lint.sh exits 0.

* no-mistakes(document): Clarify session-lock recovery ownership

* no-mistakes(lint): Fix single-iteration ShellCheck loop

* test(session-lock): drop the unused loop variable from the partial-identity case

The failed-args case no longer runs through a loop, so the local that
held the field name is never read, and the lint partition reports it as
an unused variable (SC2034). The declaration loses it; nothing else
about the case changes.

* no-mistakes(review): Protect tagged lock owners; preserve Cygwin identity reads

* no-mistakes(review): Fix zero-form locks; focused tests fail pty-host, ShellCheck warnings

* fix(session-lock): read a classified live harness holder as held

fm_session_lock_inspect lost its identity check on the readable verdict,
so every live holder was classified unknown instead of held: grok and
kimi holders failed the live-holder assertions, and a claude-named
holder made fm-inbox report unknown for a lock that was held.

Decide held from the single fm_harness_process_matches call on the
readable branch. The Windows-tagged pre-block that made the same
decision a second time is removed: fm_session_lock_pid_verdict already
resolves the tagged pid through the Windows table and leaves the same
FM_PROC_COMM/FM_PROC_ARGS, so re-reading it could only let the two
answers diverge, and its winpid/win_rc were the unused bindings
ShellCheck flagged as SC2034.

* no-mistakes(document): Align session-lock docs with the shared reclaim verdict

* fix(session-lock): emit the denied-ps diagnostic once per run

`FM_OS_PROC_DIAG_SHOWN` was set by the diagnostic inside
`triple=$(fm_os_proc_triple "$pid")`, so it died with that
command-substitution subshell and every later ancestor read reprinted the
same cause during one lock acquisition.

`fm_proc_info` now spends the once-per-run guard in the shell that owns
the walk. A cause line exists only on the provider's failure routes, so a
failed read is exactly where that budget is used up; a readable read
leaves it unspent for a later failure.

The new case drives three failing reads in one shell and asserts one
stderr line, then repeats with a readable first pid to prove a successful
read does not spend the budget.

* no-mistakes(document): Correct the denied-ps diagnostic scope to per shell

* no-mistakes(review): Preserve UTF-8 process identity in Linux fallback

* no-mistakes(document): Record the ps-free identity byte rule and helper inventory

* test(session-lock): compare control-byte argv by shape, not by ps bytes

The control-byte route-equivalence case compared the provider record and
the ps record byte for byte. That pins one procps build's choice of byte
for a control byte: 4.0.x writes a space where an argument's newline was
and '?' for other controls, while other builds write '?' for the newline
too, so the same two routes agree on one build and differ on the other
even when both make the same identity decision.

Fold each route's separator byte onto the placeholder the /proc route
writes before comparing, keep the ppid and comm fields a raw comparison,
and assert the fixture's words still straddle the control bytes on both
routes so the case cannot pass by matching a loss. Pin the fold against
both Linux renderings of this fixture's newline and assert those
renderings really differ, so a return to raw bytes fails here instead of
only on the other procps build.

* no-mistakes(document): Align session-lock reclaim docs with the shared verdict

* test(session-lock): keep the base PATH when no python3 shim is added

The e2e blocked-ps case built the child PATH from fakebin alone on a host
without python3, dropping the inherited base path with it. On Linux that
left the /proc provider without the cat and tr it reads through, so the
walk failed for a reason unrelated to the denied ps and the case failed
spuriously on exactly the host it is meant to cover.

Set the base path unconditionally and let the python3 branch only insert
the shim ahead of it.

* no-mistakes(document): Correct session-lock verdict comments and library ownership header

* no-mistakes(document): Correct stale issue pointer in session-lock scope comment

* no-mistakes(document): Correct malformed-lock reclaim wording and ps-denied nudge limit

* fix(session-lock): parse /proc stat fields as stat_fields so rex.sh lints clean

ShellCheck follows source directives: bin/backends/rex.sh sources
bin/fm-agent-process-lib.sh, which sources bin/fm-session-lock-lib.sh, so the
new array local named `fields` made rex.sh's string use of its own `fields`
read as an array/string clash (SC2178/SC2128) and failed CI lane Lint 2 on
6e26ecb, while main's same lane passes.

Rename the array to stat_fields, the name the repo's other /proc stat readers
(bin/fm-remote-job-lib.sh, bin/fm-teardown.sh) already use. Verified with
`shellcheck --norc --external-sources bin/backends/rex.sh` (was rc=1, now
rc=0) and `bin/fm-lint.sh --partition 2of2` locally (rc=0, rex.sh reason=ok).

* no-mistakes(document): Sync session-lock docs and stat-parser comment

* test(run): hint fm-session-lock-ps-denied so the coverage guard stays under its unmeasured share

The new session-lock denial script left 43 of 284 portable serial scripts
without a measured duration hint on CI (main: 42), one past the guard's 15%
bound. Record the 3012ms this run measured, in sorted order beside its
ancestry sibling.

* fix(bin): keep every custom check wake line and payload before acknowledgement (#8031)

* fix(watch): print multi-line check output as one wake line

A custom check that printed several lines queued one row with the lines
joined, but the watcher printed the raw lines, and wake consumers that keep
only prefixed lines (such as the Claude Stop-hook banner) dropped every line
after the first. Flatten the wake line the same way the queued row is
flattened, so both carry every line.

* fix(wake): present every distinct check payload before acknowledgement

The drain kept only the newest row per kind and key, and its acknowledgement
then consumed the hidden rows too. Two different wakes queued by one check
before a drain therefore lost the earlier payload unread. Collapse check
rows only when their payload is identical; signal, stale and heartbeat rows
keep their existing newest-wins collapse.

* feat(bin): check watched tools against published npm and GitHub releases (#3841)

* feat: check published releases for watched tools

* no-mistakes(review): Restore whole-registry validation while retaining published-release checks

* no-mistakes(document): Clarify successful installed-version probe requirement

* fix: retain completed tool sweeps at the budget boundary

* no-mistakes(review): Restore unconditional sweep recording and cadence; focused tests pass

* no-mistakes(review): Correct incomplete sweep recording and cadence documentation

* no-mistakes(document): Drop stale conditional sweep-recording wording from configuration docs

* no-mistakes(review): Require successful probes only for published-release comparison

* test: expect a newer announced version beside the published source

Upstream now reports an announcement naming an installed version only as
update not in effect, so the composition test announces 0.8.4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* no-mistakes(review): Compare published releases with the newest installed copy

* no-mistakes(review): Reject watched tools setting both published and version_url

* no-mistakes(document): Scope curl hardening note to published release reads

---------

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

* fix(bin): restore Claude slash-command submission on Herdr (#6695)

* fix(bin): read a typed slash command above Claude 2.1.291's marked popup row

Claude Code 2.1.291 draws the selected row of its slash-command popup with the
same `❯` marker as its composer, so that row below the composer's closing rule
became the bottom-most bare composer candidate and the whole popup list was
read as the typed command. The Herdr Claude payload proof then judged the
payload unsent, cleared it, and reported send-failed, so `fm-control exit` and
every slash command sent through `fm-send` failed on Herdr.

Demote that row to the proven envelope above it, but only when the envelope's
own glyph row holds typed `/` text (the fallback read can never be empty) and
the row has the popup shape: a leading `/` or a truncated `…` name, then a gap
of two or more spaces before its description. Numbered-choice dialog rows,
one-word drafts, empty composers, and typed prose keep their old reading, and
the head-truncation and placeholder-remainder refusals are unchanged.

Regression tests run against real captures of the 2.1.291 screens. The live
guard gains a /context scenario, and the dated verification record is updated.

* no-mistakes(review): Ghost-strip popup demotion guard; relocate 2.1.291 docs

* no-mistakes(review): Match popup guard to fallback's plain glyph row

* no-mistakes(review): Narrow box popup test; note box follow-up in docs

* no-mistakes(document): Point same-glyph footer rule at 2.1.291 popup exception

* no-mistakes(ci): Both selected Greptile findings are fixed. Only the live test and the verification doc changed; product code and box handling are untouched. The changes are left uncommitted for the outer executor. **ci-2** (tests/fm-herdr-submit-confirm-live-e2e.test.sh) - Invariant: a live delivery check must show that the command actually ran, through its rendered output. An empty composer and a registered agent are not enough. - Fix: after the `/context` verdict, the test now polls the pane the same way the earlier reply check does, until `/context`'s `Context Usage` heading renders. Any other result fails. - I confirmed that heading with a probe in an isolated `fm-lab-` session. The popup's description says "context usage" in lowercase, so the case-sensitive match cannot hit the popup. - The read window is 1000 lines (`--source recent --lines 1000`). The report runs to hundreds of rows here with its heading at the top, so the 200-line window the reply check uses would lose it. - The existing agent-registered and composer-empty checks are kept. The header comment, block comment and pass message were updated to match. **ci-3** (docs/verification/runtime-backends.md) - Invariant: only tests that fail against the previous classifier may be called before-and-after regressions. - I ran each of the five tests on its own against base 5838f105's `bin/fm-composer-lib.sh`: - These 3 fail there and are now labelled before-and-after regressions: `marked_row_is_not_a_second_composer`, `composer_content_..._not_the_composer`, and `send_text_submit_..._proven_and_submitted` (the last one returned 'unknown'). - These 2 pass there and are now labelled guards: `demotion_only_ever_refuses` and `popup_still_refuses_a_partial_payload`. - I corrected one more claim in the same paragraph. It said the live guard fails against the old classifier "at the `/exit` scenario". A live run against the old classifier (session `fm-lab-herdr-submit-con-1106578-15406`) actually fails earlier, at `/context`, with `send-failed`. The doc now says that. - The doc's recorded live output was replaced with the real output of the new run. **Verification** - Live guard on HEAD: `FM_HERDR_SUBMIT_CONFIRM_LIVE=1 ANTHROPIC_MODEL=claude-haiku-4-5-20251001` passed all 4 checks, including "...proves and submits a typed /context behind its command popup and renders its report". It ran in its own session, `fm-lab-herdr-submit-con-1098793-23839`. - Every live run used only its own `fm-lab-` session. Afterwards `herdr session list` shows only `default`, which was never touched. - `tests/fm-composer-lib.test.sh` returned 0 with 47 ok, and `tests/fm-backend-herdr.test.sh` returned 0 with 233 ok. - With the opt-in off, the live test skips with rc 0. - `bin/fm-lint.sh` returned 0 (ShellCheck 0.11.0, actionlint 1.7.12). - Temporary directories were removed. **Gap:** the new check's failure path was never triggered in a live run, because the old classifier fails earlier, at the verdict. That the check can tell a run from no run rests on the probe: the heading is not on screen before submission, and the popup text is lowercase

* no-mistakes(document): Include Tern in popup classifier inheritance documentation

* fix(bin): tolerate slow Herdr worktree entry in fm-spawn (#8139)

* fix(spawn): tolerate slow Herdr worktree entry

Restore shell startup tolerance after out-of-pane leasing, resend the worktree cd once, and diagnose a pane that never moves. Cover delayed and dropped entry portably and ordinary/delayed projected spawns in an isolated real-Herdr lab.

Fixes https://github.com/kunchenguid/firstmate/issues/8138

* no-mistakes(document): Document Herdr worktree cd resend in agent-control

* no-mistakes(ci): I fixed Greptile ci-1. On supported Herdr releases below the presentation floor (0.8.0, including pinned 0.7.4), the live test `tests/fm-herdr-projected-cd-live-e2e.test.sh` reported a correct flat spawn as a failure. Now it skips clearly on those releases. **Invariant:** the test may expect a projected spawn only when the same floor classifier `fm-spawn` uses says projection is the default. **Where it must hold:** the one decision point before the case loop. Both cases (delay 0 and delay 1) assert the `.herdr-presentation` marker, and both sit after that check. **Change (test file only):** after the lab is provisioned, the test calls the existing `fm_backend_herdr_presentation_release_supported` from `bin/backends/herdr.sh`. It goes through the test's fake `herdr`, which routes every call to the named lab session, so the check covers the same client and server `fm-spawn` sees. The result is handled three ways: - **At or above the floor:** the projected and delayed cases run as before. - **Below the floor:** the test prints `skip: Herdr <release> is below the 0.8.0 presentation floor, so spawns stay flat` and exits 0. The cleanup trap still tears down the lab. - **Can't be classified:** the test fails. No production code changed, and the overall Herdr support floor is unchanged. **Verification** (Herdr was only run through `bin/fm-herdr-lab.sh` on its own `fm-lab-` session): - **Above the floor:** on the installed Herdr 0.9.5, both cases pass: "Herdr 0.9.5 projected spawn enters its recorded copy" for delayed=0 and delayed=1. - **Below the floor:** I pointed `HERDR_LAB_HELPER` at a temporary wrapper around the real lab helper. It changes only the `status --json` reply so the client and server report 0.7.4, protocol 17. The test printed "skip: Herdr server version 0.7.4 (protocol 17) is below the 0.8.0 presentation floor, so spawns stay flat" and exited 0. This is simulated, not a real 0.7.4 install. - Afterwards no lab sessions were left over. - `tests/fm-spawn-herdr-lease.test.sh` passed through `bin/fm-test-run.sh`. - `bash -n` is clean. shellcheck shows only the existing SC1091 info note about the sourced `tests/fixtures.sh`. I did not edit the PR body, so its links to issue #8138 are untouched

* no-mistakes(document): Document live projected-cd test's below-floor skip

* feat: report worker status through OSC 7501 (#8011)

* feat(bin): report worker state via OSC 7501 for firstmate-launched agents

Stage 2 of the herdr-core/app staged plan: agents firstmate launches now
report idle/working/blocked/done to their terminal through the OSC 7501
Program Status Protocol, so 7501-aware terminals (herdr-core, the Herdr
app, Ghostty, Rex) show task state without screen inference.

bin/fm-osc7501.sh is armed inside the launch command before the agent
starts. Its watcher folds the task's durable signals (status log,
busy-state, unhandled inbox) into root records with
app=firstmate-<harness> and title=fm-<id>, and parks the record on exit.
Arm emits nothing unless the terminal is known-aware (HC_TERMINAL_ID,
REX_BLOCK/REX_SESSION, TERM_PROGRAM=ghostty) or answers the capability
query, stands down for natively reporting harnesses (claude >= 2.1.295,
pi >= 1.1.0), and never writes to worker input. The env -i floor now
forwards the HC_* pane markers so detection survives an allowlist.

config/osc7501-status gates the feature per home (default on).
The herdr backend is untouched; core/app integration stays Stage 3.

* no-mistakes(review): Fix OSC 7501 reporter tty identity, lifetime, mapping, and stty restore

* no-mistakes(review): Honor hc terminals under herdr; retire superseded status declarations

* no-mistakes(review): Retire stale declarations on any newer busy record

* no-mistakes(review): Drop report command; retire declarations on later inbox steers

* no-mistakes(review): Classify activity via busy lib; confirm reporter retirement

* no-mistakes(review): Order retirement by nanosecond times; drop pull-source turn guess

* no-mistakes(review): Retire declarations only on later steers, with stable thresholds

* no-mistakes(review): Drop probe cache; restore hc socket pinning in floor

* no-mistakes(review): Drop declared-wait mapping; report from single-source signals only

* no-mistakes(review): Give the watcher backend capture for pane-classified harnesses

* no-mistakes(document): Clarify OSC 7501 documentation ownership and Rex compatibility

* no-mistakes(review): Newline-delimit launch disarm; keep arm warnings visible

* no-mistakes(review): Require stand-in pidfile before checking disarm

* no-mistakes(review): Skip status-bridge records in Rex activity readers

* no-mistakes(ci): Fixed Cortex launch assertions mistaking the OSC reporter’s --config for an unsupported Cortex flag, including the sibling xhigh check. Reproduced failure before fix; Cortex suite, bash syntax, and diff checks pass afterward. Full suite failure was downstream of this test failure

* no-mistakes(ci): Removed active terminal capability queries, tty reads/mode changes, and the unused query timeout. Unknown terminals now silently no-op; passive detection remains. Updated docs and behavioral tests. Regression rejects pre-fix code; all 18 reporter tests, syntax checks, ShellCheck (excluding source-resolution notices), and diff checks pass

* no-mistakes(review): Exclude native codex and gate records on activity

* no-mistakes(review): Never write bridge records without known activity

* no-mistakes(review): Probe the launched binary for native reporters

* no-mistakes(review): Arm no reporter for raw launch commands

* no-mistakes(review): Report raw launches only with established agents

* no-mistakes(document): Consolidate OSC reporting documentation ownership

* no-mistakes(ci): Fixed standing captain holds to report blocked kind=question before activity fallback. Added behavioral coverage for idle/busy holds and supersession; confirmed regression fails before the fix and full OSC suite passes afterward. Shell syntax and diff checks passed

* no-mistakes(ci): Fixed the flaky startup-teardown fixture in tests/fm-watcher-lock.test.sh: replace racing recursive deletion with a checked atomic rename, retaining the old inode. Full suite failure was downstream of this shard failure. Complete watcher-lock suite, shell syntax, and git diff checks passed locally

* fix(osc7501): keep the bridge's own record honest when activity reads unknown

The unknown-activity silence that protected a native writer's root record
also left the bridge's own working/blocked on the pane forever - including
past the agent's exit, which never emitted its final record. While the
bridge's last write still stands, the durable signals now keep it honest:
they fold the same way with idle activity and the result is written once
per change, with no hold and no heartbeat. A watcher that never wrote
still stays silent so a native owner is never touched. The final record
likewise lands whenever the bridge's last write stands, keeping done/error
and parking the rest at idle. Rovo and Antigravity, whose only activity
source resolves busy or unknown, thereby still reach idle, blocked, done,
and error. Arm also writes one idle record once every gate passes, clearing
whatever a watcher that died without its final write left on the pane.

* no-mistakes(review): Carry arm-time ownership into watcher, trim osc_seq

* no-mistakes(document): Clarify OSC status lifecycle documentation

* fix(osc7501): park stale terminal lines and clear leftovers on unarmed relaunches

A done/failed status line carries the phase that wrote it, not the turn
now in flight: under unknown activity the fold now reports a terminal line
only when it was stamped at or after the reading that last proved the
worker busy, so an earlier phase's result parks at idle instead of
displaying done or error for a whole turn. A same-second stamp still
counts - a truly older line can never coincide with the last busy reading.

arm's residue clear now runs once the pane's terminal proves 7501-aware
and a leftover pidfile marks the record as the bridge's own, before the
config and native gates - so off and native relaunches retire a dead
watcher's record too, while panes that never armed still see no bytes.

* no-mistakes(review): Order stale results by append; keep result at exit

* no-mistakes(document): Clarify OSC status reporting documentation

* no-mistakes(ci): Replaced the version probe’s unbounded TERM/wait loop with shared fm_run_timed process-group termination and KILL escalation. Added a regression proving worker launch proceeds despite a TERM-resistant probe and descendant; reproduced failure before the fix. All 31 OSC tests pass, including the regression with the bash timeout fallback. Shell syntax and git diff checks pass

* fix(osc7501): disarm writes the final record a dead watcher never could

fm-spawn runs disarm after the agent command returns, so a SIGKILLed
watchers pidfile is removed there - before the next launch ever sees it,
which left the dead watcher's working/blocked record standing on off and
native relaunches. disarm now writes that final record itself (idle,
keeping done/error, exactly osc_final's fold) when the pidfile names no
live reporter; the pidfile carries harness and kind so the write names
the right app= and folds decisions under the worker's real kind. The
real-order regression now exercises SIGKILL -> disarm -> off/native
relaunch.

* no-mistakes(review): Write final record when retirement kills watcher

* no-mistakes(review): Always write final record once retirement confirms

* no-mistakes(lint): Suppress intentional generated-script expansion warning

* feat(bin): add opt-in Linux container check for changed shell tests (#8148)

* feat(bin): add opt-in Linux container check for changed shell tests

* no-mistakes(review): Run Linux check as host user with git clone

* no-mistakes(review): Remove locally deleted files from Linux scratch copy

* no-mistakes(review): Use keep-id for podman in Linux test check

* no-mistakes(ci): Fixed the three selected review findings locally (nothing committed or pushed). ci-2: bin/fm-test-linux.sh now clones with --no-hardlinks, so the container cannot write the host object files. ci-3: tests/linux/Dockerfile now installs python3, nodejs and curl (tools the ordinary suites require); tests/fm-test-linux.test.sh container case adds a tools.test.sh fixture that runs python3, node and curl. ci-4: both the overlay check (line 100) and the prune check (line 104) treat [ -L ] as present; the same fixture commits a dangling symlink and asserts it survives in the container. Verified with FM_TEST_LINUX_CONTAINER=1 bash tests/fm-test-linux.test.sh on Docker: all 4 pass. Mutation check: removing the [ -L ] at line 104 turns the fixture red ("dangling link lost"). Removing it at line 100 alone does not, because the clone already carries committed symlinks; that check only matters for untracked dangling links, which has no fixture. The check stays opt-in

* feat(bin): accept a caller-supplied expected PR head in fm-pr-merge (#8157)

* feat(bin): accept a caller-supplied expected PR head

The merge path read the live head again and used that value for the forge
head match. A push after review could replace the tested commit.
--expected-head takes one full commit, refuses a different live head, and
sends that same value to GitHub, GitLab, and Forgejo.
Callers that omit it keep the live-head match.

Closes #8124

* no-mistakes(review): Drop no-op head pin; test authority and identity refusals

* no-mistakes(review): Inline merge head assignment

* fix(bin): re-arm supervision on Claude StopFailure so error-ended turns are not blind

A Claude turn that ends on an API error runs no Stop phase, so the
Stop-owned auto-arm never fired and the home had no watcher coverage
until external input (observed as 15h and 4.7h blind gaps). Claude
2.1.317 fires StopFailure for those turn ends and honors the same
asyncRewake/exit-2 rewake as Stop, verified live on a herdr-hosted
primary: the tracked auto-arm under StopFailure armed a real watcher,
delivered the queued wake as an unprompted turn, and the chained error
end was suppressed by the new per-cooldown rewake bound instead of
storming.

* no-mistakes(review): Pace StopFailure continuations instead of dropping

* no-mistakes(review): Recheck AFK and need after StopFailure pacing

* no-mistakes(document): Document StopFailure supervision continuity

* no-mistakes(ci): Normalized the validated StopFailure cooldown to base 10. Updated the behavioral pacing regression to use 08 after a cooldown marker exists; it failed before the fix and passes afterward. Full auto-arm test suite, Bash syntax checks, and git diff --check pass. Changes remain local; nothing published

* no-mistakes(ci): Fixed the watcher-lock test’s flaky STOP-and-scan synchronization by pausing at the lock-free poll sleep. Full watcher-lock suite, repeated focused regressions, Bash syntax, and diff checks pass. Full suite failure was downstream of the shard failure. Changes remain local; nothing published

* no-mistakes(document): Clarify StopFailure continuity documentation

---------

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

Labels

full-ci Maintainer go-ahead: run the full CI suite on this outside pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dispatch resolver: honor TYPESAFE_BASE so Jev can run through the Vercel AI Gateway

2 participants