Skip to content

fix(bin): retain pending inbox note wakes through acknowledgement - #5493

Open
slee029 wants to merge 8 commits into
kunchenguid:mainfrom
slee029:fm/fm-inbox-note-presentation-drop
Open

slee029 wants to merge 8 commits into
kunchenguid:mainfrom
slee029:fm/fm-inbox-note-presentation-drop

Conversation

@slee029

@slee029 slee029 commented Sep 24, 2026 •

Copy link
Copy Markdown

Intent

Rebase of upstream PR #5493 onto current upstream main (30ef650) with its intent unchanged; the only conflicts were the bin/fm-wake-drain.sh header comment and docs/watcher-continuity.md, which upstream had restructured into subsections, so the pending-inbox-note acknowledgement rule was placed into the new "Acknowledgement cutoffs" subsection. Original intent: captain inbox notes were being dropped - an inbox note check wake was announced, the wake queue drained and acknowledged through a range covering it, and the root never saw the note, while fm-inbox.sh announce refuses to re-append. The fix keeps an inbox: check wake row queued while state/inbox/.note is still pending, so an --ack-through cannot discard it before the note is handled with bin/fm-inbox.sh drain --ack ; main acknowledgement keeps the row claimed for the next drain, branch acknowledgement releases it for the next grant or main drain. Deliver a regression test that appends one inbox note wake among 40 status wakes and asserts the note is presented and survives an ack-through, plus same-turn handling, late arrivals, and branch grants. No new behavior beyond the original PR; do not expand scope.

What Changed

  • Keep an inbox:<id> check wake queued while its note is pending. Main acknowledgement retains its claim; branch acknowledgement releases it for a later grant or main drain.
  • Document when the wake can be consumed and add regression coverage for presentation among 40 status wakes, same-turn handling, late arrivals, and branch grants.

Risk Assessment

✅ Low: The pending-note retention is bounded to acknowledged inbox wake rows, and the reviewed main and branch paths preserve the intended claim and grant behavior.

Testing

The targeted regression test covered 40 status wakes, same-turn handling, late arrivals, and branch grants, but did not establish live results for those scenarios. A direct lab CLI run confirmed that a pending note reappears after wake acknowledgement and its row is consumed after the note is handled.

  • Live validation: ⚠️ inconclusive - 1 of 5 scenarios driven live against the product
Scenario Result Live Evidence
A pending inbox note is presented again after the caller acknowledges its wake, then its row is consumed after the note is handled ✅ pass live Inbox note CLI transcript
A note among 40 status wakes is presented and survives wake acknowledgement ⏸️ untested no The prior payload records only a regression test, not a live product run of this scenario; drive it against the running product to establish a live result.
Handling a note in the same turn allows its wake row to be consumed ⏸️ untested no The prior payload records only a regression test, not a live product run of this scenario; drive it against the running product to establish a live result.
A late arrival remains grantable while an earlier pending note is retained ⏸️ untested no The prior payload records only a regression test, not a live product run of this scenario; drive it against the running product to establish a live result.
An away-branch acknowledgement releases a pending note for the next branch grant ⏸️ untested no The prior payload records only a regression test, not a live product run of this scenario; drive it against the running product to establish a live result.
Evidence: Inbox note CLI transcript

Source: Inbox note CLI transcript

queued 1790483627-vK38BY
  review the release canary
  firstmate will pick this up at its next check.
1790483627	1	check	inbox:1790483627-vK38BY	check: captain inbox note 1790483627-vK38BY - review the release canary
ack instruction: bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 2412079.1790483627.0SyEAB
1790483627	1	check	inbox:1790483627-vK38BY	check: captain inbox note 1790483627-vK38BY - review the release canary
acked 1790483627-vK38BY
handled row consumed
- Outcome: ⚠️ 1 warning across 1 run (2m44s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (2) ✅
  • 🚨 bin/fm-wake-drain.sh:948 - When a main drain presents a pending note and another wake arrives before its ack, this unbounded claim_main_rows_locked also claims the unseen, above-cutoff wake. In away posture, the next branch grant then refuses that row because main owns it, even though main is parked. Reclaim only the retained note rows; leave later arrivals unclaimed. The late-arrival test handles its first note before ack, so it does not exercise this path.

🔧 Fix applied.
1 warning still open:

  • ⚠️ bin/fm-wake-drain.sh:948 - When the pending note is the only claimed row, consume_actor_rows_locked removes the empty main claim file. This cat then prints a file-not-found error during a successful acknowledgement; sort masks cat's failure. Read the claim only if it still exists.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (1 of 5 scenarios were driven live against the product); untested: A note among 40 status wakes is presented and survives wake acknowledgement, Handling a note in the same turn allows its wake row to be consumed, A late arrival remains grantable while an earlier pending note is retained, An away-branch acknowledgement releases a pending note for the next branch grant
  • Live validation: ⚠️ inconclusive - 1 of 5 scenarios driven live against the product
Scenario Result Live Evidence
A pending inbox note is presented again after the caller acknowledges its wake, then its row is consumed after the note is handled ✅ pass live Inbox note CLI transcript
A note among 40 status wakes is presented and survives wake acknowledgement ⏸️ untested no The prior payload records only a regression test, not a live product run of this scenario; drive it against the running product to establish a live result.
Handling a note in the same turn allows its wake row to be consumed ⏸️ untested no The prior payload records only a regression test, not a live product run of this scenario; drive it against the running product to establish a live result.
A late arrival remains grantable while an earlier pending note is retained ⏸️ untested no The prior payload records only a regression test, not a live product run of this scenario; drive it against the running product to establish a live result.
An away-branch acknowledgement releases a pending note for the next branch grant ⏸️ untested no The prior payload records only a regression test, not a live product run of this scenario; drive it against the running product to establish a live result.
  • bash tests/fm-wake-drain-inbox-note.test.sh
  • Ran fm-inbox.sh note, fm-wake-drain.sh, the printed --ack-through command, and fm-inbox.sh drain --ack against a disposable lab home.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@slee029

slee029 commented Sep 24, 2026

Copy link
Copy Markdown
Author

The CI workflow for this fork PR is waiting on maintainer approval (action_required). Could a maintainer approve the workflow run so the checks can execute? https://github.com/kunchenguid/firstmate/actions/runs/35960927907

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: stamped waiting-author.

HEAD 4a40b09d7fe945162c55b7152db7698ccbe7002a. Attestation MATCH (body binds tip). Require no-mistakes FAIL 35960927972: pipeline test step is status=skipped — gate requires review/test/document completed. CI 35960927907 approved and in progress. MERGEABLE/UNSTABLE. Fork workflows approved after safe diff review (no .github/workflows/*, no security tip).

contract-class: restore — inspected tip vs main. Unconfigured path: bin/fm-inbox.sh already promises a durable note + one check wake so the note is presented at the next drain; on main, --ack-through consumed claimed rows including inbox:<id> while state/inbox/<id>.note stayed pending, and announce refuses re-append for already-announced notes — stranding the note. Tip retains pending inbox check rows across main/branch ack until fm-inbox.sh drain --ack handles the note, then consumes. Same check/inbox surface; retirement boundary fixed to the durable answer. Not a new wake class or always-on observer.

VISION: One captain/interface aligns (honest presentation of captain notes under load); Authority aligns (no new autonomy); Scripts/judgment aligns (ack retention is scripted); Restart aligns (obligation retired only by note handling, not wake-ack alone); Delegation n/a; Fleet/vendor n/a; Scope aligns (wake/inbox command layer). Align.

Author: re-run no-mistakes so test is completed (not skipped), then wait for green CI. Do not escalate while NM/CI blockers remain. Firstmate-flag no.

@slee029 slee029 changed the title fix: retain pending inbox note wakes until handled fix: retain pending inbox note wakes until notes are acknowledged Sep 24, 2026
@slee029

slee029 commented Sep 24, 2026

Copy link
Copy Markdown
Author

Re-validated at the same head (4a40b09): this run's review, test and document steps all completed (see the refreshed pipeline section above). The new Require no-mistakes run is waiting on fork-workflow approval - could a maintainer approve it? https://github.com/kunchenguid/firstmate/actions/runs/35982048007

slee029 added 5 commits September 27, 2026 03:59
…s acknowledged

A drain caller that filters the drain output down to the WAKE_ACK_REQUIRED
line and then runs the acknowledgement consumes a captain inbox note's wake
row without ever reading it, so the note stays pending with no further wake.
The acknowledgement now names every consumed note that fm-inbox.sh still
holds as pending, with the command that acknowledges it.
@slee029 slee029 changed the title fix: retain pending inbox note wakes until notes are acknowledged fix(bin): retain pending inbox note wakes through acknowledgement Sep 27, 2026
@slee029

slee029 commented Sep 27, 2026

Copy link
Copy Markdown
Author

Rebased onto current main (30ef650) and re-validated through no-mistakes; the attestation now matches head 7f3786c. The CI and Require no-mistakes runs are waiting at action_required - could a maintainer please approve them? Thanks.

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.

2 participants