Repository navigation
fix(bin): reopen the remote-reply continuity decision on a later break - #6708
Conversation
|
commented
Oct 6, 2026
|
Speaking as Kun's firstmate: reviewed against main What I checked: the body says What still needs fixing (Greptile P1 on
Heads-up: #6710 also edits Contract-class: restore. Main already escalates a remote-reply continuity break as a keyed open decision that the operator resolve closes. Today a later distinct break on the same route is silently read as already recorded. The fix restores that specified escalation and keeps an unchanged repeat silent. It adds no new default surface. The episode file is internal state for an existing path. VISION.md, rule by rule
Next step: push a fix for the P1. I'll look again once a fresh no-mistakes raise and green CI are on the new head. |
commented
Oct 6, 2026
|
The newer commit c8db405c takes the equivalent route. The separate episode file is gone, and the continuity line itself carries the reader offset and prefix hash, so there is one append and no state that can be stored without its line. A retry of the same break builds the identical line and is deduplicated. A distinct break builds a different line. That settles points 1, 2, and 3 by removal. The regression tests on this pull request cover a later break after repair, an unchanged re-read, and an old-format line. Point 4 is settled because the episode rewrite and the permission test no longer exist. Two limits, as the description states. Once per route after upgrading, a break recorded and resolved in the old line form is reported one more time when it is read again unchanged. A route that is retired, restored with byte-identical content and broken again at the same position builds the same line, so that break is not reported. Covering the second needs durable retirement evidence, which this change does not keep. Do you want that in this pull request or in a follow-up? I saw the note that pull request 6710 also edits |
commented
Oct 6, 2026
|
Speaking as Kun's firstmate: re-reviewed head Why here: the case you list as a limit is a retirement followed by a byte-identical restore at the same position. #6701's own reproduction is "retire, restore, break again", and the ready-for-pr note named cursor and retirement evidence. Restoring from a backup is the likely way an operator repairs a route. In that case the later break builds the same line, matches the old Please:
The one-time reopen of an old-format line after an upgrade is documented and bounded. I'm fine with it as a stated limit. Overlap: #6710 also edits Contract-class: restore (unchanged). The specified continuity escalation should reopen on a later distinct break. The tip adds no new default surface. VISION.md, rule by rule
Next step: push (1) and (2). Once a fresh no-mistakes raise and green CI are on the new head, I'll look again. As a restore, it can auto-merge then. |
A later break for the same route and reason was swallowed after the operator resolved the first one, because the status line matched for the life of the log. The continuity ingest now appends again when the cursor has moved or retirement has reset that episode, and an unchanged re-read still appends nothing. status_event_recorded is unchanged. Its other callers are the pending-reply escalation, which already decides its own episode, the parent-channel note append, and the remote document transfer note.
… before it appends the `blocked` line, so a failed store appends nothing. The changes are uncommitted in the worktree, in `bin/fm-procevent-remote-reply.sh` and `tests/fm-remote-reply.test.sh`. **Invariant:** a continuity `blocked` line is on the parent status log only when the episode record for that break is already stored. Only the `continuity-broken` branch of `cmd_ingest` appends that line, so the fix is at that one place. **What changed in `cmd_ingest`:** - It decides first whether the break needs a line, then stores the episode record, then appends. - If storing the record fails, it stops with "cannot record continuity episode" and appends nothing. - If the line is already on the log and no episode record exists, it stores the record and does not append. **One addition you did not ask for:** if the append fails after the record is stored, the adapter puts the earlier record back (or deletes the new one when none existed). Without that, the retry would read as the unchanged repeat and append nothing, which is the issue 6701 failure again. **Deviation from your test instruction:** the test does not use `chmod` on the cursor directory. `write_continuity_episode` runs `chmod 700` on that directory before every write, so a read-only directory is made writable again. The test instead makes `mktemp` fail for the episode's temporary file in that directory, the same way the existing receipt-failure test does. **Tests added to `tests/fm-remote-reply.test.sh`:** - Store failure: the second break exits 1, appends no `blocked` line and opens no decision. One retry after storage recovers exits 3 and appends a single line. - Append failure: with the status log read-only, the third break exits 1 and appends nothing. One retry after the log is writable exits 3 and appends a single line. **Verification:** `bash tests/fm-remote-reply.test.sh` ends with "ALL TESTS PASSED" with the fix. Against the script at commit b750c828 the same test file fails at "a continuity break appended its line before its episode was stored". `shellcheck -S warning` reports only an unused loop variable at line 667 of the test file, which this change does not touch. I ran no other test files. The Greptile Review check log could not be retrieved, so I worked from the finding text alone
A later break at another cursor is then a different line, so the existing duplicate check appends it and reopens the decision. An unchanged re-read builds the same line and appends nothing.
A retirement that puts the same bytes back used to rebuild the recorded line, so the later break stayed closed. The retirement count on that line makes the later break distinct.
…hout retirement count
c8db405 to
b9eaf0b
Compare
commented
Oct 6, 2026
|
Items 1 to 3 are on this pull request.
A line written before the reader position was recorded still does not match, so that one unchanged read appends once. A repair that does not move the cursor and does not retire the route still builds the same line, so it appends nothing. The match for a full prefix hash with no count was removed, because only an intermediate commit of this branch wrote that form. |
A stop between those steps must leave the count unchanged, so an unchanged continuity break still builds the same line.
commented
Oct 7, 2026
|
Correction to the earlier note on this pull request: the count is not written before the cursor is removed. Retirement removes the cursor first, and only then writes the next count. If removal fails, retirement fails and the count stays unchanged. |
|
Speaking as Kun's firstmate: re-reviewed head What I checked:
Overlap with #6710: #6710 has not landed and is still open. Both PRs edit Contract-class: restore. Main already escalates a remote-reply continuity break as a keyed decision. This makes that specified escalation reopen on a later distinct break and keeps an unchanged repeat quiet. The retirement count is internal state for that existing path, so there is no new default surface. VISION (compact, per rule): One captain / one interface: aligns (a new break no longer reads as settled). Authority explicit: aligns (the operator still resolves, and no new autonomy). Scripts own mechanics: aligns (exact position and count matching). Restart non-event: aligns (one append, and the retirement ordering is crash-safe). Delegation with a spine: aligns. Fleet outlives vendor: aligns. Scope: aligns (command-layer relay state with regression coverage). Squash-merging. Closes #6701. |
commented
Oct 7, 2026
|
Speaking as Kun's firstmate: this is merged. Thank you @tiago-peixoto — really appreciate you taking the time on this. |
Intent
Fixes #6701.
Contribute the fix for #6701, which the maintainer labelled ready-for-pr (contract class: restore): a later remote-reply continuity break appends no status line after an operator resolve, so the new decision never opens. The issue's expected behaviour: after the operator closes a continuity break, a later distinct break for the same route and reason appends a new blocked line that opens the decision again, while a repeat of the same unchanged break, whose cursor has not moved, still appends nothing.
The maintainer's triage:
status_event_recordedkeeps a match recorded for the life of the file, and its own comment says a caller that owns evidence of a new episode has to decide that itself; the continuity caller does not. Episode detection from cursor and retirement evidence is exact script work, and the reproduction makes good regression coverage. It is the same shape pull request 6654 restored for the pending-reply escalation of issue 6635.What Changed
bin/fm-procevent-remote-reply.shnow writes the continuityblockedline with the cursor offset, the first 12 characters of the cursor hash, and a retirement count for the route. A re-read of the same break builds the same line and appends nothing, while a break at a different reader position or after another retirement builds a new line that opens the decision again.<id>.retirementsbeside the cursor. It removes the cursor first, fails if the cursor cannot be removed, and only then writes the next count, so a stop between the two steps leaves the count unchanged. Ingest only reads the count and rejects a symlinked or malformed count file.tests/fm-remote-reply.test.shadds regression cases: a later break after an operator resolve, a status line in the old format, a break after retirement with identical restored bytes, and the two retirement failure points.docs/remote-secondmates.mddescribes what the status line records and when a new one is appended.Risk Assessment
✅ Low: The change is confined to the continuity branch of cmd_ingest and to cmd_retire_finalize_locked, the traced sequences (unchanged repeat, moved cursor, retirement with identical restore, failed cursor removal, stop before the count write) all give the intended result, and the remaining trade-offs were already decided by the user.
Testing
I wrote a driver script that runs the real
bin/fm-procevent-remote-reply.sh,bin/fm-procevent.sh, and the remote delta reader against throwaway homes, and ran it on the target commit 5d445ac and on a git export of the base commit 99da16d. On the target all 17 expectations pass across six scenarios: first break, unchanged repeat after a resolve, later break after the reader advanced without retirement (the issue 6701 case), repeat of that later break, break after retirement with identical restored bytes, and a retirement that cannot remove the cursor. On the base the issue reproduces: the later break appends nothing and the decision stays closed. I also ran the focused test filetests/fm-remote-reply.test.sh, which passed. Two scenarios were not driven live and are marked untested: the retirement that stops after removing the cursor, and the upgrade from an old-format line. The focused test file covers both, but with a stand-inmktempand a rewritten status file, so that is not live evidence. I did not run the full suite. The change has no UI, so the evidence is command transcripts of the parent status stream, not screenshots. All temporary homes and the base export were removed; the worktree is clean.tests/fm-remote-reply.test.sh, which runs the real adapter but injects the stop with a stand-…tests/fm-remote-reply.test.sh, which rewrites the status file into the old form. The base tra…Evidence: Target 5d445ac: driven transcript, all six scenarios
Source: Target 5d445ac1: driven transcript, all six scenarios
Evidence: Base 99da16d: same driver reproduces issue 6701
Source: Base 99da16d9: same driver reproduces issue 6701
Evidence: Driver script used for both transcripts
Source: Driver script used for both transcripts
Evidence: Focused test file output
Source: Focused test file output
Evidence: Issue 6701 step, base versus target (parent state/ios.status after the later break)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-procevent-remote-reply.sh:795- The retirement count increases once per successful run of cmd_retire_finalize_locked, not once per retirement. Sequence: bin/fm-teardown.sh:1060 finalizes (count 1 to 2), a later step such as remote_pending_replies_cleanup fails and teardown keeps the route "for retry", the operator runs teardown again, and finalize runs again (count 2 to 3) because removing an absent cursor succeeds. Break detection stays correct, because the count only has to differ after each cursor removal and it never decreases. The only inexact part is the sentence at docs/remote-secondmates.md:592, which describes the number as "how many times the route has been retired". No change is needed.bin/fm-procevent-remote-reply.sh:547- Not caused by this change: everyhandleof a continuity break prints 'fm-procevent-remote-reply.sh: line 1: tmp: unbound variable' on stderr. The base commit 99da16d prints the same message (see both transcripts). The likely source is the EXIT traprm -rf -- "$tmp"at line 547, which runs after the function's localtmpis out of scope underset -u. The exit status (3) and the status stream are correct, so it does not affect this fix; it belongs in a separate issue.tests/fm-remote-reply.test.sh, which runs the real adapter but injects the stop with a stand-…tests/fm-remote-reply.test.sh, which rewrites the status file into the old form. The base tra…bash ~/.no-mistakes/evidence/01M49YMNWBPJD4V9PH67K3NVHZ/drive-continuity.sh "$PWD"on target 5d445ac1: exit 0, 17 expectations pass, 0 failbash drive-continuity.sh <git export of base 99da16d9>: exit 1, 7 expectations fail, including 'later distinct break appends a new blocked line (expected 2, got 1)'bash tests/fm-remote-reply.test.shon target: exit 0, ALL TESTS PASSED (not live; includes 'ok - a retirement that stops after removing the cursor leaves the old count' and 'ok - an old-format continuity line does not swallow the next break')git status --shortafter testing: clean✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.