Repository navigation
fix: prevent watcher check starvation - #13
Merged
Merged
Conversation
kunchenguid
force-pushed
the
fix/check-starvation
branch
from
June 13, 2026 20:14
169b7df to
732a1fc
Compare
vipentti
pushed a commit
to vipentti/firstmate
that referenced
this pull request
Aug 5, 2026
* fix(watch): run due check sweep before signal scan to prevent starvation * no-mistakes(review): Bound watcher check execution * no-mistakes(document): Document watcher check scheduling * no-mistakes(lint): Silence shellcheck Perl warning
3 of 4 tasks
This was referenced Aug 11, 2026
|
NOTE: This branch disarms the reaper first and re-arms it last. The first commit removes the |
This was referenced Aug 21, 2026
This was referenced Sep 17, 2026
NewAiCoder
referenced
this pull request
in NewAiCoder/firstmate
Sep 26, 2026
…rkers (#13) * fix(bin): also approve external CLAUDE.md imports at the canonical project root Claude Code's external-imports check (hasClaudeMdExternalIncludesApproved) reads only the canonical git-root project entry in ~/.claude.json, which its own worktree-to-primary-checkout canonicalization means is never the task worktree fm-claude-trust.sh registered. The trust dialog kept working after PR 10 only because its check has an ancestor-walk fallback that happens to reach the worktree entry; the external-imports check has no such fallback. Verified by disassembling the installed claude binary and reproducing in an isolated three-way tmux launch: identical flags registered only at the worktree key still showed the external-imports dialog, and registering them at the primary checkout key suppressed both dialogs. fm-claude-trust.sh now registers all three flags on both the worktree entry and the primary-checkout entry in one atomic write, and refuses when the <project> argument is not itself a primary checkout (its own write target would then be wrong). Extends the harness-adapters Claude reference and the trust test suite. * no-mistakes(test): fix(bin): resolve linked-worktree project arg to primary checkout in fm-claude-trust * no-mistakes(document): docs: describe fm-claude-trust.sh's added external-imports pre-approval --------- Co-authored-by: NewAiCoder <170579485+NewAiCoder@users.noreply.github.com>
|
Validation evidence for this sync:
|
Thoughts-One
added a commit
to Thoughts-One/firstmate-contrib
that referenced
this pull request
Sep 29, 2026
…nguid#13) bin/fm-herdr-session-retire.sh guardedly stops one explicitly named, pre-existing, empty Herdr session that Firstmate did not provision. It is stop-only: no delete, no server call, no restart. It rejects default, fm-remote, and every fm-lab-* name, requires exactly one matching, non-default, running target row with an empty workspace list, snapshots every other session, re-verifies everything immediately before the single herdr session stop call, and confirms both the target and every other session's postconditions before reporting success. fm-herdr-lab.sh remains the sole owner of generated fm-lab-* sessions and is unchanged; the new helper owns the disjoint case of a session Firstmate did not create. fm-brief.sh gains --herdr-retire-session <name>, mutually exclusive with --herdr-lab, restricted to ship/scout briefs, and the unguarded NOT ENABLED declaration now routes existing-session retirement to it. Adds tests/fm-herdr-session-retire.test.sh (stateful fake Herdr client, no live session touched) and extends tests/fm-brief.test.sh for the new routing contract. Registers the new test's family in fm-test-run.sh so it lands in the derived portable-serial lane. Documents the new helper's safety contract in docs/herdr-backend.md and adds it to docs/scripts.md.
This was referenced Oct 7, 2026
jroethel
referenced
this pull request
in jroethel/firstmate
Oct 9, 2026
A projected spawn holds the shared Herdr session lock from its presentation mutation until its launch is sent, across worktree entry and launch staging, so a hold routinely lasts several seconds. A recovering spawn waited only 5 s for that lock and then refused, so two homes resuming together after a restart could spuriously refuse a legitimate queued resume. Recovery now waits behind a peer's whole bounded hold; the fresh-create path keeps its short wait because it degrades flat instead. The concurrent-recovery case now holds the lock past the old wait so it proves the queueing deterministically. The focus-flash Part C non-vacuity check needed its concurrent sampler to land inside the short wrong-focus window between the explicit close and the corrective tab focus. The test's CLI wrapper now holds the operation after the close until the sampler records that window. Also make the presentation test's cleanup remove the read-only git-hooks strip directories it used to leave behind in /tmp. Evidence, real Herdr 0.7.4 in an isolated sandbox: - Presentation e2e, old code: 3/3 failed with "could not acquire its session lock; refusing a concurrent resume"; the winning recovery held the lock 12-16 s while the loser gave up after its 5 s wait. - Presentation e2e, new test with old spawn code: 2/2 failed at the concurrent-recovery case; fixed code: 5/5 passed. - Focus-flash with a sampler slowed past the window: old test 7/10 failed with "observed no wrong-focus sample" although every run's production backstop issued the corrective tab focus; fixed test 10/10 passed, and a deliberately blind sampler still fails 2/2. - Focus-flash fixed test: 50/50 on 2 CPUs and 40/40 on 1 loaded CPU. - Whole real-Herdr family as the CI step runs it, fixed code: all scripts passed except fm-afk-launch, which failed only because the sandbox PATH lacked node and passes with node present. Test evidence: the no-mistakes test step is skipped for this change because its agent would run these real-Herdr e2e scripts against the host's live Herdr server; the sandbox before/after runs above (full record in the task's evidence.md) and this PR's "Behavior tests (Herdr)" CI check are the test evidence. Co-authored-by: Jeremy Roethel <jjrdar@rit.edu>
This was referenced Oct 22, 2026
真站验证说明(需船长真站核一次)
Self-decided findings
|
fritznoff
pushed a commit
to fritznoff/starship
that referenced
this pull request
Nov 2, 2026
…e session (kunchenguid#13) * feat(bin): close leak guard gaps for keys, draft text and every Claude session The leak guard now finds API keys under any name and in any case, and the provider key prefixes it shares with the command guard from one module, bin/fm_secret_shapes.py, which adds Stripe live and GitLab keys to both. Draft text checks (--text) look for those key and token shapes too, with or without a word list. A private word or token is reported only by where it is (file, line and column) with a count, never the word or value, so a command that names the word list file no longer prints the list. The PR text hook now also runs for a first mate or second mate Claude session through the tracked .claude/settings.json, standing aside in spawned workers, which keep their own copy. * no-mistakes(review): Check token shapes only in text a command sends * no-mistakes(review): Place listed words in commits, check tokens in piped files * no-mistakes(review): Hide listed phrase words, count $(<file), skip quoted cat mentions * no-mistakes(review): Hide overlapping listed phrases, blank heredocs inside substitutions * no-mistakes(document): Count the PR text hook in Cursor stand-down set
Decisions and measurements
|
ghazni101
pushed a commit
to ghazni101/firstmate-dsh
that referenced
this pull request
Nov 19, 2026
…chenguid#13) from fm/merge-guard-forgejo-no-checks into main
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 merge-poll starvation in firstmate's watcher (bin/fm-watch.sh). The poll loop evaluated conditions in order signals -> stale -> check-sweep -> heartbeat, and wake() exits the cycle on the first hit. So when a chatty sibling crewmate kept producing status/turn-end signals, every cycle exited on the signal before reaching the check sweep, and the slow per-task polls (e.g. merged-PR detection) were starved indefinitely - observed live: a merged PR went unsurfaced while a sibling task was active. Fix: move the due-check sweep to run right after the liveness beacon, before the signal scan, so due checks run before signals can preempt them. Checks are due only every CHECK_INTERVAL (300s), so most cycles skip the block and fall straight through to the signal scan as before; signals are never lost (persisted .seen-* signatures catch any that land while the watcher is between cycles). Pure reordering of existing blocks plus an explanatory comment; no new behavior.
What Changed
FM_CHECK_TIMEOUTand bounded check execution so slow or hung check scripts cannot block later watcher signals.AGENTS.mdandREADME.md.Risk Assessment
✅ Low: The change is narrowly scoped to watcher check scheduling and bounded check execution, with no material correctness issues found in the reviewed diff.
Testing
Exercised the actual watcher entry point in a controlled merge-poll-starvation scenario, captured the CLI transcript as reviewer-visible evidence, confirmed due checks preempt chatty signals while signals persist for the next cycle, and cleaned up transient
state/files afterward.Evidence: Watcher check-before-signal transcript
Output 1: check: .../state/merge-poll.check.sh: merged-pr-detected Output 2: signal: .../state/chatty.statusPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-watch.sh:90- Due checks now run before the signal scan, but each check script is executed synchronously with no timeout. A hung or very slow poll, such as a network-backed PR check, can now block pending crewmate status/turn-end signals from being surfaced until the command returns; add a bounded timeout around each check invocation so fixing check starvation does not create signal starvation.🔧 Fix: Bound watcher check execution
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
Inspected the target diff withgit diff a5ffb9f4b5d0ed57d5918fa6f508617007a4bb2f...289a229011f5e500129ca023ef479e7c4fc32cc1 -- bin/fm-watch.sh.Ran an end-to-end watcher scenario: createdstate/merge-poll.check.shandstate/chatty.status, then ranFM_POLL=1 FM_CHECK_INTERVAL=0 FM_CHECK_TIMEOUT=5 FM_SIGNAL_GRACE=0 FM_HEARTBEAT=999999 bin/fm-watch.shand observed acheck:wake before any signal wake.Ran the follow-up persisted-signal check after removing the check script:FM_POLL=1 FM_CHECK_INTERVAL=300 FM_CHECK_TIMEOUT=5 FM_SIGNAL_GRACE=0 FM_HEARTBEAT=999999 bin/fm-watch.shand observed the pendingsignal:wake.Verified transient working-tree test state was removed withgit status --short.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.