Repository navigation
fix(bin): stop tool-update check blaming tools for its own budget and re-announcing pending updates - #7482
fix(bin): stop tool-update check blaming tools for its own budget and re-announcing pending updates#7482AgardnerAU wants to merge 4 commits into
Conversation
… re-announcing pending updates A probe that overruns its own bound is now reported as timed out, and a probe whose bound the sweep budget had cut, or a tool the sweep never reached, is reported as not checked, instead of "check failed" or "check incomplete". Findings are now compared as sets: only a finding missing from the recorded set is reported, so a finding leaving the set no longer re-announces the ones that remain. The record holds one finding per line (fm-tool-updates-v2) and still reads the earlier joined record so an upgrade does not repeat every finding.
|
Speaking as Kun's firstmate: thanks @AgardnerAU. The base-vs-branch transcripts make both false alarms easy to see. I read the whole diff against main VISION verdict (head 81c7289 vs main 1aa2a21):
Contract-class: restore. The watched-tool check only runs in a home that has Overlap: #3841 (yours, the published npm/GitHub probe) edits the same script. It uses Next step: we're waiting on CI only. Nothing is needed from you right now. If CI and no-mistakes come back green and the PR is still clean, I'll merge it on a later pass. |
…fm/fm-tool-update-false-alerts # Conflicts: # bin/fm-tool-update-check.sh # docs/configuration.md # tests/fm-tool-update-check.test.sh
[Medium impact] The changes affect reports from the watched-tool check and its existing watcher wake. Fix the version-probe timeout path before merging so slow tools are not still reported as broken. Reviews (1) · Last reviewed commit: "Merge branch 'main' of https://github.co..." · Reviewed by Greptile |
| # A copy that ran out of time never had the chance to report a version. | ||
| if fm_timed_out "$status"; then | ||
| emit_probe_timeout "$name" "$bound" "$hit" "for its version" | ||
| [ "$resolved_path" != "$hit" ] || resolved_timed_out=1 |
There was a problem hiding this comment.
A version probe that prints a version before hanging skips the timeout check because it sits inside if [ -z "$version" ]. With published configured, the saved timeout status then produces check failed: ... exited 124 instead of timed out or not checked. Without published, the timeout can go unreported.
Check the timeout status independently of whether partial output contains a version, and add a printed-version-then-hang test.
| reported=*) | ||
| [ "$schema" = "$RECORD_SCHEMA_V1" ] || continue | ||
| line=${line#reported=} | ||
| [ -z "$line" ] || RECORD_FOUND="${line//; /$nl}$nl" |
There was a problem hiding this comment.
The v1 reader splits every ; , including text inside a single finding. An announcement such as Update available; install 2.0.0 becomes two recorded entries. The next sweep cannot match the original finding and announces it again during upgrade.
Match current findings against the old joined record without assuming every ; starts another finding, and cover an announcement containing that text.
|
Speaking as Kun's firstmate: thanks @AgardnerAU for merging main into this tip ( Waiting on you for two gates:
Contract-class stays restore (provisional; re-checked on the attested tip). #3841 already merged, so that overlap is gone. Rockets: none. Unlabelled Full suite failure is our label gate, not yours. |
Intent
"yes to a and b" - on 2026-10-18 the captain approved starting the grouped fixes a triage of the owner's queued firstmate bug reports recommended. Each becomes a new upstream PR to kunchenguid/firstmate from the fork AgardnerAU/firstmate.
This fix: Two fixes to bin/fm-tool-update-check.sh, in one PR: (1) a tool that is slow or not reached because the check's own time budget ran out must be reported as timed out or not checked, never as a failed tool; (2) a still-pending update must be announced once, and a finding leaving the set must not re-announce the ones that remain (compare as sets, report only new members).
The triage (2026-10-18) confirmed each defect is still present on current code and that no upstream PR or issue covers it. The original bug reports, verbatim:
===== fm-tool-update-check-blames-tools-for-own-budget
title: "firstmate: the watched-tool update check reports healthy tools as failed when its own time budget runs out"
kind: ship
repo: firstmate
created: 2026-09-16
body: "Observed repeatedly on 2026-09-16 while the captain was away. The armed watched-tool poll woke firstmate several times reporting, for example: "gh-axi check failed: ~/.nvm/versions/node/v22.23.1/bin/gh-axi did not answer when asked for its update announcement; quota-axi check failed: ...; chrome-devtools-axi check failed: ...; check incomplete: the time budget ran out before tasks-axi".\n\nTHE TOOLS ARE FINE. Verified by hand at the time, all answering normally:\ngh-axi 0.1.35, quota-axi 0.1.43, chrome-devtools-axi 0.1.34, tasks-axi 0.2.5, lavish-axi 0.1.67.\n\nTHE PROBE IS FINE TOO. Running the exact announce_args the check uses returns cleanly and promptly:\n $ gh-axi update --check\n update: package gh-axi, current 0.1.35, latest 0.1.35, available false\n rc=0\n\nREADING. Three of the ten watched tools use announce_args ["update", "--check"], each of which makes its own network round trip. The check appears to run them in sequence against one FM_CHECK_TIMEOUT budget, so the slow ones are reported as having "did not answer" and the budget is exhausted before the remaining tools are reached at all. The message therefore blames the tool for what is the check's own scheduling, which is the same failure shape the fleet-tool-quirks note already warns about: "That poll reports its OWN budget exhaustion as tool failure."\n\nWHY IT MATTERS. It is a false alarm that fires repeatedly, and while away it burns supervisor escalations. Worse, it is indistinguishable from a real tool breakage, so a genuine failure would be dismissed as this.\n\nDIRECTION, not a prescription: the per-tool probe needs its own bounded budget separate from the whole-check budget, a tool that exceeds its own budget should be reported as "timed out" rather than "did not answer", and tools not reached should be reported as "not checked" rather than folded into an incomplete-run sentence that reads like a fault.\n\nDISTINCT from fm-tool-update-report-refires-on-finding-removal, which is about a still-pending update re-announcing when an unrelated finding leaves the set. This one is about working tools being reported as failed."
===== fm-tool-update-report-refires-on-finding-removal
title: "firstmate: a still-pending tool update re-announces when an unrelated finding LEAVES the set"
kind: task
repo: firstmate
created: 2026-09-13
body: "Observed live 2026-09-13 during an away-mode session: the SAME pending update announced three times\nin about an hour.\n\nWHAT HAPPENED.\nSweep 1, epoch 1789246703, reported two findings: "no-mistakes update available: v1.64.0 -> v1.72.0"\nAND "lavish-axi check failed: ... did not answer when asked for its update announcement". Both were\nwritten to state/.tool-updates as one reported= string.\nSweep 2, epoch 1789247643, found only the no-mistakes item - the lavish probe answered that round, so\nits finding was gone. The findings string differed from the recorded one, and the SAME still-pending\nno-mistakes update was announced again.\nSweep 3, epoch 1789251370, the lavish finding returned, the string changed again, and the unchanged\nno-mistakes item was announced a third time.\n\nTHE DEFECT is at bin/fm-tool-update-check.sh:735:\n if [ -n "$line" ] && [ "$FINDINGS" != "$RECORD_REPORTED" ]; then\nThat is whole-string inequality, so the report fires when the set CHANGES in any direction. The\nscript's own header states the intended contract correctly - "the same pending update is reported\nonce rather than on every poll while a new finding that lands past the one-line cut is still news" -\nso the intent is a test for NEW findings. A finding LEAVING the set is not news and must not\nre-announce the ones that remain.\n\nTHE FLAP THAT TRIGGERS IT IS STRUCTURAL, NOT RANDOM. lavish-axi's configured announce probe is\n
update --check, and it takes 10.6 seconds - measured three times: 10601 ms, 10614 ms, 10624 ms. The\nwhole check runs under FM_CHECK_TIMEOUT, default 30 seconds, shared across every watched tool. One\ntool deterministically consumes a third of the entire budget, so whether the sweep finishes depends\non how the other probes happen to run that round - which is why it alternates rather than failing\nconsistently. (lavish-axi --helpalso blocks ~10.6s at 0% cpu, so the cost looks like a network\nround trip the tool makes regardless of subcommand.)\n\nWHY THIS MATTERS rather than being cosmetic: on this machine the set changes on roughly every other\nsweep, so every genuinely pending update is re-announced indefinitely. A check that cries wolf is a\ncheck operators learn to ignore, which defeats the point of watched-tool monitoring entirely.\n\nTHE FIX HAS TWO HALVES, and the first is the important one.\n1. Compare as SETS and report only when the set gains a member not in the recorded set. Keep writing\n the full current set to the record either way, so a finding that disappears and returns is still\n news on its return. Preserve the existing behaviour that a sweep killed part way through leaves no\n record and is retried. This makes the flap harmless whatever its cause.\n2. Separately, decide whether a 10.6-second probe belongs in a 30-second shared budget at all: give\n lavish-axi a cheaper announcement source, drop its announce_args and watch its version only, or\n give slow probes their own budget. Config is config/watched-tools.json.\n\nTEST TO PIN IT: record holds findings A and B; sweep produces only A; nothing is reported and the\nrecord becomes A. Then sweep produces A and B again; B is reported, A is not. Also keep a case\nproving a brand-new finding landing past the one-line cut is still reported.\n\n--- INTERIM MITIGATION APPLIED 2026-09-13 BY FIRSTMATE, symptom only ---\n\nAfter a FOURTH announcement of the same unchanged update, the noise was degrading supervision - it\nwas waking the away-mode supervisor roughly every half hour with nothing new. Firstmate removed\nannounce_argsandannounce_patternfrom the lavish-axi entry in config/watched-tools.json, so\nthat tool's version is still watched but its 10.6-second network probe no longer runs. Previous file\ncopied to /tmp/watched-tools.backup.json. This is remedy option 2 above, taken in its crudest form.\n\nTHIS MASKS THE DEFECT, IT DOES NOT FIX IT. The dedupe at line 735 still reports on any set change in\nany direction, so the next watched tool whose probe is slow, flaky or network-dependent will\nreproduce this exactly. Remedy 1 is still required and is still the important half. Do not close this\ntask on the strength of the noise having stopped.\n\nCOST OF THE MITIGATION, so it can be reversed deliberately: we will no longer be told automatically\nwhen lavish-axi has an update; only a version change we happen to notice will show it. Restore the\ntwo keys once remedy 1 lands and the budget question in remedy 2 is settled properly."What Changed
bin/fm-tool-update-check.shno longer reports a failed tool when a time limit runs out. A probe that overruns its ownFM_TOOL_UPDATE_PROBE_SECSlimit is reported astimed out. A probe that the sweep budget cut short, or a tool that the sweep never reached, is reported asnot checked. Each unreached tool is now named. Before, they were folded into one "check incomplete" finding. This applies to version probes, announcement probes,version_urlfetches (including curl exit 28) and git probes.state/.tool-updates, schemafm-tool-updates-v2) stores onefound=line for each finding. Only findings that are not in the recorded set get reported. Thus a still-pending update is announced once, a finding that leaves the set does not announce the findings that remain, and a finding that leaves and comes back is reported again. The check still reads v1 records, so an upgrade does not announce all pending findings again. A sweep that is stopped part way through still writes no record.docs/configuration.mdto describe the timeout and set-based reporting rules. Added test cases intests/fm-tool-update-check.test.shfor timed-out and not-checked reporting and for set-based deduplication.🤖 Generated with Claude Code
Risk Assessment
Testing
I ran the real check CLI live against a throwaway home and stand-in tools for 6 scenarios, and compared each with the base commit where the scenario applies. The base build blamed slow or unreached tools as "check failed" or "check incomplete" and re-announced the same pending no-mistakes update on sweeps 3 and 5. The branch reports "timed out" or "not checked" instead, announces the pending update once over 5 flapping sweeps, keeps one finding per unreached tool so a change to that list does not re-announce D, handles the version_url timeout cases correctly, and still reports real breakages as "check failed". The targeted test file for the script passed all 51 cases, including the test where the armed check wakes the watcher. That test is not a live run, so the watcher-wake scenario is marked untested. The throwaway home was removed by a trap, and the worktree is clean.
update --checkprobes sharing the sweep budget: tools cut short or never reached are reported as not checked, never as check failed or check incompleteEvidence: Live CLI transcript, base commit compared with branch, all scenarios
Source: Live CLI transcript, base commit compared with branch, all scenarios
Evidence: Driver script for the live scenarios
Source: Driver script for the live scenarios
Evidence: Targeted test file run output
Source: Targeted test file run output
Evidence: S4 flap: base compared with branch
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-tool-update-check.sh:540- The version_url probe was not converted. If the read runs out of time, it is still reported as$name check failed: $version_url did not report a version(line 543). This applies both when curl hits --max-time (exit 28) and when fm_run_timed returns 124/137. It also applies when the sweep budget had already cut probe_bound. The intent requires that a slow probe, or one cut by the check's own budget, is "reported as timed out or not checked, never as a failed tool". Failing sequence: a tool has version_url, and earlier tools use most of the budget, so probe_bound returns 1-2s. The download takes 3s, so the report says 'claude check failed'. Fix: capture bound=$(probe_bound) once, use it for both fm_run_timed and --max-time, and send a timeout status (fm_timed_out or curl status 28) to emit_probe_timeout "$name" "$bound" "$version_url" ... (the message wording needs a small adjustment) before the generic failure branch.bin/fm-tool-update-check.sh:808- All unreached tools go into one finding string ('not checked, the sweep time budget ran out first: A, B'). The set comparison then works on that whole string, so any change to the list counts as a new member, even when every tool in it was already announced. Failing sequence: sweep 1 does not reach C and D, and reports 'ran out first: C, D'. Sweep 2 reaches C but not D, and announces 'ran out first: D' again, although D was already reported and nothing new happened. This is the same whole-string re-announcement the intent forbids ("compare as sets, report only new members"), moved to a coarser level, and it fires on budget flap, which is the structural trigger in the bug report. Fix: emit one finding per unreached tool, for example "$name not checked: the sweep time budget ran out before it was reached", in the loop at line 802, and drop theunreachedaccumulator. Update the assertion in tests/fm-tool-update-check.test.sh to match (test_tools_the_sweep_budget_did_not_reach_are_not_checked_not_failed and test_git_probes_stop_when_the_sweep_budget_is_gone).bin/fm-tool-update-check.sh:418- emit_probe_timeout and git_probe usebound -lt PROBE_SECSto decide whether the sweep budget cut the bound. When FM_TOOL_UPDATE_PROBE_SECS=1, probe_bound raises a depleted budget up to PROBE_MIN_SECS=1, which equals PROBE_SECS. A probe that only ran out because the sweep budget was gone is then reported as 'timed out' and not as 'not checked'. This happens only with a non-default configuration, and the message still does not say 'check failed', so it is noted for information only.🔧 Fix applied.
1 info still open:
bin/fm-tool-update-check.sh:418- emit_probe_timeout and git_probe usebound -lt PROBE_SECSto decide whether the sweep budget cut the bound. When FM_TOOL_UPDATE_PROBE_SECS=1, probe_bound raises a depleted budget up to PROBE_MIN_SECS=1, which equals PROBE_SECS. A probe that only ran out because the sweep budget was gone is then reported as 'timed out' and not as 'not checked'. This happens only with a non-default configuration, and the message still does not say 'check failed', so it is noted for information only.✅ **Test** - passed
✅ No issues found.
update --checkprobes sharing the sweep budget: tools cut short or never reached are reported as not checked, never as check failed or check incompletebash ~/.no-mistakes/evidence/01M57FN8JSQ6GH0HYQXBK60E3W/drive.sh- runs the real check script (branch and base commit 1aa2a21e, extracted with git archive) against a throwaway mktemp FM_HOME and stand-in tool and curl scripts, with 6 scenariosS1: the 2026-09-16 shape - three slowupdate --checkannounce probes followed by two quick tools, budget 10s, probe bound 5sS2: an announce probe that runs past its own 2s boundS3 (adversarial): a tool that prints rubbish and a missing command must still be reported as check failedS4: the 2026-09-13 flap over 5 sweeps - a pending no-mistakes update plus a lavish probe that alternates slow and fast, then the record contentsS5: the list of unreached tools changes from C,D to D onlyS6: version_url read with curl exit 28, a curl that hangs while the budget is cut, and curl answering with no versionbash tests/fm-tool-update-check.test.sh(only the test file for the changed script, including test_armed_check_wakes_the_watcher_with_the_skew_report and the set-comparison cases)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.