Repository navigation
fix(bin): throttle declared external-wait wake resurfacing - #2884
Closed
NicoKJarvinen wants to merge 2 commits into
Closed
NicoKJarvinen wants to merge 2 commits into
NicoKJarvinen wants to merge 2 commits into
Conversation
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "no-mistakes(document): Document pause ca..." | Re-trigger Greptile |
NicoKJarvinen
force-pushed
the
fm/fix-watch-pause-resurface-default
branch
from
August 23, 2026 19:04
04eb4a1 to
0ffd9f0
Compare
Author
|
Closing: out of scope. Work is scoped to the kaamos and devflow repositories only. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Fix firstmate issue #2873: a declared external-wait pause must not re-surface as a stale wake on every poll; it must re-surface once per long cadence. The established root cause is that bin/fm-watch.sh reads PAUSE_RESURFACE_SECS from FM_PAUSE_RESURFACE_SECS_DEFAULT without directly sourcing bin/fm-classify-lib.sh, where the single default FM_PAUSE_RESURFACE_SECS_DEFAULT=3600 is defined. The empty value defeats the throttle comparison. Do not re-derive or broaden that diagnosis.
Make the watcher obtain the shared default without hardcoding 3600 a second time. Keep one owner for the default, and prefer the existing source conventions. Harden the comparison so unset, empty, or nonnumeric overrides cannot silently disable the throttle; use a safe shared fallback or a loud failure. Do not change the wedge-escalation path or stale threshold and do not broaden into a supervision refactor.
bin/fm-supervise-daemon.sh already directly sources bin/fm-classify-lib.sh, so it does not have the same missing-default source defect. It must use the same safe cadence resolution so invalid overrides are handled consistently. State explicitly in the PR that the daemon was already sourcing the classifier and was not affected by the missing direct source, while the watcher was fixed to source it directly.
Add or retain executable behavior tests proving the watcher resolves a numeric default, invalid overrides fall back safely, and the throttle behavior itself: a paused task inside the window does not re-emit, and after the window it emits once rather than on every poll. Cover daemon cadence fallback where applicable. Keep existing watcher tests green; bin/fm-watcher-lock.test.sh may flake under full concurrent load per issue #2844 and must be checked in isolation if it fails.
The issue title saying the default is never defined is inaccurate. The default is defined in bin/fm-classify-lib.sh, but it was in the wrong file for the watcher consumer. Say this explicitly in the PR so the issue text does not mislead future readers. Reference issue #2873 in the PR.
Constraints: shellcheck-clean; use the repository's test conventions; never hardcode a second 3600; do not change wedge escalation or stale detection thresholds; do not merge the PR. Delivery is no-mistakes with standard execution, and run the pipeline through a green PR.
Validation evidence already established: commit a1b1d78 implements the fix. bin/fm-lint.sh and the focused watcher and daemon tests pass. The full tests/fm-daemon.test.sh reports
not ok - wedge marker unexpectedly persisted in an unwritable state directoryunder the current branch. The same test run on the unmodified default origin/main at f170ced reports the identical failure. Both runs were under uid 0, and a direct chmod u-w probe still allowed root to create a file, proving this is a pre-existing root-only environment artifact in the test's unwritable-directory assumption, not a regression. State the exact evidence and command comparison in the PR rather than working around the test.What Changed
bin/fm-classify-lib.shdirectly in the watcher, ensuring it resolves the shared declared-wait cadence default. The default is defined in the classifier; the daemon already sourced it and was not affected by the missing direct source.Risk Assessment
✅ Low: The change is well-bounded and no source-verifiable defects were found.
Testing
Watcher tests demonstrated cadence resolution, invalid fallback, pause throttling, and one-per-window re-surfacing without wedge escalation. Daemon tests demonstrated long-cadence re-surfacing and invalid fallback. The isolated watcher-lock suite passed. The daemon suite reproduced the documented root-only unwritable-directory failure; the supplied baseline has the identical failure, and the uid-0 probe confirms the environment cause.
Evidence: Watcher cadence evidence
ok - the watcher resolves the shared pause cadence and falls back safely for invalid overrides ok - a declared pause is absorbed on first sight, then re-surfaced as a recheck past the threshold, never wedge-escalated ok - exited declared-pause and captain-held panes use bounded pause cadence while a live decision gate still surfaces onceEvidence: Daemon cadence evidence
ok - housekeeping re-surfaces a stale declared pause on the long cadence and resets its window ok - the daemon falls back to the shared pause cadence for an invalid override not ok - wedge marker unexpectedly persisted in an unwritable state directoryEvidence: Unwritable-directory environment probe
uid=0 chmod=u-w create_file=allowedEvidence: Isolated watcher-lock suite log
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
tests/fm-daemon.test.sh:1663- The focused daemon suite reports the knownwedge marker unexpectedly persisted in an unwritable state directoryfailure. This is a root-only environment artifact: the run is uid 0, and a directchmod u-wprobe still allows file creation. The supplied baseline comparison reports the identical failure on unmodified commit f170ced, so this is not a regression.rtk bash tests/fm-watch-triage.test.shrtk bash tests/fm-daemon.test.shrtk bash tests/fm-watcher-lock.test.sh(isolated)rtk id -udirectchmod u-w/file-create probe under/tmp/no-mistakes-evidence/01M0QVWZ8Y8QGXBZFMFNF5HYV5rtk git status --short✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.