Skip to content

feat(bin): re-raise unanswered PR review threads after an opt-in reply age - #7364

Merged
kunchenguid merged 10 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-7358-review-reraise
Oct 22, 2026
Merged

kunchenguid merged 10 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-7358-review-reraise

Conversation

@tiago-peixoto

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

Copy link
Copy Markdown
Contributor

Intent

Fixes #7358.

Firstmate should re-raise unanswered PR review comments daily, so a PR on a decision hold still gets its review threads answered.

The issue: bin/fm-contributions.sh persists a maintainer comment, review or inline review comment as a pending signal and raises one check wake, and fm-contributions.sh ack removes that token. Nothing ties the acknowledgement to a reply, so once acknowledged the thread is never raised again. On a private project a reviewer's inline comment stayed unanswered for 19 hours: the supervisor acknowledged the review signal while telling the worker not to edit the PR during a decision wait, and nothing re-raised the thread afterwards.

Acceptance: keep ack clearing the immediate wake; stop treating ack as end-of-tracking; re-surface owned PR review threads with no author-side reply after a bounded age (default about 1 day; home-configurable); name the thread URL and age in the wake; cover hold-state cases; add a regression for the 19-hour unanswered-under-hold path. Documented defaults: answered means a reply from the PR author account, and a resolved thread counts as answered.

Later words: make the change opt-in. The unanswered re-raise wake and the GraphQL reviewThreads read stay off unless explicitly configured (FM_CONTRIBUTIONS_REPLY_AGE set to a positive number of seconds), so an unconfigured install behaves exactly as main does today, with no reviewThreads read on any poll. Each maintainer inline comment with no author reply raises its own unanswered wake keyed by its comment id. Validation must refuse a zero-padded zero reply age such as 00 or 000 exactly as it refuses 0.

This branch also merges the current upstream main into the PR branch, with conflicts resolved so both main's change and the 7358 fix keep working.

What Changed

  • bin/fm-contributions.sh and bin/fm-contributions.jq add an opt-in FM_CONTRIBUTIONS_REPLY_AGE setting (positive seconds, refused when zero or zero-padded zero). When set, poll reads the pull request's review threads over GraphQL, keeps a threads[] entry per maintainer inline comment or changes-requested review with no author reply or resolution, and raises an unanswered wake naming the thread URL and age once the thread reaches that age, repeating after each further reply age regardless of hold state. ack still clears only the immediate wake. Threads drop when the PR merges or closes, and arm copies the setting into the generated check shim. Unset, poll makes no review-thread read and records carry no threads[].
  • tests/fm-contributions.test.sh fakes the reviewThreads GraphQL read and adds regressions for the 19-hour unanswered-under-hold path, resolved threads, reply rules, reply-age validation, closed PRs dropping threads, the feature staying off when unconfigured, and arm plumbing the reply age.
  • docs/configuration.md and .agents/skills/bearings/SKILL.md document the setting and how to route an unanswered wake to the owning worker.

Risk Assessment

✅ Low: The re-raise logic, the GraphQL reviewThreads read and the threads[] record field are all gated behind FM_CONTRIBUTIONS_REPLY_AGE, the unconfigured path is proven by a test to make no extra forge read and leave records unchanged, and tracing the 19-hour hold case, the reply rules, the closed-PR path and the off-switch through the jq produced the documented results.

Testing

Ran the two targeted test files on the merged branch (contributions: 64 ok, security: 47 ok, both exit 0), then drove the real script manually against a disposable home with the fixture forge: the acknowledged inline comment under a captain hold was silent at 19h, re-raised at 25h with its URL and age in the wake text and the durable wake queue, re-raised again at 49h after a second ack, and dropped once the author replied; a stranger's reply did not count; an unconfigured install logged zero api graphql calls across three polls and never re-raised, while enabling the setting produced the reviewThreads read and the wake; 0, 00, 000, -5, soon and 1.5 were refused with "invalid reply age" and 03600 accepted; the arm shim exported the setting and the generated check raised the thread with the caller's variable unset; a merged PR cleared threads and unanswered signals. All scenarios passed; no findings.

  • Live validation: ✅ go - 10 of 10 scenarios driven live against the product
Scenario Result Live Evidence
Acknowledged inline review comment under a captain hold is silent at 19h and re-raised at 25h with the thread URL and age, in the printed wake and the durable wake queue ✅ pass live manual-transcript.txt scenario A1-A4; tests/fm-contributions.test.sh test_unanswered_thread_is_raised_again_under_hold
After acknowledging the re-raise, the thread is raised again one reply age later (not every poll), and an author reply in the thread ends tracking and withdraws the signal ✅ pass live manual-transcript.txt scenario A5-A6 (silent at 24h, raised at 49h, threads/pending empty after reply)
A reply from a non-author account does not answer the thread (adversarial) ✅ pass live manual-transcript.txt scenario B: stranger reply r33, re-raise at 25h still fires
A thread the forge reports as resolved counts as answered and is never re-raised ✅ pass live bash tests/fm-contributions.test.sh test_resolved_thread_is_answered (ok)
Only inline comments and CHANGES_REQUESTED reviews with text are tracked; plain issue comments, empty-body change requests and reviews answered by a later APPROVED/DISMISSED verdict are not re-raised ✅ pass live bash tests/fm-contributions.test.sh test_reply_rules (ok)
Unconfigured install (FM_CONTRIBUTIONS_REPLY_AGE unset or empty) makes no reviewThreads GraphQL read on any poll, records no threads, and never re-raises; setting it afterwards turns both on (adversar… ✅ pass live manual-transcript.txt scenario C: 0 api graphql calls over three polls, record has no threads key, 1 graphql call and the wake after enabling; tests/fm-contributions.test.sh test_unanswered_reraise_…
Reply-age validation refuses 0, 00, 000, -5, soon and 1.5 with exit 1, accepts a zero-padded positive value (03600), and treats empty as off (adversarial) ✅ pass live manual-transcript.txt scenario D; tests/fm-contributions.test.sh test_reply_age_is_configurable_and_validated
arm copies a configured reply age into the generated check shim so the watcher honors it, and a shim armed without the setting stays off ✅ pass live manual-transcript.txt scenario E (shim exports FM_CONTRIBUTIONS_REPLY_AGE=3600 and raises 1h wake with caller env unset; re-armed shim silent)
A merged pull request drops its tracked threads and unanswered signals ✅ pass live manual-transcript.txt scenario F; tests/fm-contributions.test.sh test_closed_pull_request_drops_its_threads
Merge with main keeps both sides working: main's many-review readability test and the security test whose fake gh lost its dead reviewThreads branch still pass ✅ pass live fm-contributions-test.log (test_many_reviews_stay_readable ok, exit=0); fm-pr-check-security-test.log (47 ok, exit=0)
Evidence: Manual transcript: real fm-contributions.sh driven against a disposable home (scenarios A-F)

Source: Manual transcript: real fm-contributions.sh driven against a disposable home (scenarios A-F)


\### SCENARIO A: 19-hour unanswered inline comment under a captain hold (FM_CONTRIBUTIONS_REPLY_AGE=86400)
backlog hold line: - [ ] delivery - Contribution delivery https://github.com/o/r/pull/8 (repo: sample) (kind: ship)  (hold: wait for the scope decision) (hold-kind: captain)
forge inline comments: [{"id":31,"user":{"login":"maintainer"},"author_association":"OWNER","body":"Why is this retried?","html_url":"https://github.com/o/r/pull/8#discussion_r31","created_at":"2026-09-16T08:00:00Z","updated_at":"2026-09-16T08:00:00Z","commit_id":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]

\### A1 poll at 2026-09-16T08:01Z: comment arrives, ordinary wake
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-hold 2026-09-16T08:01:00Z
contribution-wake: check: contributions delivery 683480b3af54e240c41318964562a608e1c979940db69f736fb9325d97726ac8
[exit 0]

\### A2 supervisor acknowledges the pending signal
$ ack_pending /tmp/fm-manual-7358.eYCtam/manual-hold
[exit 0]
pending after ack: []

\### A3 poll 19h after the comment (03:00 next day): nothing raised yet
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-hold 2026-09-17T03:00:00Z
[exit 0]
threads in record: [{"key":"review-comment:31","type":"review-comment","source":"https://github.com/o/r/pull/8#discussion_r31","author":"maintainer","at":"2026-09-16T08:00:00Z","raised":"2026-09-16T08:01:00Z"}]

\### A4 poll 25h after the comment: re-raised with URL and age
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-hold 2026-09-17T09:00:00Z
contribution-wake: check: contributions delivery 1232f28f9a8c8bd80f610bc4d2206d21cecefda3d2950db083ec59f9b0e3d550 unanswered https://github.com/o/r/pull/8#discussion_r31 25h
[exit 0]
durable wake queue:
1792641227	1	check	contribution-683480b3af54e240c41318964562a608e1c979940db69f736fb9325d97726ac8	check: contributions delivery 683480b3af54e240c41318964562a608e1c979940db69f736fb9325d97726ac8
1792641229	2	check	contribution-1232f28f9a8c8bd80f610bc4d2206d21cecefda3d2950db083ec59f9b0e3d550	check: contributions delivery 1232f28f9a8c8bd80f610bc4d2206d21cecefda3d2950db083ec59f9b0e3d550 unanswered https://github.com/o/r/pull/8#discussion_r31 25h
pending now: [{"token":"unanswered:review-comment:31:2026-09-17T09:00:00Z","type":"unanswered","thread":"review-comment:31","source":"https://github.com/o/r/pull/8#discussion_r31","head":null,"author":"maintainer","age":"25h","body":"no reply from the contribution author for 25h","task":"delivery","url":"https://github.com/o/r/pull/8"}]
record threads: [{"key":"review-comment:31","type":"review-comment","source":"https://github.com/o/r/pull/8#discussion_r31","author":"maintainer","at":"2026-09-16T08:00:00Z","raised":"2026-09-17T09:00:00Z"}]

\### A5 ack the re-raise, poll 24h later (08:00) -> silent, poll 25h later (09:00) -> raised again at 49h
$ ack_pending /tmp/fm-manual-7358.eYCtam/manual-hold
[exit 0]
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-hold 2026-09-18T08:00:00Z
[exit 0]
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-hold 2026-09-18T09:00:00Z
contribution-wake: check: contributions delivery bb045b195bed108d456fb1437a2c20a2c2832760f3ac090dee57ea496d3d09a0 unanswered https://github.com/o/r/pull/8#discussion_r31 49h
[exit 0]
notified unanswered tokens kept: ["unanswered:review-comment:31:2026-09-18T09:00:00Z"]

\### A6 the author replies in the thread; later polls stay silent and tracking ends
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-hold 2026-09-18T10:05:00Z
[exit 0]
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-hold 2026-09-20T10:00:00Z
[exit 0]
record threads/pending: {"threads":[],"pending":[]}

\### SCENARIO B: a reply from a non-author account does NOT answer the thread (adversarial)
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-stranger 2026-09-16T09:01:00Z
contribution-wake: check: contributions delivery 683480b3af54e240c41318964562a608e1c979940db69f736fb9325d97726ac8
[exit 0]
$ ack_pending /tmp/fm-manual-7358.eYCtam/manual-stranger
[exit 0]
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-stranger 2026-09-17T09:30:00Z
contribution-wake: check: contributions delivery 70238d0d49fa2f3a437603b0f0688f27472ad7a9b9420ccd3cc27e30145af806 unanswered https://github.com/o/r/pull/8#discussion_r31 25h
[exit 0]

\### SCENARIO C: unconfigured install (no FM_CONTRIBUTIONS_REPLY_AGE) never reads reviewThreads and never re-raises
$ poll_off 2026-09-16T08:01:00Z
contribution-wake: check: contributions delivery 683480b3af54e240c41318964562a608e1c979940db69f736fb9325d97726ac8
[exit 0]
$ ack_pending /tmp/fm-manual-7358.eYCtam/manual-off
[exit 0]
$ poll_off 2026-09-18T09:00:00Z
[exit 0]
$ poll_off 2026-09-25T09:00:00Z
[exit 0]
graphql calls made by fake gh: 0
distinct gh call kinds:
      3 api repos/o/r
      3 api repos/o/r/commits/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/check-runs
      3 api repos/o/r/commits/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/statuses
      3 api repos/o/r/issues/8/comments
      3 api repos/o/r/pulls/8
      3 api repos/o/r/pulls/8/comments
      3 api repos/o/r/pulls/8/reviews
      3 pr view
record has threads key: false

\### C2 switch it on: the graphql reviewThreads read appears and the thread is raised
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-off 2026-09-27T09:00:00Z
contribution-wake: check: contributions delivery 4143d8075f9ad4c9e6ab37f19b820adaba100075df8406a5649ed3aded648e50 unanswered https://github.com/o/r/pull/8#discussion_r31 265h
[exit 0]
graphql calls now: 1
api graphql --paginate --slurp -f owner=o -f name=r -F number=8 -f query=query($owner:String!,$name:String!,$number:Int!,$endCursor:String){repository(owner:$ow

\### SCENARIO D: reply-age validation refuses 0, 00, 000, -5, soon, 1.5, empty-is-off, accepts 03600
$ FM_CONTRIBUTIONS_REPLY_AGE=0 poll -> exit 1: fm-contributions: invalid reply age
$ FM_CONTRIBUTIONS_REPLY_AGE=00 poll -> exit 1: fm-contributions: invalid reply age
$ FM_CONTRIBUTIONS_REPLY_AGE=000 poll -> exit 1: fm-contributions: invalid reply age
$ FM_CONTRIBUTIONS_REPLY_AGE=-5 poll -> exit 1: fm-contributions: invalid reply age
$ FM_CONTRIBUTIONS_REPLY_AGE=soon poll -> exit 1: fm-contributions: invalid reply age
$ FM_CONTRIBUTIONS_REPLY_AGE=1.5 poll -> exit 1: fm-contributions: invalid reply age
$ FM_CONTRIBUTIONS_REPLY_AGE=03600 poll -> exit 0: contribution-wake: check: contributions delivery 683480b3af54e240c41318964562a608e1c979940db69f736fb9325d97726ac8
$ FM_CONTRIBUTIONS_REPLY_AGE= (empty) poll -> exit 0: 

\### SCENARIO E: arm copies a configured reply age into the generated check shim
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-arm 2026-09-16T08:01:00Z
contribution-wake: check: contributions delivery 683480b3af54e240c41318964562a608e1c979940db69f736fb9325d97726ac8
[exit 0]
$ ack_pending /tmp/fm-manual-7358.eYCtam/manual-arm
[exit 0]
[arm exit 0]
generated shim:
    #!/usr/bin/env bash
    export FM_HOME=/tmp/fm-manual-7358.eYCtam/manual-arm
    export FM_STATE_OVERRIDE=/tmp/fm-manual-7358.eYCtam/manual-arm/state
    export FM_DATA_OVERRIDE=/tmp/fm-manual-7358.eYCtam/manual-arm/data
    export FM_CONTRIBUTIONS_REPLY_AGE=3600
    exec ~/.no-mistakes/worktrees/5284051b2355/01M5GS2NWMN00DAD7E98P88NE7/bin/fm-contributions.sh poll
$ run the shim with the variable unset in the caller env at +1.5h -> contribution-wake: check: contributions delivery 8361df51d461662840bc13f6a5046f39c7ee3ceb21a3a8953fc01ce20a253fbc unanswered https://github.com/o/r/pull/8#discussion_r31 1h
[exit 0]
shim re-armed without the setting mentions REPLY_AGE: 0
$ run unconfigured shim at +2d -> [exit 0]

\### SCENARIO F: merged pull request drops threads and unanswered signals
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-merged 2026-09-16T08:01:00Z
contribution-wake: check: contributions delivery 683480b3af54e240c41318964562a608e1c979940db69f736fb9325d97726ac8
[exit 0]
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-merged 2026-09-17T09:00:00Z
contribution-wake: check: contributions delivery 1232f28f9a8c8bd80f610bc4d2206d21cecefda3d2950db083ec59f9b0e3d550 unanswered https://github.com/o/r/pull/8#discussion_r31 25h
[exit 0]
$ poll_at /tmp/fm-manual-7358.eYCtam/manual-merged 2026-09-18T09:00:00Z
[exit 0]
record: {"state":"merged","threads":[],"pending":["review-comment"]}

(disposable homes under /tmp/fm-manual-7358.eYCtam are removed by the test lib EXIT trap)
Evidence: Manual driver script

Source: Manual driver script

#!/usr/bin/env bash
# Drives the real bin/fm-contributions.sh against a disposable FM_HOME whose
# forge is the fake gh from tests/fm-contributions.test.sh. Reuses that file's
# fixture helpers (never its test functions) so the forge shape is identical.
set -u
ROOT_WT=${1:?worktree}
cd "$ROOT_WT" || exit 1
T=tests/fm-contributions.test.sh
# Print one helper function: from its definition line to its closing brace,
# ignoring braces inside the fake-gh heredoc (<<'SH' ... SH) it may contain.
fn() { awk -v n="$1" '$0 ~ "^"n"\\(\\) *\\{" {p=1} p {print} p && /<<.SH.$/ {h=1} p && h && /^SH$/ {h=0; next} p && !h && /^}/ {p=0}' "$T"; }
. tests/lib.sh
TMP_ROOT=$(fm_test_tmproot fm-manual-7358)
NOW=2026-09-16T08:00:00Z
HEAD_A=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
HEAD_B=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
eval "$(fn new_home)"; eval "$(fn record)"; eval "$(fn mutate_record)"
eval "$(fn forge_home)"; eval "$(fn with_home)"; eval "$(fn wrap_forge)"
eval "$(fn unanswered_home)"; eval "$(fn ack_pending)"
poll_at() { with_home "$1" env FM_CONTRIBUTIONS_REPLY_AGE=86400 FM_CONTRIBUTIONS_NOW="$2" "$ROOT/bin/fm-contributions.sh" poll; }
show() { printf '\n### %s\n' "$*"; }
run() { printf '$ %s\n' "$*"; "$@"; printf '[exit %s]\n' "$?"; }

show "SCENARIO A: 19-hour unanswered inline comment under a captain hold (FM_CONTRIBUTIONS_REPLY_AGE=86400)"
home=$(unanswered_home manual-hold)
printf 'backlog hold line: '; grep ' delivery ' "$home/data/backlog.md"
printf 'forge inline comments: '; jq -c . "$home/forge/inline.json"
show "A1 poll at 2026-09-16T08:01Z: comment arrives, ordinary wake"
run poll_at "$home" 2026-09-16T08:01:00Z
show "A2 supervisor acknowledges the pending signal"
run ack_pending "$home"
printf 'pending after ack: '; with_home "$home" "$ROOT/bin/fm-contributions.sh" pending | jq -c .
show "A3 poll 19h after the comment (03:00 next day): nothing raised yet"
run poll_at "$home" 2026-09-17T03:00:00Z
printf 'threads in record: '; jq -c '.records[0].threads' "$home/data/delivery/contributions.json"
show "A4 poll 25h after the comment: re-raised with URL and age"
run poll_at "$home" 2026-09-17T09:00:00Z
printf 'durable wake queue:\n'; cat "$home/state/.wake-queue"
printf 'pending now: '; with_home "$home" "$ROOT/bin/fm-contributions.sh" pending | jq -c .
printf 'record threads: '; jq -c '.records[0].threads' "$home/data/delivery/contributions.json"
show "A5 ack the re-raise, poll 24h later (08:00) -> silent, poll 25h later (09:00) -> raised again at 49h"
run ack_pending "$home"
run poll_at "$home" 2026-09-18T08:00:00Z
run poll_at "$home" 2026-09-18T09:00:00Z
printf 'notified unanswered tokens kept: '; jq -c '[.records[0].notified[] | select(startswith("unanswered:"))]' "$home/data/delivery/contributions.json"
show "A6 the author replies in the thread; later polls stay silent and tracking ends"
jq -n --arg head "$HEAD_A" '[{id:31,user:{login:"maintainer"},author_association:"OWNER",body:"Why is this retried?",html_url:"https://github.com/o/r/pull/8#discussion_r31",created_at:"2026-09-16T08:00:00Z",updated_at:"2026-09-16T08:00:00Z",commit_id:$head},
  {id:32,in_reply_to_id:31,user:{login:"author"},author_association:"NONE",body:"Fixed in the next push",html_url:"https://github.com/o/r/pull/8#discussion_r32",created_at:"2026-09-18T10:00:00Z",updated_at:"2026-09-18T10:00:00Z",commit_id:$head}]' > "$home/forge/inline.json"
run poll_at "$home" 2026-09-18T10:05:00Z
run poll_at "$home" 2026-09-20T10:00:00Z
printf 'record threads/pending: '; jq -c '.records[0] | {threads,pending}' "$home/data/delivery/contributions.json"

show "SCENARIO B: a reply from a non-author account does NOT answer the thread (adversarial)"
home=$(unanswered_home manual-stranger)
jq -n --arg head "$HEAD_A" '[{id:31,user:{login:"maintainer"},author_association:"OWNER",body:"Why is this retried?",html_url:"https://github.com/o/r/pull/8#discussion_r31",created_at:"2026-09-16T08:00:00Z",updated_at:"2026-09-16T08:00:00Z",commit_id:$head},
  {id:33,in_reply_to_id:31,user:{login:"stranger"},author_association:"NONE",body:"me too",html_url:"https://github.com/o/r/pull/8#discussion_r33",created_at:"2026-09-16T09:00:00Z",updated_at:"2026-09-16T09:00:00Z",commit_id:$head}]' > "$home/forge/inline.json"
run poll_at "$home" 2026-09-16T09:01:00Z
run ack_pending "$home"
run poll_at "$home" 2026-09-17T09:30:00Z

show "SCENARIO C: unconfigured install (no FM_CONTRIBUTIONS_REPLY_AGE) never reads reviewThreads and never re-raises"
home=$(unanswered_home manual-off)
wrap_forge "$home"
poll_off() { with_home "$home" env -u FM_CONTRIBUTIONS_REPLY_AGE FM_CONTRIBUTIONS_NOW="$1" "$ROOT/bin/fm-contributions.sh" poll; }
run poll_off 2026-09-16T08:01:00Z
run ack_pending "$home"
run poll_off 2026-09-18T09:00:00Z
run poll_off 2026-09-25T09:00:00Z
printf 'graphql calls made by fake gh: %s\n' "$(grep -c 'api graphql' "$home/forge/calls" || true)"
printf 'distinct gh call kinds:\n'; awk '{print $1, $2}' "$home/forge/calls" | sed -E 's/[?].*//' | sort | uniq -c
printf 'record has threads key: '; jq -c '.records[0] | has("threads")' "$home/data/delivery/contributions.json"
show "C2 switch it on: the graphql reviewThreads read appears and the thread is raised"
run poll_at "$home" 2026-09-27T09:00:00Z
printf 'graphql calls now: %s\n' "$(grep -c 'api graphql' "$home/forge/calls" || true)"
grep 'api graphql' "$home/forge/calls" | head -1 | cut -c1-160

show "SCENARIO D: reply-age validation refuses 0, 00, 000, -5, soon, 1.5, empty-is-off, accepts 03600"
home=$(unanswered_home manual-validate)
for bad in 0 00 000 -5 soon 1.5; do
  printf '$ FM_CONTRIBUTIONS_REPLY_AGE=%s poll -> ' "$bad"
  out=$(with_home "$home" env FM_CONTRIBUTIONS_REPLY_AGE="$bad" "$ROOT/bin/fm-contributions.sh" poll 2>&1); rc=$?
  printf 'exit %s: %s\n' "$rc" "$out"
done
printf '$ FM_CONTRIBUTIONS_REPLY_AGE=03600 poll -> '
out=$(with_home "$home" env FM_CONTRIBUTIONS_REPLY_AGE=03600 "$ROOT/bin/fm-contributions.sh" poll 2>&1); printf 'exit %s: %s\n' "$?" "$out"
printf '$ FM_CONTRIBUTIONS_REPLY_AGE= (empty) poll -> '
out=$(with_home "$home" env FM_CONTRIBUTIONS_REPLY_AGE= FM_CONTRIBUTIONS_NOW=2026-09-18T09:00:00Z "$ROOT/bin/fm-contributions.sh" poll 2>&1); printf 'exit %s: %s\n' "$?" "$out"

show "SCENARIO E: arm copies a configured reply age into the generated check shim"
home=$(unanswered_home manual-arm)
run poll_at "$home" 2026-09-16T08:01:00Z
run ack_pending "$home"
with_home "$home" env FM_CONTRIBUTIONS_REPLY_AGE=3600 "$ROOT/bin/fm-contributions.sh" arm >/dev/null; echo "[arm exit $?]"
printf 'generated shim:\n'; sed 's/^/    /' "$home/state/contributions.check.sh"
printf '$ run the shim with the variable unset in the caller env at +1.5h -> '
with_home "$home" env -u FM_CONTRIBUTIONS_REPLY_AGE FM_CONTRIBUTIONS_NOW=2026-09-16T09:30:00Z bash "$home/state/contributions.check.sh"; echo "[exit $?]"
with_home "$home" env -u FM_CONTRIBUTIONS_REPLY_AGE "$ROOT/bin/fm-contributions.sh" arm >/dev/null
printf 'shim re-armed without the setting mentions REPLY_AGE: '; grep -c REPLY_AGE "$home/state/contributions.check.sh"
printf '$ run unconfigured shim at +2d -> '
with_home "$home" env -u FM_CONTRIBUTIONS_REPLY_AGE FM_CONTRIBUTIONS_NOW=2026-09-18T09:30:00Z bash "$home/state/contributions.check.sh"; echo "[exit $?]"

show "SCENARIO F: merged pull request drops threads and unanswered signals"
home=$(unanswered_home manual-merged)
run poll_at "$home" 2026-09-16T08:01:00Z
run poll_at "$home" 2026-09-17T09:00:00Z
printf 'merged\n' > "$home/forge/state"
run poll_at "$home" 2026-09-18T09:00:00Z
printf 'record: '; jq -c '.records[0] | {state:.observation.state,threads,pending:[.pending[].type]}' "$home/data/delivery/contributions.json"
printf '\n(disposable homes under %s are removed by the test lib EXIT trap)\n' "$TMP_ROOT"
Evidence: tests/fm-contributions.test.sh output (64 ok, exit 0)

Source: tests/fm-contributions.test.sh output (64 ok, exit 0)

ok - only required-captain contributions are rows; other actors are counted
ok - replaced-head verdict is stale and cannot create a captain requirement
ok - unchecked ownership is disclosed and cannot prove silence
ok - newest check with no verdict is distinct from passing and pending
ok - new maintainer comment wakes once and stays pending until acknowledged
ok - new maintainer review wakes once and stays pending until acknowledged
ok - new maintainer inline wakes once and stays pending until acknowledged
ok - ready-for-pr on a filed issue becomes a planning wake
ok - a fresh open issue remains measured maintainer triage
ok - an absent check lane remains missing across repeated observations
ok - mixed freshness retains measured captain work and discloses the gap
ok - malformed durable evidence cannot prove silence
ok - a transient ready-for-pr label wakes and its exact acknowledgement survives replay
ok - recorded judgment keeps its exact head and is stale immediately on a published replacement
ok - verdict help and refusal name exactly the actors the command accepts
ok - a current forge observation refreshes a verdict after a replacement
ok - an unavailable current head leaves verdict freshness unknown
ok - away yolo delivery is fleet work without granting merge authority
actionable: PR https://github.com/o/r/pull/8 is registered but its ready line did not reach the parent channel (rc=3)
ok - cross-home away yolo delivery is fleet work
ok - retired ownership persists and unsupported forge remains visibly unmeasured
ok - unsupported forge coverage is disclosed without inventing fleet work
ok - held unsupported forge coverage remains unmeasured
ok - unsupported ownership stays silent and unmeasured; legacy errors clear without fabricated evidence
ok - legacy cleanup preserves unsupported ownership and supported missing-evidence failure in the same file
ok - shared contribution signal wakes once while retaining both acknowledgements
ok - watcher keeps observer diagnostics separate from contribution wakes
ok - expired child unsupported-forge coverage remains unmeasured
ok - watcher surfaces one newly durable contribution signal without re-ringing it
ok - parent consumes measured child coverage and refuses expired child silence
ok - unreadable pending signals refuse an empty-inbox claim
ok - record task identity is the directory dirname/basename named
ok - snapshot and pending create nothing in a home without state
ok - budget exhausted mid-observation (exhaust) keeps the prior record and stays silent
ok - budget exhausted mid-observation (hang) keeps the prior record and stays silent
ok - a genuine forge failure inside the budget still records the error, its cause and wakes
ok - one HTTP 500 is retried once and a successful retry stays healthy
ok - two transient failures wake once and name the failed read in the record
ok - an HTTP 404 is reported without retrying
ok - real gh error shapes drive the intended retry decision and keep their error
ok - a URL never inherits the previous URL read diagnostic
jq: error (at /tmp/fm-contributions.bYOAwg/after.json:1): null (null) cannot be matched, as it is not a string
ok - a URL owned by two tasks is observed once and every owner receives the result
ok - a merged or closed contribution settles once, is not re-read, and never wakes again
ok - a late owner inherits a terminal observation without a forge read or wake
ok - a retry converges every owner whose saved row is not terminal, keeping its own acknowledgement state
ok - an open PR linked from a done task keeps being observed
ok - a later URL waits when fewer than fifteen seconds remain for its observation
ok - eight 3-second PR reads complete fresh within one 20-second poll cycle
ok - a read killed at the five-second bound is budget refusal and stays silent
ok - rotation preserves timed-out records and refreshes every slow PR on successive cycles
ok - the effective budget is cut down to the watcher per-check bound with margin
ok - generated checks enforce configured and inherited budgets at runtime
ok - a genuinely unavailable forge records an error and wakes once per failure episode
ok - a late owner does not restart a shared forge failure episode
ok - retire stops the unavailable check, leaves rotation and restores complete coverage
ok - a late owner settled beside a retired final record stays unretired and known
ok - retire is idempotent and refuses non-captain, unknown, malformed and signal-bearing pairs
ok - an acknowledged unanswered thread under a hold is raised again after a day, daily, until the author replies
ok - a resolved thread with no reply counts as answered
ok - only inline threads and reviews requesting changes with text, no author reply, resolution or later verdict are tracked as unanswered
ok - the reply age is a validated seconds setting
ok - a closed pull request stops raising its threads
ok - the unanswered re-raise and the review-thread read stay off unless a reply age is configured
ok - arm copies a configured reply age into the generated check
ok - a many-review PR stores only classified review fields and stays readable
exit=0
Evidence: tests/fm-pr-check-security.test.sh output (47 ok, exit 0)

Source: tests/fm-pr-check-security.test.sh output (47 ok, exit 0)

ok - raw-byte parser accepts canonical URLs and rejects the complete adversarial matrix
ok - GitLab merge requests are followed on any instance and never wake falsely
ok - Forgejo poll reads one pull request by number through tea api and wakes only on merged true
ok - Forgejo login match parses tea's JSON in every line shape, in the helper and the static poll
ok - the Gerrit watch wakes only on an explicit merged status and never on submittability
ok - Gerrit arming records no patch set revision and the merge path refuses to submit
ok - Gerrit arming accepts a published HEAD only by the change's current patch set tree
ok - a no-mistakes Gerrit ready report requires the pipeline's fixes recovered into the published copy
ok - validated merged polls notify once and retire before the next watcher cycle
ok - a repeat identical merged poll for an already-notified task is absorbed, never queued as a main-blocking row
ok - a failed upward merge report keeps its poll armed for repair and retry
ok - staged self-merge and poll interleavings are never silent
ok - queued merges retain their away authority after captain return
ok - poll distinguishes attended authorization from external landing
ok - accepted merge authority refuses rebound task metadata
ok - accepted merge authority persists under the lifecycle lock
ok - teardown cannot race merged-poll authority consumption
ok - poll retirement preserves a replacement authority record
ok - a merge detected by the poll is reported upward from a secondmate home exactly once
ok - a different merged PR for the same task gets its own first notification
ok - a merged poll on a persistent secondmate retires silently: no outcome, marker, or wake, and every lifecycle artifact preserved
ok - queue, receipt, and every fixed-path removal crash point recover without loss or repeated execution
ok - open/red, closed-unmerged, malformed, and forge errors remain armed until an exact merged transition
ok - replacement, nonterminal, tampered, and custom results receive no deletion authority
ok - queue failure and untrusted receipts preserve canonical poll evidence
ok - GitHub and GitLab exact merged results share one retirement path
ok - PR and teardown entrypoints reject invalid arguments before every side effect
ok - arming refuses a draft pull request, naming it, and arms a ready or unreadable one
ok - fm-pr-check refuses to record a PR or arm a merge watch on a secondmate record
ok - fm-pr-check refuses to register a PR whose named head is only in the worker copy
ok - fm-pr-check refuses a direct-PR registration while a later commit is only in the copy
ok - valid direct and merge flows record exact metadata and reject multiline head metadata
ok - rejected metacharacter bytes remain inert at generation and watcher time
ok - static poll is silent except for one merged line and remains watcher-bounded
ok - interrupted atomic preparation cleans private temporaries and publishes nothing
ok - concurrent watchers observe only complete private poll publications
ok - poll publication paths refuse symlinks and directories
ok - live poll and custom-check artifacts require private single-link files
ok - a poll armed before a volume renumber is re-recorded under the control lock and keeps detecting merges
ok - a renumbered registration is never re-recorded around a tampered artifact: swapped-check altered-check swapped-sidecar altered-sidecar altered-template-hash wrong-mode hardlinked-check split-device foreign-device, or a pending retirement
ok - direct re-arm publication waits without replacing an armed poll
ok - device re-record publication waits without rewriting its registration
ok - post-rename poll validation faults revoke both names and allow a clean retry
ok - bootstrap does not rewrite unauthenticated checks or emit retired migration diagnostics
ok - watcher signals promptly stop custom checks and clean private state
ok - returned custom check descendants are drained on installed and fallback timeout paths
ok - teardown removes safe poll artifacts and refuses directory-shaped check files without traversal
exit=0
Evidence: 19-hour hold path: wake text and durable queue
$ poll_at <lab>/manual-hold 2026-09-16T08:01:00Z
contribution-wake: check: contributions delivery 683480b3...6ac8
(ack) pending after ack: []
$ poll_at <lab>/manual-hold 2026-09-17T03:00:00Z # 19h: silent
$ poll_at <lab>/manual-hold 2026-09-17T09:00:00Z # 25h
contribution-wake: check: contributions delivery 1232f28f...d550 unanswered https://github.com/o/r/pull/8#discussion_r31 25h
durable wake queue:
... check contribution-1232f28f...d550 check: contributions delivery 1232f28f...d550 unanswered https://github.com/o/r/pull/8#discussion_r31 25h
(ack) $ poll_at 2026-09-18T08:00:00Z # 24h after re-raise: silent
$ poll_at 2026-09-18T09:00:00Z
contribution-wake: ... unanswered https://github.com/o/r/pull/8#discussion_r31 49h
(author replies r32) $ poll_at 2026-09-18T10:05:00Z # silent
record threads/pending: {"threads":[],"pending":[]}

$ FM_CONTRIBUTIONS_REPLY_AGE=0 poll -> exit 1: fm-contributions: invalid reply age
$ FM_CONTRIBUTIONS_REPLY_AGE=00 poll -> exit 1: fm-contributions: invalid reply age
$ FM_CONTRIBUTIONS_REPLY_AGE=000 poll -> exit 1: fm-contributions: invalid reply age
$ FM_CONTRIBUTIONS_REPLY_AGE=03600 poll -> exit 0

unconfigured install, 3 polls: graphql calls made by fake gh: 0; record has threads key: false
after enabling: graphql calls now: 1

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 warning
  • ⚠️ tests/fm-pr-check-security.test.sh:144 - The fake gh in this test answers any api graphql call containing reviewThreads with an empty page. Commit c627bfe added it when the observer read review threads on every poll. Commit bc46554 then made that read opt-in, and this test never sets FM_CONTRIBUTIONS_REPLY_AGE, so the observer never asks and this branch is dead fixture code. No intent requirement needs it: the intent says an unconfigured install makes no reviewThreads read on any poll, which this test exercises. Recommend removing the six-line case branch so the fixture again answers only the reads the observer makes.

🔧 Fix applied.
2 warnings still open:

  • ⚠️ tests/fm-pr-check-security.test.sh:144 - The fake gh in this test answers any api graphql call containing reviewThreads with an empty page. Commit c627bfe added it when the observer read review threads on every poll. Commit bc46554 then made that read opt-in, and this test never sets FM_CONTRIBUTIONS_REPLY_AGE, so the observer never asks and this branch is dead fixture code. No intent requirement needs it: the intent says an unconfigured install makes no reviewThreads read on any poll, which this test exercises. Recommend removing the six-line case branch so the fixture again answers only the reads the observer makes.
  • ⚠️ tests/fm-contributions.test.sh:1655 - The new unanswered_home helper patches the hold into backlog.md with sed -i &#39;&lt;script&gt;&#39; file, which only GNU sed accepts. BSD/macOS sed reads -i with a mandatory suffix argument, so it takes the script text as the backup suffix and the file path as the script, fails, and the helper returns an empty home path under set -e. All seven new tests (test_unanswered_thread_is_raised_again_under_hold through test_arm_plumbs_the_reply_age_into_the_check_shim) then fail on a macOS host. CI is not affected because the macOS job runs only the two snapshot tests, but bin/fm-test-run.sh and CONTRIBUTING.md treat stock macOS as a local test host, and ten other test files use the portable form sed -i.bak ... file &amp;&amp; rm -f file.bak. Remedy: use the .bak form and remove the backup, matching the repo convention. The only other suffix-less site, tests/fm-control-relaunch.test.sh:2628, predates this change and is outside its scope.

🔧 Fix applied.
1 warning still open:

  • ⚠️ tests/fm-pr-check-security.test.sh:144 - The fake gh in this test answers any api graphql call containing reviewThreads with an empty page. Commit c627bfe added it when the observer read review threads on every poll. Commit bc46554 then made that read opt-in, and this test never sets FM_CONTRIBUTIONS_REPLY_AGE, so the observer never asks and this branch is dead fixture code. No intent requirement needs it: the intent says an unconfigured install makes no reviewThreads read on any poll, which this test exercises. Recommend removing the six-line case branch so the fixture again answers only the reads the observer makes.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 10 of 10 scenarios driven live against the product
Scenario Result Live Evidence
Acknowledged inline review comment under a captain hold is silent at 19h and re-raised at 25h with the thread URL and age, in the printed wake and the durable wake queue ✅ pass live manual-transcript.txt scenario A1-A4; tests/fm-contributions.test.sh test_unanswered_thread_is_raised_again_under_hold
After acknowledging the re-raise, the thread is raised again one reply age later (not every poll), and an author reply in the thread ends tracking and withdraws the signal ✅ pass live manual-transcript.txt scenario A5-A6 (silent at 24h, raised at 49h, threads/pending empty after reply)
A reply from a non-author account does not answer the thread (adversarial) ✅ pass live manual-transcript.txt scenario B: stranger reply r33, re-raise at 25h still fires
A thread the forge reports as resolved counts as answered and is never re-raised ✅ pass live bash tests/fm-contributions.test.sh test_resolved_thread_is_answered (ok)
Only inline comments and CHANGES_REQUESTED reviews with text are tracked; plain issue comments, empty-body change requests and reviews answered by a later APPROVED/DISMISSED verdict are not re-raised ✅ pass live bash tests/fm-contributions.test.sh test_reply_rules (ok)
Unconfigured install (FM_CONTRIBUTIONS_REPLY_AGE unset or empty) makes no reviewThreads GraphQL read on any poll, records no threads, and never re-raises; setting it afterwards turns both on (adversar… ✅ pass live manual-transcript.txt scenario C: 0 api graphql calls over three polls, record has no threads key, 1 graphql call and the wake after enabling; tests/fm-contributions.test.sh test_unanswered_reraise_…
Reply-age validation refuses 0, 00, 000, -5, soon and 1.5 with exit 1, accepts a zero-padded positive value (03600), and treats empty as off (adversarial) ✅ pass live manual-transcript.txt scenario D; tests/fm-contributions.test.sh test_reply_age_is_configurable_and_validated
arm copies a configured reply age into the generated check shim so the watcher honors it, and a shim armed without the setting stays off ✅ pass live manual-transcript.txt scenario E (shim exports FM_CONTRIBUTIONS_REPLY_AGE=3600 and raises 1h wake with caller env unset; re-armed shim silent)
A merged pull request drops its tracked threads and unanswered signals ✅ pass live manual-transcript.txt scenario F; tests/fm-contributions.test.sh test_closed_pull_request_drops_its_threads
Merge with main keeps both sides working: main's many-review readability test and the security test whose fake gh lost its dead reviewThreads branch still pass ✅ pass live fm-contributions-test.log (test_many_reviews_stay_readable ok, exit=0); fm-pr-check-security-test.log (47 ok, exit=0)
  • bash tests/fm-contributions.test.sh (all 64 cases incl. the 7 new thread tests and main's test_many_reviews_stay_readable; exit 0)
  • bash tests/fm-pr-check-security.test.sh (47 cases; exit 0 after the dead reviewThreads fake-gh branch was removed, proving an unconfigured poll never asks for it)
  • Manual driver manual-driver.sh in the evidence directory: real bin/fm-contributions.sh poll|pending|ack|arm against a disposable FM_HOME whose fake gh is the test suite's fixture forge, scenarios A-F (19h hold path, non-author reply, opt-in off/on with gh call log, reply-age validation, arm shim, merged PR)
  • Verified git status --short is clean and the driver's temp homes were removed
⚠️ **Document** - 1 info
  • ℹ️ docs/configuration.md:2642 - The example environment block does not list FM_CONTRIBUTIONS_REPLY_AGE. I left it out on purpose: the block also omits the sibling contribution settings FM_CONTRIBUTIONS_BUDGET and FM_CONTRIBUTIONS_MAX_AGE, and the ownership bullet at docs/configuration.md:105 already names the setting, its unit and its default and points to the script header as the owner. Adding one contribution setting to the block would start a partial copy of the header. If a future change decides the block should carry every FM_ setting, add all three contribution settings together in that change.
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @tiago-peixoto — first full review of #7364 vs main fc8972cd.

Diff read (own tip-vs-main): ack still clears only the immediate pending token; open-PR maintainer inline threads and non-empty CHANGES_REQUESTED reviews stay in threads[] until author reply, resolve, or reviewer APPROVED/DISMISSED; after FM_CONTRIBUTIONS_REPLY_AGE (default 86400) poll raises unanswered with URL and age, including under captain hold; GraphQL reviewThreads for resolution; regressions cover the 19h-under-hold path. Attestation MATCH (f420dff1). Live: 5/7 go against cli/cli#12942 (author-reply / merged covered by fake-forge only — accepted for this restore).

Contract-class: restore (FM-LEARN-CLAIMS ignored on self-label; own read matches the ready-for-pr acceptance on #7358). Ack was retiring the reply obligation without a reply — VISION rule 4 says obligations close only on the durable answering event. Bounded re-raise restores that. R1–R5/R7 align; R6 neutral.

CI: tip run 38802012943 — Behavior portable serial 2 and serial 5 cancelled at the 30m ceiling (known #7255 / #6790). I re-ran the failed jobs once. No merge until those required checks are green on this head. Nothing waiting on the captain.

@tiago-peixoto tiago-peixoto changed the title fix(bin): raise unanswered review threads again after acknowledgement feat(bin): re-raise unanswered maintainer review threads on contribution PRs Oct 17, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @tiago-peixoto for merging main in and re-attesting. The attestation matches head 49a452fb (live validation go, 4 of 6 scenarios live), and the branch merges cleanly.

CI: run 39036386532 is green except Behavior portable serial 2, which failed in tests/fm-supervision-host.test.sh ("the host-only transition veto changed Pi's existing offer rule"). This PR only touches the contributions observer, its tests, the bearings skill and the docs. That suite passes on main, so I'm treating the failure as unrelated and re-ran the failed job once. Nothing for you to do there.

A correction on classification (my mistake earlier): my 2026-10-15 stamp called this restore. On a closer tip-vs-main read I'm reclassifying it as new-default. On main, ack retiring the token is the documented behavior. This PR adds a new default-on unanswered wake (daily by default, raised whatever the hold state) plus a GraphQL reviewThreads read on every poll. It's a well-motivated addition, but it's new unconfigured behavior, not a broken default being restored. So once CI is green, Kun will make the merge-or-leave call himself. That's a captain decision hold, not something waiting on you.

One small optional clarification: the Intent says several maintainer comments in one inline conversation "share one root-keyed wake", but the Testing note says the fake-forge check raised two wakes for two comments. If you can, a one-line note on which one is the intended behavior would help Kun decide.

@tiago-peixoto

Copy link
Copy Markdown
Contributor Author

Per-comment is the intended behavior: each maintainer inline comment with no author reply raises its own unanswered wake, keyed by that comment id, so two comments in one conversation raise two wakes, as the Testing note shows. The Intent sentence about one root-keyed wake is wrong.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate.

Thanks @tiago-peixoto for clarifying — per-comment wakes (one unanswered wake per maintainer inline comment, keyed by its comment id) is clear now, and it matches the Testing note. If you get a moment, please correct the Intent sentence about one root-keyed wake in the PR body so the description matches the code; that's a tidy-up, not a blocker.

Head 49a452fb unchanged since my last look; attestation still matches, branch merges cleanly.

CI: run 39036386532 is green except Behavior portable serial 2: attempt 1 failed in the unrelated tests/fm-supervision-host.test.sh suite and attempt 2 was cancelled at the 30-minute job ceiling (known #7255 issue, unrelated to this PR). I've re-run the failed job once more.

contract-class: new-default (unchanged from my 2026-10-17 correction): this adds a new default-on unanswered wake class plus a reviewThreads read each poll. VISION.md: aligns (closes a real reply obligation by record, scripted exact test, GitHub-only like the existing observer), with one thing for Kun to weigh: per-comment wakes can add recurring noise on a busy review.

This is a captain-decision hold, not waiting on you: once serial 2 is green, Kun makes the merge-or-leave call himself.

@tiago-peixoto
tiago-peixoto force-pushed the fm/upstream-7358-review-reraise branch from 49a452f to 2cdb1ed Compare October 17, 2026 21:32
@tiago-peixoto tiago-peixoto changed the title feat(bin): re-raise unanswered maintainer review threads on contribution PRs feat(bin): re-raise unanswered contribution review threads when opted in Oct 17, 2026
@tiago-peixoto

Copy link
Copy Markdown
Contributor Author

Changed to opt-in in the latest commits: the unanswered re-raise wake and the reviewThreads read stay off unless configured, so an unconfigured install behaves exactly as main does today. The Intent now describes per-comment wakes.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate.

Thanks @tiago-peixoto — the opt-in change landed well. I read head 2cdb1edd against main myself: with FM_CONTRIBUTIONS_REPLY_AGE unset, poll makes no reviewThreads read, records carry no threads[], no unanswered signal is raised, arm writes no reply-age line, and the ordinary one-shot wakes and their text are unchanged. The new test_unanswered_reraise_is_off_unless_configured and test_arm_plumbs_the_reply_age_into_the_check_shim pin that. The Intent now matches the per-comment wakes too. Thank you for that.

contract-class: opt-in (updated from my earlier new-default: the re-raise wake and the GraphQL read now stay off unless the captain sets a reply age).

Where it stands: no-mistakes is green on this head and the branch merges cleanly. CI run 39071361005 is green except Behavior portable serial 2, which was cancelled at the 30-minute job ceiling. That's the known #7255 runner issue and has nothing to do with this PR. I've re-run that job once. If it goes green, this is in line to be merged on the next triage pass. Nothing for you to do right now.

Acknowledging a maintainer signal removed the only record of the thread,
so a comment nobody answered was never raised again, including while its
task sat on a hold.

Poll now tracks each unanswered maintainer comment, review and inline
review comment on an open pull request until the contribution author
replies in it or it is resolved, and raises it again once it is a day old
(FM_CONTRIBUTIONS_REPLY_AGE) and daily after that. The wake names the
comment URL and its age.
…change. The serial 4 failure is a timing flake that this change did not cause. Serial 6 (tests/fm-pr-check-security.test.sh, "retired poll left task-a.check.sh"): this PR adds one more forge read to the contribution observer, a paginated `gh api graphql` query for reviewThreads. The test's fake `gh` answered every `api graphql` call with merge-state key=value lines. The observer rejected that output and raised the wake "contributions: observation unavailable ... review thread pages returned an unexpected shape". That wake ended the watcher cycle before the merged task-a poll retired. Invariant: the fake forge must answer every read the contribution observer makes, in that read's real shape. The other contribution reads (comments, reviews, inline comments, checks, statuses, repo) were already faked. The new reviewThreads query was the only read missing. Fix: tests/fm-pr-check-security.test.sh now answers any `api graphql` call containing reviewThreads with one empty reviewThreads page. The merge-state graphql answer is unchanged. Verified: I reproduced the failure locally before the fix. The test also passes on base fc8972c with that commit's bin/. After the fix, `bash tests/fm-pr-check-security.test.sh` exits 0 with all 47 cases ok. The only other test whose fake `gh` handles `api graphql` and runs the contribution path is tests/fm-pr-merge.test.sh. It prints no "unexpected shape" text. It fails locally with "github-zero-exit-queue-required: refusal did not name the concrete observed state", and it fails the same way on base fc8972c. So that failure predates this change, and it is not among the failing CI checks. Serial 4 (tests/fm-remote-reply.test.sh, "the NUL-bearing line was not captured"): this is a 40-second wait (800 polls of 0.05 seconds) for a procevent result in the remote-reply stream, and it timed out on CI. The test does not use fm-contributions or any file this PR changes. It passed locally twice (42 ok, exit 0), so this is CI load flakiness outside this change. I made no code change for it
The re-raise wake and the reviewThreads read now run only when
FM_CONTRIBUTIONS_REPLY_AGE is set to a positive number of seconds.
An unconfigured install polls exactly as before: no review-thread read,
no threads[] entry and no unanswered signal. arm copies a set value into
the generated check so the watcher honors it.
FM_CONTRIBUTIONS_REPLY_AGE=00 and 000 passed validation as positive ages.
They now fail like 0 does.
@tiago-peixoto
tiago-peixoto force-pushed the fm/upstream-7358-review-reraise branch from 2cdb1ed to 39367b5 Compare October 18, 2026 13:10
@tiago-peixoto tiago-peixoto changed the title feat(bin): re-raise unanswered contribution review threads when opted in feat(bin): re-raise unanswered PR review threads after an opt-in reply age Oct 18, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @tiago-peixoto for the rebase and the zero-padded reply-age fix.

I compared new head 39367b53 with the head I reviewed last time (2cdb1edd). The first five commits are unchanged apart from the rebase onto 1aa2a21e. The one new commit, 39367b53, only tightens FM_CONTRIBUTIONS_REPLY_AGE validation so that 00/000 are refused like 0, and it adds a test. With the setting unset, nothing changes: no reviewThreads read, no threads[], no unanswered signal, and no shim line, same as main.

contract-class: opt-in (unchanged). VISION: all seven rules still align, as in my last note. no-mistakes is green on this head, and your live validation covers 6 of 6 scenarios, including the unconfigured install.

Where it stands: CI run 39130406441 is green except Behavior portable serial 2. That job was cancelled at the 30-minute job ceiling, which is the known #7255 runner issue, not this PR. I re-ran that job once. If it goes green and the branch still merges cleanly, this gets merged. Nothing for you to do.

@kunchenguid
kunchenguid merged commit 6df1548 into kunchenguid:main Oct 22, 2026
19 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

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

Final check on head 4b19fa7d against main df9eb03a: the three new commits only fix the wake-header comment, make the test helper's sed -i portable, and drop the reviewThreads branch from the security test's fake gh. That branch isn't needed because the read is off by default. With FM_CONTRIBUTIONS_REPLY_AGE unset, poll makes no reviewThreads read, writes no threads[], and raises no unanswered wake, so an unconfigured home behaves exactly as main did. Contract-class: opt-in. VISION: all seven rules align, same as my 10-18 note. The attestation matched this head, live validation passed 10 of 10, and all 19 checks were green. Landed as 6df15481.

tiago-peixoto added a commit to tiago-peixoto/firstmate that referenced this pull request Oct 25, 2026
* feat(bin): add fm-capacity.sh to report open lanes and host headroom (#6973)

Adds bin/fm-capacity.sh, a read-only, network-free report of open ship/scout lanes against an optional config/lane-capacity target plus host load, memory and disk headroom. Without config/lane-capacity it reports counts only and gives no dispatch-hold advice. Docs, operational-home-layout skill entry, a gated AGENTS.md pointer, and tests/fm-capacity.test.sh.

* fix(bin): bound repeat stale alarms for unknown-but-alive progressing panes (#7437)

* fix: bound unknown-live watcher alarms

* no-mistakes(review): Gate unknown-alive stale bound on progress; fix arm CONFIG

* no-mistakes(review): Keep watch.env loading only in the watcher arm

* no-mistakes(review): Seed worktree progress before first unknown-alive alarm in test

* no-mistakes(document): List config/watch.env in operational home layout

* no-mistakes(review): Narrow watch.env docs to arm-launched watchers

---------

Co-authored-by: Kun Chen <[email protected]>

* fix(bin): honor explicit no-run verdict in crew-state (#5888)

* fix(bin): honour the no-run verdict from axi status in crew-state

* no-mistakes(review): Honor authoritative no-run verdict across fallbacks

* no-mistakes(lint): Quote no-run sentinel to satisfy ShellCheck

* no-mistakes(document): document authoritative no-run verdict in crew-state attribution

* fix(composer): recognize Grok approval-titled borders (#6132)

* fix(composer): accept Grok 1.0.44 approval-titled bottom border as empty composer

* no-mistakes(document): Document Grok’s aligned approval title

* no-mistakes(ci): Captain, removed the unused test variable that failed Lint 1. ShellCheck, the composer suite, and the remote provisioning test pass locally. Behavior portable serial 9 failed during fixture cloning in an unchanged test, before composer behavior was exercised; no further code change is warranted for that failure

* no-mistakes(review): drop dead approval guard, make Grok fixtures locale-independent widths

* fix(bin): stop shellcheck re-expanding fm-wake-lib in teardown

Lint 1 dies when ShellCheck expands bin/fm-wake-lib.sh twice from
bin/fm-teardown.sh. The top-level source already names that file. Point
the second directive at /dev/null and leave the runtime source unchanged.

* docs: record Grok 1.0.44's approval-titled composer border

The verification record scoped its titled-bottom-border note to the Grok
1.0.5 three-column overhang but never recorded the newer shape this branch
accepts, so a maintainer could not tell the two cases apart or know what a
Grok upgrade re-verifies.

Add a dated record of the 1.0.44 shape - the typed model/effort title plus
its ` · always-approve` suffix, drawn inside a rounded bottom border at the
aligned width - with the live verdicts that prove it, the portable test that
owns it, and the fail-safe verdict every neighbouring title keeps.

* no-mistakes(review): Narrow Grok composer coverage claims to verified matrix

* no-mistakes(document): Correct stale Grok verification notes

* docs: trigger CI re-run for flaky shard 4

Behavior portable serial 4 failed on the previous head with one assertion
only, `not ok - the NUL-bearing line was not captured`, in the unchanged
remote-reply and relay path; its fixture hardcodes /bin/sleep, direct NUL
ingestion passes, and the other 19 checks were green. GitHub refused a job
re-run for this fork PR, so this empty commit is the re-trigger. No content
change.

* no-mistakes(document): Clarify Grok live guard verification scope

* fix(composer): restrict Grok approval titles to rounded borders

Reject light, heavy, double, and ASCII approval-title boxes at the shared
classifier boundary. Only the rounded family has recorded live evidence,
and an empty verdict grants permission to type into the pane.

Cover denied families through tmux and cursorless backend profiles while
preserving rounded idle, draft, malformed-title, and legacy behavior.

* no-mistakes(document): Refresh Grok composer verification evidence

* no-mistakes(ci): Fixed the stale local link in `docs/verification/runtime-backends.md`; the section heading’s anchor had changed. `tests/fm-documentation-audiences.test.sh` passes

* fix(bin): point non-checkout omp homes at fm <project> relaunch (#7155)

* fix(omp): point non-checkout homes at fm <project> relaunch and name why the extension is not loaded

* no-mistakes(review): Remove unset-FM_HOME omp watch cause line

* feat(fm-watch): bound consecutive wedge escalations behind an opt-in cap (#7552)

* feat(fm-watch): bound consecutive wedge escalations per worker window

An unattended watcher escalation loop once burned ~359M tokens in a day: the
watcher keeps re-escalating a pane it believes is wedged, and nothing bounded
how many times it did that for one worker window.

Add an opt-in ceiling on consecutive wedge escalations for a single window.
At FM_WEDGE_MAX_ESCALATIONS the watcher publishes one terminal
PERMANENTLY-WEDGED wake and writes both cap markers, after which the wedge
path short-circuits for that window until FM_CAP_HORIZON_SECS elapses or an
operator removes both markers. A pane hash change alone does not re-engage
while the window-scoped marker stands, so a pane that re-renders on every poll
cannot rebuild the counter and re-fire every bound. A failed marker write rolls
the cap state back rather than amplifying one write failure into a wake-queue
flood, and a rollback that itself fails leaves a transient sentinel that holds
the wedge path quiet for FM_ROLLBACK_SENTINEL_TTL_SECS.

FM_WEDGE_MAX_ESCALATIONS defaults to 0, so the unconfigured path keeps today's
behavior exactly. Each setting is validated the way the rest of the file
validates its environment settings and falls back to its default on a
non-numeric value; a zero horizon or sentinel TTL falls back too rather than
degrading into a re-fire loop.

Tests drive the watcher as a real process through its public environment
surface, and a separate opt-in live guard exercises a real tmux pane holding a
wedged process in a disposable lab home built by bin/fm-lab-home.sh, covering
both halves of the contract: the cap engaging, and the cap releasing itself on
the horizon with no operator action.

* no-mistakes(review): fix(fm-watch): bound the wedge cap honestly

* test(fm-watch): make the wedge-cap live guard a falsifiable comparison

The live guard demonstrated the ceiling but could not falsify it, and it
advertised evidence that did not survive its own run.

Register both new suites in bin/fm-test-run.sh. Unregistered they fell into
the unclassified catch-all, which put the live guard outside the repo-wide
live-gate sweep at tests/fm-live-gate.test.sh - the sweep that proves every
live guard refuses together on FM_LIVE=0. The wedge-cap suite joins
watcher-wake-lock and the live guard joins live-harness-optin; the serial
lane passes no live-capability --fail-on-gate-skip token, so CI gating is
unchanged.

Run the unceiled baseline and the ceiled arm back to back on the same
workload, one differing setting, in one transcript. The baseline at the
shipped default of 0 shows the train of five consecutive wakes the cap
exists to bound; the ceiled arm at 3 shows one terminal PERMANENTLY-WEDGED
wake and then silence. State plainly in the transcript that the motivating
incident happened at the default, so it motivates the ceiling and is not
itself evidence the ceiling engaged.

Correct the post-horizon assertion. It required the terminal marker on the
very first cycle after the horizon, which the reset escalation counter makes
false: the first post-horizon wake is an ordinary escalation and the bound is
reached one cycle later. Assert the lane is audible, not which marker it
carries.

Reprint the transcript to stdout before cleanup, so the run ends in one
self-contained evidence block instead of a pointer to the temp file this
script is about to delete. Source tests/wake-helpers.sh for hash_text, and
define PANE_TEXT in this script's own scope, so no unbound-variable or
command-not-found line can appear inside the evidence a reviewer reads.

Document in docs/configuration.md what the cap covers and does not: it bounds
the wedge timer where a busy pane crosses FM_BUSY_TURN_MAX_SECS, it does not
cover the non-terminal first-sight stale surface, only a pane leaving the
stale path clears the markers, and a cap fire resets the consecutive-deferral
budget of a wedge-evidence guard because that guard is not consulted while
the cap is silencing the window.

* no-mistakes(review): fix(fm-watch): release wedge cap markers on every episode-ending reset

* no-mistakes(review): derive the live guard's window key the way the watcher does

* no-mistakes(review): fix(fm-watch): probe dead endpoints under the wedge cap, scope terminal rows per episode

* no-mistakes(review): fix(fm-watch): cap the dead-endpoint probe, real degraded fallback

* fix(fm-watch): release the wedge cap through one episode-ending choke point

The cap's release invariant - every reset that ends a wedge episode drops the
cap markers with it - was wired at two inline sites and two more were missed.
One of the misses is surface_nonterminal_stale, the hot path that ends the
episode marker on every non-terminal stale poll, so the cap's episode tracking
was broken in the common case rather than the rare one and a genuine new wedge
after a pause-and-resume stayed silent for the full horizon.

Enumeration had already failed once, so wiring the two missing sites would look
finished and be incomplete again. Make the invariant structural instead: one
choke point, wedge_episode_end, now performs every removal of the
.stale-since-<key> episode marker and clears the cap markers with it, and a new
assertion in the test fails on any direct rm of that marker outside it.

keep-counter=1 marks a route that only restarts the escalation count while the
wedge timer keeps aging. That is the same episode, not a new one, so the cap
markers are deliberately not cleared there; an existing triage test pins that
behaviour and it is unchanged.

Both proofs are falsification-tested. The completeness assertion and the
behavioural case each fail against the pre-fix watcher, and the behavioural case
additionally fails when only the surface_nonterminal_stale wiring is reverted
while the choke point still exists, so it pins the hot path specifically rather
than passing because some other route happened to release the markers.

The cap stays window-scoped with no per-hash marker, still defaults to off, and
still releases on the horizon. The episode-scoped terminal row stays one per
episode under the append lock, the documented first-sight containment stays, and
the dead-endpoint-before-silencing work is untouched.

* no-mistakes(review): fix(wm-watch): release wedge cap on every episode-end route

* no-mistakes(review): fix(fm-watch): gate cap markers, probe under sentinel, release churn

* no-mistakes(review): fix(fm-watch): release wedge cap on the away first sight

* no-mistakes(review): fail safe the wedge escalation-count write under a configured cap

* no-mistakes(test): fix wedge-cap live guard leaking its temp root

* no-mistakes(review): fix(fm-watch): keep the wedge ladder reachable under a fired cap

* no-mistakes(review): fix(fm-watch): pace the sentinel dead-record probe by threshold

* no-mistakes(test): fix(test): give the wedge-cap suite its serial-lane weight hint so its CI shard fits the 30-minute job cap

* no-mistakes(document): align wedge-cap docs with implemented release boundary

* fix(docs): correct the cap markers' lifetimes in the layout reference

The state/ listing claimed .wedge-permanent-<key> "only sits on disk until a
later cap fire overwrites it". That is false: bin/fm-watch.sh:1214-1219
_wedge_cap_markers_clear removes .wedge-permanent-<key>, .wedge-terminal-queued-<key>
and .wedge-rollback-failed-<key> outright, and it runs on every cap release,
so a release takes the marker off disk rather than leaving it for a later cap
fire to overwrite.

The same clause also left the other two markers' lifetimes and delete
semantics unstated. Each now carries its own lifetime, and the sentence
records that a cap release drops all three while only the two silencing
markers re-engage a window when deleted by hand.

Verified against bin/fm-watch.sh: FM_CAP_HORIZON_SECS bounds the cap marker
via _wedge_cap_marker_stands, FM_ROLLBACK_SENTINEL_TTL_SECS bounds the
rollback-failure sentinel, and the terminal-row marker records the episode
that queued the row and is dropped with the rest of the cap state.

* no-mistakes(document): state the watcher's cap release boundary in its header comment

* fix(fm-watch): make the wedge escalation-counter reset opt-in

The upstream maintainer reviewed the wedge-cap pull request, accepted the
live validation, and asked for the escalation-counter reset to become
opt-in: it should only kick in when the cap is configured, so a home that
has not set anything keeps today's behaviour and still gets the
deep-inspection prompt for a stuck pane.

The choke point wedge_episode_end gained a third state. The call sites
whose pre-cap shape kept the escalation counter - the first-sight stale
surfaces, where upstream dropped the wedge timer and left the count
standing - now pass keep-count, so the counter survives them exactly as
upstream's did while the cap is unconfigured. With a configured cap the
count still restarts with the released episode, which is what lets a
re-wedged window escalate from 1 again past a released marker. The other
episode-ending routes are unchanged: the pre-cap watcher reset the count
there too, so those keep resetting it in both postures.

The new parity suite proves the property rather than asserting it: it
drives one stuck-pane scenario against upstream main's own bin/ tree and
against this branch, and requires the same observable outcome for the
unconfigured case - the same ladder, the same demand-deep-inspection
prompt, no cap marker. A configured cap in the same harness fires
PERMANENTLY-WEDGED at its threshold, which is what shows the setting
really reaches the watcher, so the unconfigured cases cannot pass
vacuously.

* no-mistakes(review): fix(fm-watch): bound the wedge cap settings to a comparable range

The review step's fix agent produced this change but its own turn hit the
30-minute invocation budget, so the gate failed the step with the work
uncommitted. The work is preserved in the gate's recovery ref and in the
task's saved round patch; this commit carries it forward unchanged.

bash's test cannot compare a decimal integer outside its own range: the
comparison ERRORS rather than evaluating false, and every later comparison
of such a value therefore reads as false. A value such as
99999999999999999999 passed the digit check unchanged, so the cap never
engaged - the unbounded escalation train the feature exists to bound - and
the \"is it zero\" test errored false as well, so the keep-count sites
reset the escalation counter on a home that had configured nothing, which
is the behaviour the maintainer's request forbids. The same hole let an
unusable horizon make the cap marker expire at once and an unusable
sentinel TTL drop the sentinel on the next poll, putting the failed-write
route back on every poll.

The fix bounds the accepted range at the ONE normalization choke point,
where each value is read, rather than hardening every comparison site: a
value bash cannot compare never reaches a comparison, because an
arithmetic error is read as false at every site, which is the opposite of
what each of those tests means. Values are accepted below 10^18, which
always fits bash's 64-bit signed arithmetic, and the empty, non-digit,
zero and negative handling keeps its documented fallbacks: 0 for the cap,
86400 for the horizon, 3600 for the sentinel.

Regression cases cover a value beyond bash's integer range for each of
the three settings, and the parity suite proves the unconfigured home is
still observably identical to upstream main.

* no-mistakes(document): docs: correct wedge-cap ranges, release routes, reset contract

* no-mistakes(ci): fix the wedge-cap lint finding and pack the lane on CI measurements

Upstream CI on the rework head went red on two checks, both ours.

"Lint 1" failed on the new parity suite: two `return 1` statements behind
`fail` were unreachable, and behind them was a real bug. `fail` lives in
tests/lib.sh and exits, so inside the command substitution that reads the
baseline it ended only the SUBSHELL - the outer script continued with an
EMPTY baseline and reported a divergence with an empty trace instead of
failing. The test's own header says it is the proof and a silent skip
would be no proof at all, so the baseline now reports the specific reason
and returns non-zero, and the caller's guard aborts the whole test. A
baseline that cannot be materialised aborts the test rather than
continuing.

"Behavior portable parallel 2" failed the packing-boundary check: the
wedge-cap suites were packed on provisional LOCAL measurements that
overstated their CI cost, which left the serial lane without the headroom
the boundary check needs to place one script exactly at the budget. The
same CI run measured them for real - 374225 ms for the wedge-cap suite,
27763 ms for the parity suite, 74 ms for the live-guard skip - and those
Ubuntu measurements replace the local ones in bin/fm-test-run.sh.

* no-mistakes(document): docs: fix wedge-cap measurement attribution, document cap-off release

* feat(bin): archive task status history on teardown behind an opt-in flag (#7407)

* feat: archive retired task status history behind an opt-in flag

* fix(bin): recognize an already-retired remote home before it is recreated

Sourcing fm-wake-lib.sh through the control script's libraries creates
"$FM_HOME/state", so retiring a remote home that was already removed
fabricated an unseeded directory before validate_home ran. The
already-retired branch was unreachable, and that retirement and every
retry refused with "remote home is not a seeded secondmate home".

Check for the absent home before loading any library, accepting exactly
the retire dispatcher's arguments so an invalid option still fails with
usage, and drop the allow-absent branch that could no longer be reached.

* no-mistakes(review): Removed configurable status archive retention override

* no-mistakes(review): Remove published archives after failed status retirement

* feat(bin): re-raise unanswered PR review threads after an opt-in reply age (#7364)

* fix(bin): raise unanswered review threads again after acknowledgement

Acknowledging a maintainer signal removed the only record of the thread,
so a comment nobody answered was never raised again, including while its
task sat on a hold.

Poll now tracks each unanswered maintainer comment, review and inline
review comment on an open pull request until the contribution author
replies in it or it is resolved, and raises it again once it is a day old
(FM_CONTRIBUTIONS_REPLY_AGE) and daily after that. The wake names the
comment URL and its age.

* no-mistakes(review): Track only inline and changes-requested threads, bound notified

* no-mistakes(review): Let reviewer verdicts answer reviews, skip empty-body change requests

* no-mistakes(ci): Fixed "Behavior portable serial 6" with a test-only change. The serial 4 failure is a timing flake that this change did not cause. Serial 6 (tests/fm-pr-check-security.test.sh, "retired poll left task-a.check.sh"): this PR adds one more forge read to the contribution observer, a paginated `gh api graphql` query for reviewThreads. The test's fake `gh` answered every `api graphql` call with merge-state key=value lines. The observer rejected that output and raised the wake "contributions: observation unavailable ... review thread pages returned an unexpected shape". That wake ended the watcher cycle before the merged task-a poll retired. Invariant: the fake forge must answer every read the contribution observer makes, in that read's real shape. The other contribution reads (comments, reviews, inline comments, checks, statuses, repo) were already faked. The new reviewThreads query was the only read missing. Fix: tests/fm-pr-check-security.test.sh now answers any `api graphql` call containing reviewThreads with one empty reviewThreads page. The merge-state graphql answer is unchanged. Verified: I reproduced the failure locally before the fix. The test also passes on base fc8972cd with that commit's bin/. After the fix, `bash tests/fm-pr-check-security.test.sh` exits 0 with all 47 cases ok. The only other test whose fake `gh` handles `api graphql` and runs the contribution path is tests/fm-pr-merge.test.sh. It prints no "unexpected shape" text. It fails locally with "github-zero-exit-queue-required: refusal did not name the concrete observed state", and it fails the same way on base fc8972cd. So that failure predates this change, and it is not among the failing CI checks. Serial 4 (tests/fm-remote-reply.test.sh, "the NUL-bearing line was not captured"): this is a 40-second wait (800 polls of 0.05 seconds) for a procevent result in the remote-reply stream, and it timed out on CI. The test does not use fm-contributions or any file this PR changes. It passed locally twice (42 ok, exit 0), so this is CI load flakiness outside this change. I made no code change for it

* fix(bin): make unanswered review re-raise opt-in

The re-raise wake and the reviewThreads read now run only when
FM_CONTRIBUTIONS_REPLY_AGE is set to a positive number of seconds.
An unconfigured install polls exactly as before: no review-thread read,
no threads[] entry and no unanswered signal. arm copies a set value into
the generated check so the watcher honors it.

* fix(bin): refuse a zero-padded zero reply age

FM_CONTRIBUTIONS_REPLY_AGE=00 and 000 passed validation as positive ages.
They now fail like 0 does.

* no-mistakes(review): remove dead reviewThreads branch from security test fake gh

* no-mistakes(review): use portable sed -i.bak in contributions test helper

* no-mistakes(docs): name the thread URL in the unanswered-wake header text

* feat(bin): refuse unguarded Herdr lifecycle briefs at spawn behind an opt-in flag (#7631)

* Refuse unguarded Herdr lifecycle briefs at spawn

* no-mistakes(review): name matched Herdr command, document opt-in guard, test scaffold

* no-mistakes(lint): quote matched-command assertion so ShellCheck SC2016 passes

* fix(bin): withhold a child's PR-ready line until checks green behind an opt-in flag (#7630)

* fix(bin): publish a child's PR-ready line only after checks green behind an opt-in flag

bin/fm-pr-check.sh publishes the child's PR-ready line to the parent channel when it registers the PR, before the child has reported its checks green. With config/ready-after-green present, a no-mistakes registration records the PR and arms the merge poll but publishes the line only when the last done line in the child's status is 'done: PR <url> checks green' for that PR. Without the flag the behaviour is unchanged.

* no-mistakes(review): accept checks-green note with surrounding text for ready line

* no-mistakes(ci): Lint 2 was caused by this PR and is fixed. Behavior tests (Herdr) is a pre-existing flake unrelated to this PR, so no code change was made for it. Lint 2 (fixed): ShellCheck SC2034 at tests/fm-teardown.test.sh:2711 because `run` was declared with `local` but is a function defined inside the test, never a variable. Invariant: a `local` declaration names only variables the function uses. The same wrong declaration also existed in the sibling opt-in test at line 2662 (both added by this PR), so `run` was removed from both `local` lines. Verified locally: `shellcheck -x tests/fm-teardown.test.sh` returns 0 (it reproduced the SC2034 warning before the edit), `bin/fm-lint.sh tests/fm-teardown.test.sh` returns 0, and `bash tests/fm-teardown.test.sh` exits 0 with 141 passing tests, including both "fm-pr-check withholds the PR-ready line ..." and "fm-pr-check releases the PR-ready line on a checks-green report that carries surrounding text". Behavior tests (Herdr) (not caused by this PR): the single failure is tests/fm-backend-herdr-presentation-e2e.test.sh "concurrent secondmate recovery failed ... error: herdr presentation recovery could not acquire its session lock; refusing a concurrent resume". That test exercises bin/fm-spawn.sh's Herdr session-lock recovery path; this PR touches only bin/fm-pr-check.sh, docs, a SKILL.md row, and tests/fm-teardown.test.sh, and the presentation test references none of them. The identical failure appeared on the unrelated branch fm/t3-5596-successor-v3 in run 39709923982 (job 119598556006), and the flake is already tracked in open issues #6454 and #7277. Rerunning the Herdr job should be enough; fixing the lock budget belongs to those issues, not this PR

* feat: add auto-detected Rex session backend (#7633)

* feat(bin): add Rex as an auto-detected session backend

Add bin/backends/rex.sh, a session-provider adapter for the Rex terminal
multiplexer, and wire it through the dispatcher, spawn, control plane,
crew state, busy evidence, and away-mode supervision.

- Auto-detect Rex from TERM_PROGRAM=rex with REX_BLOCK, after tmux and
  Herdr and before cmux; explicit --backend, FM_BACKEND, and
  config/backend still win, and a nested tmux or Herdr is never read
  as Rex.
- One focus-safe tab per task: in Firstmate's own Rex session when it
  runs directly inside Rex (confirmed against the server), otherwise in
  one session per home; new blocks are resized to 200x50; every call
  names its session and block by immutable id.
- Recovery-grade agent state from Rex's process view, OSC 7501 program
  status as positive busy evidence only while its owner is in the
  foreground chain, and a viewport derived from the last size.rows rows
  of the styled capture.
- Absence proof from a structured not-found on the recorded server
  (rex_server), so fm-control exit and relaunch work on Rex and a gone
  block is reclaimed into a fresh tab in its recorded session.
- Away mode for a Rex-hosted primary runs its daemon in a dedicated Rex
  session killed by exact id.
- Docs: docs/rex-backend.md, configuration and control-plane tables,
  and a dated live verification record; tests: a stateful fake-CLI
  suite, a real-server smoke test guarded to its own fm-test- session,
  and a Rex away-launcher e2e.

* no-mistakes(review): Recover Rex reclaim after server stops; document deferred asks

* no-mistakes(document): Correct Rex documentation and consolidate stale backend guidance

* fix(bin): guard the wedge cap-fire counter reset with the cap-state rollback (#7625)

* no-mistakes(review): wedge cap: guard the cap-fire counter reset with rollback

* no-mistakes(document): docs: repair shard-pack wording and wedge-cap marker shorthand

* no-mistakes(review): docs: correct away-release terminal-row bound claim

* no-mistakes(document): docs: cover third guarded cap-state write in watcher comment

* no-mistakes(ci): Reweighted the packing hint for tests/fm-supervision-host.test.sh from the local 789123 ms to 1192918 ms, the one completed successful CI sample (run 39642852135, job 119276758966), and let the LPT packer rebalance. The guard was not weakened (PORTABLE_SERIAL_MAX_WEIGHT_MS=1200000, PORTABLE_SERIAL_SHARDS=9, coverage guard and packing-boundary check untouched) and nothing was hand-placed. New packed hint sums of the 9 serial shards (ms): 1=1192918 (1 script), 2=1139923 (18), 3=1139903 (30), 4=1139922 (30), 5=1139917 (30), 6=1139886 (29), 7=1139891 (30), 8=1139880 (29), 9=1139911 (31). Total 228 scripts = the serial lane exactly; max 1192918 < 1200000, so it fits. Packing guard: bin/fm-test-run.sh --check-coverage -> FM_TEST_COVERAGE ok total=268 parallel=24 parallel_max_ms=665545 parallel_imbalance_ms=2 parallel_unhinted=0 serial=228 serial_shards=9 serial_unhinted=15 serial_max_ms=1192918 serial_budget_ms=1200000 herdr=16, exit 0. tests/fm-test-run.test.sh passes both packing contracts: 'coverage guard bounds the unmeasured share and serial packing within twenty minutes' and 'serial packing accepts the exact budget and refuses one millisecond above it'. bin/fm-doc-audience-check.sh ok (surfaces=124 local_links=851). docs/fm-test-portable-shards.md now states the same 1192918 ms for that script, citing run 39642852135 (documented duration == packed weight), and adds the required honesty note in the same paragraph style: run 39765114423 cancelled this script alone in a shard at the 30-minute job cap and upstream run 39618934309 hangs identically, so the weight is a fit to the 20-minute packing target, not a cure, and the underlying slowness is an upstream defect this branch does not own. No other file, weight, test or doc line touched. Unrelated pre-existing failure, verified by git stash at base commit 5af4072: tests/fm-session-lock-ancestry.test.sh asserts 'the pty-host was not reparented to init after the daemon ended' and fails identically on the unmodified tree (sandbox pty behaviour); the --jobs family-admission assertion in the same suite fails only because of it. Not caused by this change

* fix(bin): restore watcher downtime before main-only hand-back (#6588)

* fix(bin): restore inherited handling before main-only hand-back

* Restored downtime so an earlier engine turn could not suppress a later
  main-owned close while leaving a healthy successor behind
* Routed restoration failures through the existing Stop-hook alarm
  instead of silently discarding the hand-back
* Added host-and-hook regressions plus attended and away idle-return
  controls to separate missing monitoring from status classification

* no-mistakes(test): Assert ordered stale event in returned-driver controls

* no-mistakes(document): Document main-only hand-back downtime restoration and failure

* no-mistakes(document): Correct host header on main-only downtime republish

* test(herdr): bound the piped composer probe with fm_run_timed instead of GNU timeout (#7636)

* feat: add Rex push notifications and cursor-aware composer detection (#7639)

* feat(rex): push blocked edges from Rex program status through a bounded Lua reader

Rex joins Herdr as a push-capable backend: a bounded rex do reader streams
program_status_changed, child_exited, and block_closed for the watched task
blocks, and a trusted blocked edge wakes the supervisor with Rex's blocked
kind and message in the reason. The per-pane dedupe moves into the shared
transition lib, the record gains a detail field, and gone edges end the wait
for an immediate poll. The real-Rex test isolation is shared by both smokes.

* fix(rex): anchor the composer read on Rex's cursor position

Rex's format method reports the cursor alongside the styled grid, so the
composer verdict now uses the same cursor-anchored read as tmux and falls
back to the cursorless read only where that is unknown. OpenCode 1.19 draws
a status line below its composer, which made every cursorless read of an
idle OpenCode worker on Rex unknown and refused steers, exit, and relaunch.

* test(rex): add a live composer guard for every installed harness on Rex

* docs(rex): record push-event and per-tool live evidence on Rex

* no-mistakes(document): Clarify Rex documentation and shared transition ownership

* no-mistakes(ci): Fixed flaky public-followup fixture teardown: killing only the remote worker child allowed its supervisor to restart and race directory removal. Cleanup now uses the existing whole-worker-tree stop helper. Verified the full public-followup suite, remote-job orphan-reap suite, shell syntax, and git diff checks all pass

* feat(bin): notify owned PR conflicts and failing required checks behind an opt-in flag (#7634)

* refactor(bin): share the branch-to-PR lookup through fm-pr-lib

* feat(bin): notify owned PR health changes behind an opt-in flag

* no-mistakes(review): drop status-line ownership, key checks per name, remove PR wait rule

* no-mistakes(review): rediscover the branch PR once the cached one is final

* no-mistakes(review): refuse retired re-enrollment, require marked checks, verify owned records

* no-mistakes(document): note shared branch-to-PR lookup in scripts table

* fix(bin): notify reported failures when no checks are required

* no-mistakes(document): inventory PR health flag and state, note new pr-forge member

* test: isolate real-Rex suites on private servers (#7649)

* Isolate real Rex tests with private servers

* no-mistakes(review): Trap Rex cleanup early and prove passive-read autostart guard

* no-mistakes(document): Consolidate Rex test isolation documentation

* fix: distinguish outdated tools from missing tools (#5688)

* fix(bin): report an outdated bootstrap tool instead of a missing one

detect_local_tools printed "MISSING:" for a treehouse without --lease, a
no-mistakes below 1.46.0, a gh-axi below its floor, and an incompatible
tasks-axi or quota-axi, so a supervisor read an installed tool as absent
and took the first-install remediation again.

Report those as "OUTDATED:" with the installed version, the requirement
and the tool's own upgrade command: treehouse update, no-mistakes update,
gh-axi update and quota-axi update. tasks-axi ships no self-updater, so it
keeps its install command. "MISSING:" stays for absent tools only, and
lavish-axi keeps PRESENTATION_UNAVAILABLE with its text fallback.

Update the bootstrap-diagnostics handler, the AGENTS.md section 13 trigger
list and the operator diagnostics in docs/configuration.md, and cover
absent, below-floor and at-floor for every floored tool in
tests/fm-bootstrap.test.sh.

* no-mistakes(document): Documented distinct bootstrap tool diagnostics

* fix(bin): reuse the tasks-axi check's own probe results

Rendering the tasks-axi OUTDATED requirement text ran the two `--help`
capability probes again after the compatibility check had already run
them, including when session start handed bootstrap an incompatible
verdict. The check now records the reason behind its verdict - the
version floor, or the capability probes the build fails - and reuses it,
both within the process and across the existing one-hop handoff, so
naming a missing capability costs no second probe pass. A build below the
floor is answered by its version alone and never pays for capability
probes it cannot use.

The bootstrap tests that simulate a tool as absent removed it from the
fake bin directory while bootstrap kept searching the fallback base PATH,
so a real host install could satisfy the lookup instead of the expected
MISSING line. Those cases now hide the tool from the base path as well,
and a new case pins the contrast between a bare and a curated fallback.

Verified: the touched bootstrap suite passes, and its probe-count and
capability assertions fail against the pre-fix scripts. Run with a
fallback base PATH carrying real installs of the absent tools, the
pre-fix suite fails on "absent treehouse reports a missing tool" while
the fixed suite passes every case.

* no-mistakes(document): Documented missing versus outdated tool diagnostics

* no-mistakes(document): Refresh outdated-tool documentation

* no-mistakes(review): Reuse shared version parser for outdated diagnostics

* no-mistakes(document): Correct outdated-tool diagnostics documentation

* no-mistakes(document): Align toolchain upgrade documentation

* fix(skills): keep main's bootstrap-diagnostics description and only add OUTDATED

* fix(bin): clarify ahoy skill legacy session-start exclusion to require verbatim match (#7530)

* Clarify ahoy legacy startup exclusion

* Fix quoted payload code span

* fix(bin): resolve timeout/gtimeout to executable paths via type -P (#7637)

* fix(timeout): bypass shell builtins when invoking external runners

* no-mistakes(review): Remove redundant slashless runner resolution from external timeout

* fix(bin): count answered captain holds moved to the Done archive as durable (#6094)

* fix: count answered captain holds in the Done archive at the completion gate

Done retention moves closed markdown rows into the configured Done archive,
which tasks-axi show never reads, so verify, complete, and scout teardown
refused an answered captain hold once retention archived it. The completion
gate now reads the newest archived block for an attested entry, under its
exact or legacy identity, and accepts it only through a recorded resolution.
Unanswered archived closes and holds found nowhere still refuse.

* no-mistakes(document): document Done-archive durability in captain-hold verification record

* no-mistakes(ci): Fixed the selected Greptile findings in bin/fm-captain-hold.sh (all in the Done-archive read path added by this PR). code_change_needed=true. ci-3 (Archived reads can hang): task_show_archived() now bounds the replayed archive `tasks-axi show` with the same read bound the live backlog read uses (FM_BACKLOG_ROW_TIMEOUT_SECS via fm_run_timed, sanitising a non-positive/padded value to 10s, mirroring fm_backlog_row_show). A bound hit is treated as 124, not absence: task_show_archived returns 124 and prints a loud reason; archived_entry() propagates 124; verify_entry_durable() exits 124 on the archived-read bound (alongside its existing resolve 124 handling); verify_hold_durable() exits 124 rather than reading the row as absent. So verify can no longer hang and complete can no longer stay blocked while holding the origin metadata lock. ci-4 (User-level archive setting ignored): added captain_markdown_archive_setting(), which resolves the [markdown] archive key with tasks-axi's own source precedence — the backlog root's .tasks.toml first, then $HOME/.tasks-axi/config.toml — before the existing default of done-archive.md beside the backlog; a relative value still resolves against the backlog root, which I verified empirically matches tasks-axi (root config wins over home config; a relative home-config value resolves against the backlog root; default stays data/done-archive.md). tasks-axi exposes no command for the archive path, so re-parsing with matched precedence is the available approach. Added test_archived_answer_in_a_user_configured_archive_satisfies_the_gate, which sets the archive only in a fixture $HOME/.tasks-axi/config.toml and drives the whole hold→answer→retention→verify/complete/teardown flow with that HOME, asserting the answered call archived to the relocated location still satisfies the gate. ci-5 (repeated archive scans, P2): left unchanged per the instruction's opt-out. A clean reuse of the row archived_entry already found is not small: archived_entry runs inside a command substitution, so its TASK_SHOW_OUTPUT dies with the subshell and cannot be handed to verify_hold_durable without restructuring both to pass the loaded row through the current shell. The growth is bounded (O(archive size) per attested entry) and P2, so hardening it would add more machinery than the fix warrants. Unanswered archived closes and holds found nowhere still refuse (existing test coverage retained). Verification: `bash -n` clean; pinned ShellCheck 0.11.0 (`shellcheck -x bin/fm-captain-hold.sh`) reports 0 findings; tasks-axi archive-precedence behaviour confirmed by direct experiment. The full fm-captain-hold-lifecycle.test.sh suite (which exercises both the pre-existing archived-gate test and the new user-config test) is slow due to beads spawns and was still running at report time; recommend confirming it green before merge. ci-1/ci-2 need no code change (action_required fork workflow runs awaiting maintainer approval), per the recorded user decision

* no-mistakes(document): Document Done-archive reads under backlog row timeout

* docs: say only the archive row replay is bounded, not the archive scan

* no-mistakes(document): Move Done-archive rule to the complete section

* fix(bin): read a PR with no CI checks as unverified, not checks green (#7627)

* fix(bin): optionally read a PR with no CI checks as unverified, not checks green

nm_ci_checks_state maps the ci log marker "no CI checks reported - still
monitoring" to green, the same verdict as "all CI checks passed". A pull
request that no check ever ran against therefore surfaced as "checks green: PR
ready for review" (#3216).

Add a no-checks verdict for that marker, returned only in a home that creates
config/ci-no-checks-not-green. The run-step consumer reports working with a
detail naming the real condition, and the status-log override no longer
promotes a crew's own "checks green" report while that marker is the latest.
Without the flag every reading is unchanged.

Co-authored-by: Harlan Do <[email protected]>

* no-mistakes(document): document ended-monitor reading under the zero-checks flag

* fix(bin): read a PR with no CI checks as unverified on every home

The ci log marker "no CI checks reported - still monitoring" now always
yields the no-checks verdict, so a pull request that