Skip to content

fix: match quota rows through accountKeys aliases - #7465

Closed
pedromuller-del wants to merge 9 commits into
kunchenguid:mainfrom
pedromuller-del:fm/quota-accountkeys-upstream
Closed

pedromuller-del wants to merge 9 commits into
kunchenguid:mainfrom
pedromuller-del:fm/quota-accountkeys-upstream

Conversation

@pedromuller-del

@pedromuller-del pedromuller-del commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Open the upstream issue and the PR for the dispatch account-matching fix, if it is really a bug we found.\n\nDecided behavior for the fix (one reading each):\n- When a candidate's account key equals a schema-6 row's accountKey, that row binds, exactly as today.\n- Otherwise, when the key appears in exactly one row's accountKeys array for that provider, that row binds.\n- When the key appears in two or more rows' accountKeys, no row binds and the candidate stays eligible but unranked (unmeasured), as today for a missing row.\n- When accountKeys is absent, the row behaves as today; when it is present but not an array of non-empty strings, the snapshot is rejected the same way other malformed rows are rejected today.\n- Schema-5 snapshots and the default-row fallback behave exactly as today.\n- Consumers: every caller of quota_row (dispatch resolution and the worker quota helper) gets the new join; no other behavior changes.\n\nThe bug is confirmed: a test at origin/main shows a candidate whose key appears only in a row's accountKeys gets no quota row and is left unranked. quota-axi documents that callers match a row by membership in accountKeys.

What Changed

  • Update shared quota matching for dispatch and worker selection to prefer exact accountKey, then unique same-provider accountKeys membership. Ambiguous matches remain eligible but unranked, even with a default row.
  • Validate optional schema-6 accountKeys as arrays of non-empty strings, allowing whitespace. Preserve schema-5 matching and default fallback for unmatched keys.
  • Document matching precedence and JSON fallback when TOON omits covered keys. Add regression coverage for dispatch resolution and worker quota selection.

Risk Assessment

✅ Low: The shared join matches the approved rules, and the prior fixture fix restores meaningful alias regression coverage without changing runtime behavior.

Testing

Targeted suites and live CLI scenarios passed using isolated quota snapshots and a local rule-selection fixture. Transcripts capture matching, rejection boundaries, and the reproduced pre-fix failure. Cleanup completed.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Resolve a unique provider-specific alias: both consumers use its quota regardless of row order or another provider's matching alias. ✅ pass live Live CLI transcripts: unique-alias-without-default, unique-alias-reversed, unique-alias-before-exhausted-default, pi-lane-alias; boundary transcript: duplicate-alias-same-row.
Resolve an exact account key: its exhausted row wins over healthy aliases and defaults; whitespace-containing aliases remain valid. ✅ pass live Live CLI transcripts: exact-wins-over-two-aliases-and-default, exact-wins-reversed, whitespace-alias-exact-match.
Resolve an alias shared by two rows: the resolver keeps it eligible but unranked, and the worker helper returns none. ✅ pass live Live CLI transcripts: ambiguous-alias-with-default, ambiguous-alias-reversed, ambiguous-alias-without-default.
Supply malformed alias arrays: consumers reject the entire snapshot while preserving whitespace-alias acceptance and the existing accountKey whitespace restriction. ✅ pass live Live CLI transcripts: malformed-accountKeys cases and malformed-empty-alias/resolver; boundary transcript: malformed-unrelated-provider and quota-event checks.
Use legacy snapshots or rows without aliases: schema-5 matching, default fallback, and missing-row uncertainty remain unchanged. ✅ pass live Live CLI transcripts: absent-alias-default-fallback, empty-alias-default-fallback, missing-row-remains-unranked, schema5-provider-match; boundary transcript: schema5-still-ignores-accountKeys.
Evidence: Live CLI transcripts

Source: Live CLI transcripts

CASE unique-alias-without-default/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: clear
  model: local-rule-fixture   latency_ms: 11   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  note: rule matched
  candidate: codex:default  provider=codex  scope=all_models  remaining=80%  spendPriority=0.8334  runway=through_reset  -> eligible
  profile: --harness 'codex' --model 'default'

exit=0 result=pass

CASE unique-alias-without-default/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
codex default

exit=0 result=pass

CASE pi-lane-alias/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: clear
  model: local-rule-fixture   latency_ms: 10   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  note: rule matched
  candidate: pi:credential-alias/gpt-6-astra  provider=codex  scope=all_models  remaining=80%  spendPriority=0.8334  runway=through_reset  -> eligible
  profile: --harness 'pi' --model 'credential-alias/gpt-6-astra'

exit=0 result=pass

CASE stdin-snapshot/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh codex:default
codex default

exit=0 result=pass

CASE unique-alias-reversed/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: clear
  model: local-rule-fixture   latency_ms: 10   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  note: rule matched
  candidate: codex:default  provider=codex  scope=all_models  remaining=80%  spendPriority=0.8335  runway=through_reset  -> eligible
  profile: --harness 'codex' --model 'default'

exit=0 result=pass

CASE unique-alias-reversed/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
codex default

exit=0 result=pass

CASE unique-alias-before-exhausted-default/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: clear
  model: local-rule-fixture   latency_ms: 9   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  note: rule matched
  candidate: codex:default  provider=codex  scope=all_models  remaining=80%  spendPriority=0.8336  runway=through_reset  -> eligible
  profile: --harness 'codex' --model 'default'

exit=0 result=pass

CASE unique-alias-before-exhausted-default/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
codex default

exit=0 result=pass

CASE exact-wins-over-two-aliases-and-default/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: escalate
  model: local-rule-fixture   latency_ms: 10   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  reason: no rankable eligible candidate
  note: rule matched
  candidate: codex:default  provider=codex  scope=all_models  remaining=0%  spendPriority=-  runway=exhausted_now  -> not eligible: runway exhausted_now at all_models

exit=0 result=pass

CASE exact-wins-over-two-aliases-and-default/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
none

exit=1 result=pass

CASE exact-wins-reversed/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: escalate
  model: local-rule-fixture   latency_ms: 9   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  reason: no rankable eligible candidate
  note: rule matched
  candidate: codex:default  provider=codex  scope=all_models  remaining=0%  spendPriority=-  runway=exhausted_now  -> not eligible: runway exhausted_now at all_models

exit=0 result=pass

CASE exact-wins-reversed/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
none

exit=1 result=pass

CASE ambiguous-alias-with-default/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: escalate
  model: local-rule-fixture   latency_ms: 9   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  reason: no rankable eligible candidate
  note: rule matched
  candidate: codex:default  provider=codex  -> eligible, unranked: provider codex has no quota row for account codex-home: disclosed uncertainty

exit=0 result=pass

CASE ambiguous-alias-with-default/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
none

exit=1 result=pass

CASE ambiguous-alias-reversed/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: escalate
  model: local-rule-fixture   latency_ms: 10   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  reason: no rankable eligible candidate
  note: rule matched
  candidate: codex:default  provider=codex  -> eligible, unranked: provider codex has no quota row for account codex-home: disclosed uncertainty

exit=0 result=pass

CASE ambiguous-alias-reversed/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
none

exit=1 result=pass

CASE ambiguous-alias-without-default/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh /Users

... [3246 bytes truncated] ...

s: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  reason: no rankable eligible candidate
  note: rule matched
  candidate: codex:default  provider=codex  -> eligible, unranked: provider codex has no quota row for account codex-home: disclosed uncertainty

exit=0 result=pass

CASE missing-row-remains-unranked/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
none

exit=1 result=pass

CASE whitespace-alias-exact-match/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: clear
  model: local-rule-fixture   latency_ms: 9   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  note: rule matched
  candidate: codex:default  provider=codex  scope=all_models  remaining=80%  spendPriority=0.8341  runway=through_reset  -> eligible
  profile: --harness 'codex' --model 'default'

exit=0 result=pass

CASE whitespace-alias-exact-match/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
codex default

exit=0 result=pass

CASE duplicate-alias-in-one-row/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: clear
  model: local-rule-fixture   latency_ms: 9   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  note: rule matched
  candidate: codex:default  provider=codex  scope=all_models  remaining=80%  spendPriority=0.8342  runway=through_reset  -> eligible
  profile: --harness 'codex' --model 'default'

exit=0 result=pass

CASE duplicate-alias-in-one-row/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
codex default

exit=0 result=pass

CASE schema5-provider-match/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: clear
  model: local-rule-fixture   latency_ms: 9   tokens: -/-
  rule: rule_1 (Validate account matching.)   confidence: 1
  probabilities: rule_1=1 default=0
  note: rule matched
  candidate: codex:default  provider=codex  scope=all_models  remaining=80%  spendPriority=0.8342  runway=through_reset  -> eligible
  profile: --harness 'codex' --model 'default'

exit=0 result=pass

CASE schema5-provider-match/worker
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json --candidate codex:default
codex default

exit=0 result=pass

CASE malformed-accountKeys=null
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE malformed-accountKeys="codex-home"
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE malformed-accountKeys=1
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE malformed-accountKeys=false
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE malformed-accountKeys={}
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE malformed-accountKeys=[""]
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE malformed-accountKeys=["codex-home", 7]
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE malformed-accountKeys=[null]
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE malformed-accountKeys=[[]]
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE accountKey-whitespace-still-invalid
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default

error: invalid quota-axi provider data
exit=2 result=pass

CASE malformed-empty-alias/resolver
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-dispatch-resolve.sh ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/brief.md
dispatch-resolve:
  status: error
  reason: quota-axi --json returned an invalid snapshot
dispatch-resolve: error (quota-axi --json returned an invalid snapshot)
exit=0 result=pass

CASE regression-before-fix
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/base/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default
none

exit=1 result=pass

CASE regression-after-fix
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.account-live-eb09gbe0/quota.json codex:default
codex default

exit=0 result=pass
Evidence: Boundary checks and pre-fix regression

Source: Boundary checks and pre-fix regression

CASE empty-array-default-fallback
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.quota-boundaries-iavd1oul/quota.json codex:default
codex default

exit=0 expected_exit=0 result=pass

CASE absent-array-default-fallback
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.quota-boundaries-iavd1oul/quota.json codex:default
codex default

exit=0 expected_exit=0 result=pass

CASE duplicate-alias-same-row
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.quota-boundaries-iavd1oul/quota.json codex:default
codex default

exit=0 expected_exit=0 result=pass

CASE whitespace-only-alias-accepted
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.quota-boundaries-iavd1oul/quota.json codex:default
codex default

exit=0 expected_exit=0 result=pass

CASE malformed-unrelated-provider-rejects-entire-snapshot
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.quota-boundaries-iavd1oul/quota.json codex:default

error: invalid quota-axi provider data
exit=2 expected_exit=2 result=pass

CASE schema5-still-ignores-accountKeys
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-quota-choose.sh --snapshot ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.quota-boundaries-iavd1oul/quota.json codex:default
codex default

exit=0 expected_exit=0 result=pass

CASE quota-event-accepts-whitespace-alias
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-procevent-quota.sh poll --provider codex --threshold 90 --interval 1 --timeout 3
quota: quota-codex
status: low
detail: {"provider":"codex","accountKey":"codex-home","best":{"scope":"all_models","status":"known","effectivePercentRemaining":80,"boundedBy":["five_hour"],"limitingWindowIds":["five_hour"],"pace":{"status":"behind","worstReservePercentPoints":20.5876,"worstReserveWindowId":"five_hour"},"runway":{"status":"through_reset","projectionConfidence":"established"},"selection":{"status":"known","spendPriority":0.8537}}}
condition_polls: 1

exit=0 expected_exit=0 result=pass

CASE quota-event-rejects-malformed-alias
$ ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/bin/fm-procevent-quota.sh poll --provider codex --threshold 90 --interval 1 --timeout 3
quota: quota-codex
status: error
detail: {"provider":"codex","accountKey":"codex-home","best":{"scope":"all_models","status":"known","effectivePercentRemaining":80,"boundedBy":["five_hour"],"limitingWindowIds":["five_hour"],"pace":{"status":"behind","worstReservePercentPoints":20.5888,"worstReserveWindowId":"five_hour"},"runway":{"status":"through_reset","projectionConfidence":"established"},"selection":{"status":"known","spendPriority":0.8538}}}
condition_polls: 1

exit=0 expected_exit=0 result=pass

CASE current-resolver-test-rejects-original-matcher
$ bash ~/.no-mistakes/worktrees/9cdf64f8f989/01M6RK7HKTP4V9N5AFHA4EYYMY/.quota-boundaries-iavd1oul/base-with-current-tests/tests/fm-dispatch-resolve.test.sh
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 - 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 - schema 6 accepts whitespace in accountKeys without changing exact matching
ok - native Codex binds to codex-home before default, independently of Pi accounts and row order
not ok - a credential key covered only by accountKeys binds to its producer row (missing: '  status: clear')
--- output ---
dispatch-resolve:
  status: escalate
  model: jev-1.13.0   latency_ms: 14   tokens: 812/60
  rule: rule_1 (Codex work.)   confidence: 0.9
  probabilities: rule_1=0.97 default=0.03
  reason: no rankable eligible candidate
  note: rule matched
  candidate: pi:credential-alias/gpt-6-astra  provider=codex  -> eligible, unranked: provider codex has no quota row for account credential-alias: disclosed uncertainty
exit=1 expected_exit=1 result=pass
Evidence: Boundary and regression driver

Source: Boundary and regression driver

#!/usr/bin/env python3
"""Check remaining raw-input boundaries and the corrected regression oracle."""
import copy
import io
import json
import os
from pathlib import Path
import subprocess
import tarfile
import tempfile

ROOT = Path.cwd()
EVIDENCE = Path(__file__).parent
BASE = "65a9a51f099e91c5e2d05c9ae9c3d5e493d51762"
TARGET = "29ff8e20ec4319f5478a88691a99926d6159b2e9"
previous = json.loads((EVIDENCE / "account-matching-live.json").read_text())
records = []


def run(name, argv, env, code, expected):
    result = subprocess.run(argv, env=env, capture_output=True, text=True, timeout=240)
    passed = result.returncode == code and expected in result.stdout + result.stderr
    records.append({"case": name, "command": argv, "exit_code": result.returncode,
                    "stdout": result.stdout, "stderr": result.stderr,
                    "expected_exit": code, "expected_text": expected,
                    "result": "pass" if passed else "fail"})
    assert passed, json.dumps(records[-1], indent=2)
    print(name + ': pass', flush=True)
    return result


try:
    with tempfile.TemporaryDirectory(prefix=".quota-boundaries-", dir=ROOT) as temporary:
        lab = Path(temporary)
        (lab / "tmp").mkdir()
        env = {"PATH": os.environ["PATH"], "LC_ALL": "C", "LANG": "C",
               "TMPDIR": str(lab / "tmp"), "FM_HOME": str(lab),
               "XDG_CONFIG_HOME": str(lab / "xdg-config"), "XDG_CACHE_HOME": str(lab / "xdg-cache")}
        original = json.loads(previous["records"][0]["stdout"])
        snapshot = lab / "quota.json"
        for name, aliases, expected in [
            ("empty-array-default-fallback", [], "codex default"),
            ("absent-array-default-fallback", None, "codex default"),
            ("duplicate-alias-same-row", ["codex-home", "codex-home"], "codex default"),
            ("whitespace-only-alias-accepted", ["codex-home", " "], "codex default")]:
            document = copy.deepcopy(original)
            codex = next(row for row in document["providers"] if row["provider"] == "codex")
            if aliases is None:
                codex.pop("accountKeys", None)
            else:
                codex["accountKeys"] = aliases
            if aliases in (None, []):
                codex["accountKey"] = "default"
            snapshot.write_text(json.dumps(document))
            run(name, [str(ROOT / "bin/fm-quota-choose.sh"), "--snapshot", str(snapshot), "codex:default"], env, 0, expected)

        document = copy.deepcopy(original)
        next(row for row in document["providers"] if row["provider"] == "claude")["accountKeys"] = [8]
        snapshot.write_text(json.dumps(document))
        run("malformed-unrelated-provider-rejects-entire-snapshot", [str(ROOT / "bin/fm-quota-choose.sh"),
            "--snapshot", str(snapshot), "codex:default"], env, 2, "invalid quota-axi provider data")

        document = copy.deepcopy(original)
        document["schemaVersion"] = 5
        for row in document["providers"]:
            row.pop("accountKey", None)
            row["accountKeys"] = 7
        snapshot.write_text(json.dumps(document))
        run("schema5-still-ignores-accountKeys", [str(ROOT / "bin/fm-quota-choose.sh"),
            "--snapshot", str(snapshot), "codex:default"], env, 0, "codex default")

        cache = copy.deepcopy(next(record["input_cache"] for record in previous["records"]
                     if record["case"] == "whitespace-alias-exact-match/producer"))
        cache_file = lab / "quota-cache.json"
        env["QUOTA_AXI_SNAPSHOT"] = str(cache_file)
        cache_file.write_text(json.dumps(cache))
        poll = [str(ROOT / "bin/fm-procevent-quota.sh"), "poll", "--provider", "codex",
                "--threshold", "90", "--interval", "1", "--timeout", "3"]
        run("quota-event-accepts-whitespace-alias", poll, env, 0, "status: low")
        cache["providers"][0]["reuse"]["accountKeys"] = [""]
        cache_file.write_text(json.dumps(cache))
        run("quota-event-rejects-malformed-alias", poll, env, 0, "status: error")

        base_dir = lab / "base-with-current-tests"
        base_dir.mkdir()
        for revision, paths in [(BASE, ["bin"]), (TARGET, ["tests", "docs/examples"])]:
            archive = subprocess.check_output(["git", "archive", revision, *paths])
            with tarfile.open(fileobj=io.BytesIO(archive)) as contents:
                contents.extractall(base_dir, filter="data")
        result = run("current-resolver-test-rejects-original-matcher",
                     ["bash", str(base_dir / "tests/fm-dispatch-resolve.test.sh")], env, 1,
                     "a credential key covered only by accountKeys binds to its producer row")
        lines = (result.stdout + result.stderr).splitlines()
        print(f"Regression oracle: {sum(line.startswith('ok - ') for line in lines)} preceding checks passed; "
              f"{sum(line.startswith('not ok - ') for line in lines)} expected failure; exit={result.returncode}")
finally:
    (EVIDENCE / "account-matching-boundaries.json").write_text(json.dumps(records, indent=2) + "\n")
    transcript = []
    for record in records:
        transcript.extend(["CASE " + record["case"], "$ " + " ".join(record["command"]),
                           record["stdout"].rstrip(), record["stderr"].rstrip(),
                           f"exit={record['exit_code']} expected_exit={record['expected_exit']} result={record['result']}", ""])
    (EVIDENCE / "account-matching-boundaries.txt").write_text("\n".join(transcript))

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ tests/fm-dispatch-resolve.test.sh:1644 - The cloned default row has the alias row's same 80% remaining and 0.8 spendPriority. Consequently, the unique-alias assertions at tests/fm-dispatch-resolve.test.sh:1648 and :1649, plus the reversed-order assertion at :1661, pass with the original exact/default matcher. Suggested fix: add the default row only to the ambiguous fixture at :1663, preserving the original regression checks.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Resolve a unique provider-specific alias: both consumers use its quota regardless of row order or another provider's matching alias. ✅ pass live Live CLI transcripts: unique-alias-without-default, unique-alias-reversed, unique-alias-before-exhausted-default, pi-lane-alias; boundary transcript: duplicate-alias-same-row.
Resolve an exact account key: its exhausted row wins over healthy aliases and defaults; whitespace-containing aliases remain valid. ✅ pass live Live CLI transcripts: exact-wins-over-two-aliases-and-default, exact-wins-reversed, whitespace-alias-exact-match.
Resolve an alias shared by two rows: the resolver keeps it eligible but unranked, and the worker helper returns none. ✅ pass live Live CLI transcripts: ambiguous-alias-with-default, ambiguous-alias-reversed, ambiguous-alias-without-default.
Supply malformed alias arrays: consumers reject the entire snapshot while preserving whitespace-alias acceptance and the existing accountKey whitespace restriction. ✅ pass live Live CLI transcripts: malformed-accountKeys cases and malformed-empty-alias/resolver; boundary transcript: malformed-unrelated-provider and quota-event checks.
Use legacy snapshots or rows without aliases: schema-5 matching, default fallback, and missing-row uncertainty remain unchanged. ✅ pass live Live CLI transcripts: absent-alias-default-fallback, empty-alias-default-fallback, missing-row-remains-unranked, schema5-provider-match; boundary transcript: schema5-still-ignores-accountKeys.
  • bash tests/fm-dispatch-resolve.test.sh with isolated environment: 67 passed, 0 failed, exit 0. Initial attempt had 21 passes and 1 failure from an inherited credential; clearing it resolved the setup failure.
  • bash tests/fm-quota-choose.test.sh with isolated environment: 59 passed, 0 failed, exit 0.
  • python3 account-matching-live.py: 57 command checks passed, exit 0; real resolver, curl, quota-axi snapshot mode, and worker helper, with 16 local HTTP requests.
  • python3 account-matching-boundaries.py: 9 checks passed, exit 0. Current resolver tests against the original matcher produced 57 preceding passes and the expected alias-regression failure, exit 1.
  • git status --porcelain and git diff --exit-code: clean, exit 0. Disposable data and the local HTTP endpoint were removed.
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 2)
✅ **Push** - passed

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @pedromuller-del — clean, well-tested change, and the live evidence (9/9, including the base-regression repro) is exactly what I look for. CI is green on head 67f383de, including no-mistakes, and the PR is mergeable.

My read is contract-class new-default: today's specified matching order in quota-array-dispatch is exact accountKey → default row → unmeasured, and this inserts a new accountKeys alias step ahead of default. So an unconfigured fleet on a current quota-axi (which emits accountKeys on every row) will rank some candidates differently than before. That lines up with quota-axi's own consumer guidance, but it still changes the default dispatch path, so it goes to Kun for a merge-or-leave decision rather than auto-merge.

This is a captain-decision hold — it is not waiting on you, and nothing more is needed from you right now.

@pedromuller-del

Copy link
Copy Markdown
Contributor Author

@kunchenguid friendly ping: this is still green and mergeable on 67f383de, waiting on your merge-or-leave call for the new-default matching order. Happy to adjust anything if you'd rather take a different shape.

@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous test finding is addressed and no new actionable issues remain.

Reviews (2) · Last reviewed commit: "no-mistakes(review): Isolate default fal..." · Reviewed by Greptile

Comment thread tests/fm-dispatch-resolve.test.sh Resolved
@pedromuller-del pedromuller-del changed the title fix: match quota rows by declared credential aliases fix: match quota rows through accountKeys aliases Nov 6, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @pedromuller-del for bringing this up to 29ff8e20 (merge of main, the ambiguous-alias fixture isolation, and the Greptile fix). I re-read the tip against current main.

Gates: coverage guard, repo invariants and no-mistakes all pass; the attestation binds this head with every step completed; live is go 5 of 5; Greptile is 5/5 and the prior P2 thread is resolved. Merge-tree against current main is clean. The red Full suite only means our full-ci label is not on yet.

Contract-class: new-default (unchanged). Exact accountKey → default → unmeasured is still the documented order on main; this inserts producer-declared accountKeys alias matching before default, so an unconfigured fleet on current quota-axi ranks some candidates differently. VISION: all seven rules align; the captain call is the contract class, not a VISION misalign.

Next: nothing is waiting on you. This still goes to Kun for a merge-or-leave decision after the Full suite, not to auto-merge.

pedromuller-del added a commit to pedromuller-del/firstmate-upstream that referenced this pull request Nov 24, 2026
* fix: name the queued rows on the wake acknowledgement line

The drain prints queued rows on stdout and the acknowledgement command on stderr.
A supervisor that discards or filters stdout, or keeps one matching line, still gets the command but loses the rows it acknowledges, so it can acknowledge a row it never read.
The acknowledgement line now carries a bounded summary of the presented rows: count, then sequence, kind, and key for the first five, then a "+K more" tail.
The summary sits before the command text because the daemon and the away-return path parse the command with a pattern anchored to the end of the line.
The three test lines that matched the literal prefix now match the command instead.

Fixes #7286

* no-mistakes(review): List every acknowledged row on the WAKE_ACK_REQUIRED line

* Fix quota account-key matching

Fixes #7463

* no-mistakes(review): Allow whitespace in quota account aliases

* no-mistakes(document): Clarify quota alias validation and matching documentation

* fix(bin): make crew dispatch resolution rank Pi alias lanes and resolve autonomously

The dispatch resolver left firstmate picking profiles by hand in five
ways found by the 2026-10-23 dispatch diagnosis:

- quota_row joined schema 6 snapshots on accountKey only, so a Pi lane
  whose auth provider id quota-axi carries as an accountKeys alias
  never bound to its row and stayed unranked.
- Pi renews a provider session token only on use, so a stale provider
  was never ranked, never dispatched, and never refreshed; the resolver
  now runs one bounded, never-fatal pi auth check per Pi provider the
  live rules name before the quota read.
- Every intake ran quota-axi --json with no --max-age, so a burst of
  intakes could rate-limit a vendor endpoint and flip a stable answer
  to escalate; the read now reuses a snapshot up to 2m old, and the
  quota-axi floor moves to 0.1.54, where --max-age first shipped.
- An answer below the global confidence floor always came back
  ambiguous; the resolver now takes the most probable option that
  clears its own declared floor and marks the note low confidence,
  while approval: captain rules, top-probability ties, and
  declared-floor misses still escalate.
- Date-gated rules stayed selectable after their date because the
  model never sees the current date; a new optional until field drops
  an expired rule before the option list is built.

AGENTS.md now passes a clear resolved profile to fm-spawn unchanged,
with overrides limited to a current captain instruction or a hard
blocker.

Closes #7696

* fix(bin): drop the accountKeys alias hunk; upstream PR #7465 owns it

The captain's 2026-10-23 ownership review found D1 (schema-6 accountKeys
alias binding) already covered by open upstream PR #7465, whose contract
is stricter (unique alias, ambiguous aliases stay unranked, snapshot
validation). This branch keeps D2 (bounded Pi session refresh), D3
(--max-age bounded quota reuse and the 0.1.54 floor), the low-confidence
fallback, the until field, and the AGENTS.md override tightening.

* no-mistakes(review): Fix five dispatch defects with behavioral regression coverage

* no-mistakes(review): Derive healthy quota fixtures from shared compatibility floor

* no-mistakes(document): Correct dispatch documentation and verification scope

* no-mistakes(lint): Fix lint exports and locale-dependent timestamp parsing

* no-mistakes(document): Align dispatch documentation with automatic routing

* chore: re-run CI

* chore: re-run CI

* no-mistakes(review): Record effective rules in low-confidence dispatch evidence

* no-mistakes(document): Remove stale dispatch routing guidance

* chore: sync quota docs with main

* test: cover ambiguous quota aliases with default row

* no-mistakes(review): Isolate default fallback to ambiguous alias fixture

* no-mistakes(document): Correct dispatch confidence and refresh documentation

* no-mistakes(document): Remove stale dispatch confidence claims

* fix: distinguish overdue owners in Stop warnings

Keep stale-beacon refusal and finite stall bounds unchanged.

Refs #4316

* fix: trim required check producers before passing them to jq

* fix: avoid per-line forks in pending reply matching

* 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: remove contradictions from the brief scaffold

The inbox step and relaunch note named find, which most task specs ban.
Ask for a numeric listing instead and name no tool.

Ship setup and scout Rule 2 also contradicted other brief text, so
reword them. Add a precedence sentence after the spec under its own
heading, because the unfilled-placeholder check compares the whole
Firstmate spec body.

* 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]>

* Revert "fix: remove contradictions from the brief scaffold"

This reverts commit 5bf612b2e8fe4f95892760394f4875d18c9e3334.

* 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

* Reapply "fix: remove contradictions from the brief scaffold"

This reverts commit 600b3dff78be975f820115dda70f60d1633eda7c.

* feat: add annotatable Lavish URL snapshots and feedback routing (#8294)

* feat(skills): add lavish-url page capture and feedback routing

Add the /lavish-url skill and bin/fm-lavish-url.sh. `snapshot <url>
[--mobile]` renders a public or local page through chrome-devtools-axi,
rebuilds it through a hostile-input sanitizer (bin/fm-lavish-url.py),
injects the universal review layer with [Fix Layout], [Update Text], and
[Mobile Bug] prompt chips plus every matching enhancer (default, odoo,
teatop), proves the Lavish session is listed open, and arms it through
bin/fm-procevent-lavish.sh arm. `path`, `resolve`, and `owns` locate
snapshots and routes; `route <source-id> <sequence> [--file]` presents a
captured feedback wake through the adapter's read and files it once as a
queued item in the backlog of the registered project that owns the URL's
host, refusing inferred, ambiguous, and unrouted mappings.

Document config/lavish-url-domains, point Lavish wakes for snapshots at the
skill, and add tests/fm-lavish-url.test.sh with its serial duration hint and
changed-path selection.

* no-mistakes(review): Preserve CSS comparisons and remove unused matching interface

* no-mistakes(review): Preserve URL commas when parsing responsive image candidates

* no-mistakes(document): Clarify Lavish URL usage and documentation ownership

* no-mistakes(ci): Captain, fixed all four findings: isolated capture sessions with cleanup, atomic snapshot reservations, safe CSSOM preservation with inaccessible-sheet metadata, and collision-resistant review controls. All 8 behavioral tests, targeted fm-lint.sh, and git diff --check passed. No pipeline or publication actions performed

* no-mistakes(ci): Captain, fixed both findings: captured CSS retains stylesheet order, and snapshot reservation retries only on name collisions. Added behavioral regressions. All 9 focused tests, targeted fm-lint.sh, and git diff --check passed. No pipeline or publication actions performed

* no-mistakes(ci): Captain, replaced the permission-dependent regression with an ENOTDIR injection that exercises the production reservation error path regardless of privileges. It verifies prompt nonzero exit without capture or arming. All 9 focused tests, targeted fm-lint.sh, and git diff --check passed

* no-mistakes(ci): Captain, removed the TeaTop enhancer and references, replaced fixtures with example.test hosts, and retained host-matching coverage using a test-only enhancer. All 9 focused tests, targeted lint, documentation checks, and git diff --check passed. No pipeline or publication actions performed

* test(lavish-url): replace tea/teahouse test fixtures and host with generic portal fixtures

* no-mistakes(document): Clarify Lavish snapshot naming, styles, and metadata

* no-mistakes(ci): Captai…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants