Skip to content

fix(supervision): add durable watcher loop - #84

Closed
aaugustijn wants to merge 1 commit into
kunchenguid:mainfrom
aaugustijn:fix-watcher-events-q2
Closed

aaugustijn wants to merge 1 commit into
kunchenguid:mainfrom
aaugustijn:fix-watcher-events-q2

Conversation

@aaugustijn

Copy link
Copy Markdown

Summary

  • add bin/fm-watch-loop.sh as a home-scoped continuous watcher wrapper that restarts the one-shot watcher after every wake
  • update guard and firstmate instructions to prefer the durable loop, while keeping fm-watch-arm.sh for one-shot verification / auto-rearm harnesses
  • add a regression test proving two separate status writes surface through one persistent loop

Reproduction

  • reproduced the failure in a temporary FM_HOME: fm-watch-arm.sh caught the first status signal, exited, and left no live watcher for the next status write

Tests

  • tests/fm-watcher-lock.test.sh
  • tests/fm-wake-queue.test.sh
  • tests/fm-wake-daemon-lifecycle-e2e.test.sh
  • tests/fm-daemon.test.sh
  • for test_script in tests/*.test.sh; do ""; done
  • bash -n bin/fm-watch-loop.sh bin/fm-watch.sh bin/fm-guard.sh tests/fm-watcher-lock.test.sh
  • direct smoke: fm-watch-loop.sh surfaced two status signals without manual re-arm

Not run: shellcheck bin/.sh tests/.sh (shellcheck is not installed in this environment).

@aaugustijn

Copy link
Copy Markdown
Author

Closing: this was opened without explicit approval. Keeping the watcher fix local-only.

@aaugustijn aaugustijn closed this Jun 25, 2026
@aaugustijn
aaugustijn deleted the fix-watcher-events-q2 branch June 25, 2026 18:12
@noppGithub

Copy link
Copy Markdown

Completed by https://github.com/noppGithub/tourround/pull/162 (persisted pause enforced server-side with SCORING_PAUSED, shown on the player card, pause and resume audited).

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
* feat(bridge-view): add the captain's phone-first read-only fleet page

Give Bearings a named passive-view mode and in-flight titles, then serve a
loopback Tailscale Serve glance so the phone can observe the fleet without
approving work or mixing logins with the glasses mailbox.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore(fork-surface): record the bridge-view introducing commit

Point the new capability at the branch commit that added it so the
pre-merge provenance line resolves to this change rather than an
unrelated parent.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(bridge-view): treat tailnet-only Serve as Funnel off

A claimed Serve HTTPS proxy reports https:// in funnel status, which
blocked the loopback server. Keep refusing when Funnel is actually on.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(bridge-view): give the launchd plist a PATH that finds python3

KeepAlive would otherwise miss Homebrew python3 and never bind loopback.

Co-authored-by: Cursor <cursoragent@cursor.com>

* no-mistakes(review): Harden bridge safety and complete regression coverage

* no-mistakes(review): Isolate cookie test and terminate snapshot descendants

* no-mistakes(document): Document bridge authentication request boundaries

* fix(ci): expect 45 Bearings tests in the stock Bash snapshot

Three new title and away-mode cases landed; the macOS snapshot count was still 42.

Co-authored-by: Cursor <cursoragent@cursor.com>

* no-mistakes(review): Fix bridge view review findings

* no-mistakes(document): Document bridge view runtime and refresh behavior

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
@BarnabasTuzko

Copy link
Copy Markdown

From SHP-2 (#26, PR https://github.com/BarnabasTuzko/erpnext-extension-prorotype/pull/143): two alert halves move here (SHP-B035 and the alert record they need, X-FAIL-013, from P4b #23).

  1. SHP-B009-AC3, "the Lead has been told once": SHP-2 proves the other half (a list more than 3 days past its last good download is not held by the point check). Telling the Lead once per episode needs one alert record, owner Warehouse Lead, per carrier list while it is stale. Signals SHP-2 provides through shipment/interface.py: is_stale(carrier) and last_good_download(carrier) (the latest last_listed of the carrier's Pickup Points; a failed or refused download writes nothing, so it does not move). Open the alert when a carrier's download fails and is_stale(carrier) turns true; close it when a good download makes it current again. The three download jobs are shipment/points.py: download_mpl_points, download_gls_points, download_foxpost_points.
  2. SHP-B010-AC1, "the Lead is alerted once": one alert per note when the label job holds a label for "pickup point closed or changed" (the hold itself is SHP-3a, feat(spawn): add cb harness adapter for account-B crewmates #40, using points.check_pickup_point).

SHP-B009-AC3, SHP-B010-AC1 and SHP-B010-AC2 are not in spec/coverage-scope.txt from SHP-2.

@witt3rd

witt3rd commented Nov 4, 2026

Copy link
Copy Markdown

Rebased onto main b955568 (stack #80 <- #84 <- #87 <- #93), tier1 green. Current numbers (supersede the first-push tables): handler mass 107,680 -> 106,611 (-1,069), spec 61,396 -> 63,827, share 35.76% -> 36.88%

@huzaifarjkhan

Copy link
Copy Markdown

Clip re-recorded after firstmate's review: Messages now opens on one made-up message from "Sam" ("Running 5 min late, save me a seat?"), seeded through the SMS provider (no real name or number), with FIVE's timer tab counting down. About 7 s, 414 KB. Alt text and docs updated in 12507adb.

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 18, 2026
…eck (kunchenguid#84)

* feat(bin): direct-line second mates and versioned reads for a crew page

A second mate whose own charter opts in (fm-brief.sh --direct-line, off by
default) may now talk with the captain directly, while the first mate keeps
supervising it:

- fm-direct-line.sh resolves a mate only through data/secondmates.md and
  asserts its identity, its local parent binding and its opt-in before
  anything is typed; copies every message to the parent channel first; types
  only through desk-voice for that home, once per client id, with a pollable
  delivery record; keeps the captain's order behind an undrained mailbox; and
  closes a held call the message answers through fm-captain-hold.sh.
- A mate talking with the captain (a recent message, or its own declared wait)
  is never nudged or relaunched: the steering-inbox doorbell and its re-ring
  ladder wait, the watcher holds its drain nudge and stall alert, fm-control
  refuses without --owner-approved, and bearings shows the state.
- One per-home pane-writer lock (fm-pane-writer-lib.sh) now covers every
  typist into a mate's pane, including the parent's doorbell; desk-voice
  send gains --client-id, --expect-home and a delivery read.
- fm-web.sh conversation prints a home's conversation as versioned JSON, and
  fm-secondmate-pin.sh shows, sets or clears one mate's model pin safely.

AGENTS.md hard rule 4 and the secondmate-provisioning and
stuck-crewmate-recovery skills carry the narrow carve-out for opted-in mates;
docs/direct-line.md owns the design.

* fix(bin): harden the direct line's send, answer and talking paths

A second-opinion security review of the direct line found ways a message
could close the wrong held call, be sent twice or with other words, shield a
mate from recovery, or reach the harness as keys. This closes them:

- An answer needs the identity of the call the captain saw and words, closes
  it by compare-and-answer, records which message closed it, and is never
  resumed or answered once the record is a few minutes old. The mate may
  close a call only with `fm-direct-line.sh answered`, citing that message.
- Client ids and task ids are checked as whole strings. Both delivery paths
  carry the client id, send and delivery adopt desk-voice's own record, a
  reused id with other words is refused, an unmarked parent copy is redone,
  and messages are capped at 8000 characters.
- The opt-in and the captain's message stamp now live in the parent home
  (`fm-direct-line.sh enable`), so a mate cannot opt itself in. Talking needs
  a live primary, ignores future stamps, reads stamps as decimal, caps a
  declared wait at four hours, and defers a steer for at most an hour.
- Talking is marked before typing and put back on failure. fm-control holds
  the mate's pane-writer lock across its send and audits --owner-approved.
- Desk-voice finishes a send and records it even when its caller stops it,
  and never types a line that starts with !, / or #. Calls into desk-voice
  and captain-hold are bounded.
- The pin command checks the new pin reads back exactly before replacing the
  file, and refuses a model or mate id starting with a dash.

* no-mistakes(review): Close held calls on poll, harden send bounds and lock

* no-mistakes(review): Busy lock keeps record exit codes; poll never waits

* no-mistakes(lint): Silence deliberate SC2016 in direct-line test helper

* no-mistakes(ci): The 7 CI failures came from 4 separate causes, and all four are fixed. One local check is still open: my full local run of tests/fm-test-run.test.sh failed on an unrelated case, described at the end. Full suite only adds up the other lanes, so it should clear once they pass. 1. **Lint 1 and Lint 2.** Rule: test files must pass ShellCheck when it follows sourced libraries, as CI runs it. Fixes: - tests/desk-send-fixture.sh: two unused loop variables `i` became `_`, and `i` came out of the `local` list. - tests/fm-direct-line.test.sh: the subshell that loads fm-task-inbox-lib.sh now has `source=/dev/null` and a commented SC2034 disable, because the library reads `STATE`. - tests/fm-brief.test.sh: the inline load of fm-direct-line-lib.sh now has `source=/dev/null`. - I reproduced the warnings locally first. Every changed .sh file now lints clean. 2. **Test coverage guard, and the same guard inside fm-test-run.test.sh (Behavior portable parallel 3).** Rule: every portable serial shard must pack at or under 1,200,000 ms. - The two new suites had no timing hints, so they were packed at the 45,000 ms default. I added their measured Ubuntu times from CI run 44202451213: 31,889 ms for tests/fm-direct-line.test.sh and 2,053 ms for tests/fm-secondmate-pin.test.sh. - Even measured, all 17 shards still packed at about 1,201,000 ms, so the serial lane now has 18 shards. The count changed in tests/fork-test-timing.conf (`serial-shards 18`), the ci.yml matrix, and the windows-wsl.yml lane list (`portable-serial-Nof18`). - The timing source is recorded in docs/fm-test-portable-shards.md. - `bin/fm-test-run.sh --check-coverage` now prints ok, with the largest serial shard at 1,142,531 ms. The workflow files still validate. 3. **Behavior portable serial 9.** Rule: a test's cut-down copy of bin/ must include every library its scripts load. fm-task-inbox-lib.sh now loads fm-pane-writer-lib.sh and fm-direct-line-lib.sh, but tests/fm-remote-transport-lanes.test.sh did not copy them. I added both, and that suite now passes in full. 4. **Behavior portable serial 12.** This was a timing flake in tests/fm-extension-binding.test.sh, a file this PR does not touch. Rule: a test step must not give up before the coordinator running it does. - The `coordinator-late-pass` step waited only about 5 s for a sibling step. That sibling starts alongside six heavy concurrent jobs. - It now waits until the coordinator's own deadline (`FM_EXTENSION_BINDING_LANE_DEADLINE_EPOCH`). - I reproduced the exact CI failure by delaying the sibling past the old wait. The same delayed run passes with the fix, and the coordinator section passes normally. **Local verification:** - fm-direct-line, fm-brief's direct-line case, fm-secondmate-pin and fm-remote-transport-lanes all pass. - My full local run of tests/fm-test-run.test.sh stopped on "shared helper selects pr-forge dependents". I don't think this change caused it: - CI passed that case on this same PR. - Its fixture copies only bin/fm-test-run.sh, which I did not change. - Run on its own locally, it passes. - That suite stops at its first failure, so its later cases were not reached in that run. An earlier local run that hit the time limit had already passed both shard-packing cases (parallel lanes hinted and balanced, serial shards a complete, disjoint split)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants