Repository navigation
Conversation
Add config/wedge-evidence-guards, an opt-in list of operator-owned guard executables that the watcher's at-threshold wedge branch consults after the wait evidence, worktree-write probe and dead-endpoint probe. A CRITICAL answer defers one window at a time, capped by FM_WEDGE_GUARD_DEFER_MAX consecutive deferrals recorded beside the other wedge-window records, and the escalation that ends a capped run names the guard and its reason. Timeouts, failures, malformed output, UNKNOWN and WARNING fail open, and an untrusted config or guard is never run. With the config absent the ladder is unchanged. Refs kunchenguid#6919
…efresh # Conflicts: # bin/fm-watch.sh
Contributor
Author
|
Superseded by #6958, which now carries the same change merged with current 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
Upstream firstmate PR #6958 (ours) needs work: the operator guards evidence PR (issue 6919): its branch conflicts with current main. The captain's words: 'yes. do all work for upstream things we have.' Upstream contribution consent for this repo is recorded for this task. The PR (branch fm/fm-upstream-guard-evidence) adds an opt-in, deterministic, read-only, fail-open hook where the watcher consults operator-supplied guard commands (listed in config/wedge-evidence-guards; absent means off) only in the at-threshold wedge branch, after the wait evidence and dead-endpoint checks; a CRITICAL guard answer defers one wedge window for a bounded run of consecutive deferrals, after which the escalation names the guard and its reason. Keep that behavior and the maintainers' accepted shape while resolving the conflict with current main, update the existing PR rather than opening a new one.
What Changed
bin/fm-watch.shgains an opt-in, read-only, fail-open consult of operator guards listed inconfig/wedge-evidence-guards(absent means off). It runs only at the at-threshold wedge branch, after the wait-evidence and dead-endpoint checks (wedge_guard_evidence,wedge_guard_file_trusted). Each guard runs as<guard> --json, withFM_GUARD_TASKandFM_GUARD_ENDPOINTset, bounded byFM_WEDGE_GUARD_TIMEOUT_SECS. The config file and each guard must be trusted: a regular file, not a symlink, owned by the watcher's user, and not group or world writable. A timeout, non-zero exit, malformed output, or any status other thanCRITICALis no answer.CRITICALanswer defers one wedge window throughwedge_defer_guard, without advancing the escalation count. The run of consecutive deferrals is capped atFM_WEDGE_GUARD_DEFER_MAXand persisted instate/.guard-deferrals-<key>. After the cap the escalation fires and its reason names the guard and the first line of its recommendation. The record is cleared with the other write-tracking resets (clear_write_tracking) and inbin/fm-supervise-daemon.shclear_pause_tracking.docs/configuration.mdhas a "Wedge evidence guards" section and the two new knobs,docs/architecture.mdanddocs/jev-guards.md(new "Caller" section, boundedCRITICALsemantics) describe it, and the operational-home-layout skill lists the new config file and.guard-deferrals-*state records.tests/fm-watch-triage.test.shgains 193 lines of cases.Risk Assessment
✅ Low: The merge keeps the opt-in, read-only, fail-open guard consult only in the at-threshold wedge branch, after the wait-evidence and dead-endpoint checks, with a bounded deferral cap, and no regressions or intent contradictions showed up on a read of the diff.
Testing
I ran tests/fm-watch-triage.test.sh against the merged tree. Its real fm-watch.sh subprocess fixtures covered all the guard scenarios, and all four passed. The file was stopped at the 10-minute limit, so the later non-guard tests did not run; the output up to that point had no failures. I did not run the Herdr lab or the daemon's pause-tracking cleanup of the guard-deferral record. The only evidence is the captured test transcript in the evidence directory; there is no UI surface.
Evidence: fm-watch-triage test transcript (stopped at the 10-minute limit)
Source: fm-watch-triage test transcript (stopped at the 10-minute limit)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-watch-triage.test.sh(single file, run in the background; stopped at the 10-minute background limit before reaching the end, with no failure in the output captured up to that point)Four guard tests in that file ran and passed: absent config, CRITICAL deferral up to the cap, fail-open cases, and gone endpointReviewedgit diff 7099556..4f7c494for bin/fm-watch.sh, bin/fm-supervise-daemon.sh and docs/configuration.md against the stated intentConfirmed the worktree is clean after the run✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.