Skip to content

fix: preserve continuation handoffs in wake drains off Pi - #47

Merged
peterOC26 merged 4 commits into
mainfrom
fm/fm-drain-continuation-offpi-c1
Nov 9, 2026
Merged

peterOC26 merged 4 commits into
mainfrom
fm/fm-drain-continuation-offpi-c1

Conversation

@peterOC26

@peterOC26 peterOC26 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Intent

Captain's fleet needs the wake drain not to hide a continuation step. Found 2026-10-01 by the no-mistakes review of an earlier upstream sync (finding review-2) and left out as pre-existing: bin/fm-wake-drain.sh print_branch_outcomes_section prints captain rows with only seq/task/recordedAgo/summary, while fm-branch-outcome.sh present emits the fork's continuation field (PR 21). If a Pi-recorded captain row with a continuation is drained off Pi (supervision host) before it is processed, the next authorized step can be acknowledged without anyone acting on it.

What Changed

  • Preserve each captain continuation as a separate handoff in wake drains off Pi, while continuing to collapse plain outcomes per task.
  • Include full-outcome lookup commands for abbreviated handoffs and require continuation handling before acknowledgement.
  • Update supervision documentation and add regression coverage for repeated presentation, multiple handoffs, byte limits, and acknowledgement boundaries.

Risk Assessment

✅ Low: The change is limited to the off-Pi drain's captain-row projection: each continuation row is keyed by its own seq so it never collapses, and abbreviated handoffs carry a working lookup --seqs pointer. The byte cap still presents only the oldest contiguous run, so the printed mark-processed target covers exactly what was shown. The emitted processing duty and docs now match the Pi extension's instruction. Store validation guarantees a continuation is a non-blank string on a captain row, so no false-positive handoff marker is possible, and no other tool parses the drain lines.

Testing

The focused drain suite and direct product CLI scenarios passed in disposable marked homes without test seams. Evidence covers replay, collapse, UTF-8 limits, full lookups, acknowledgement boundaries, emitted instructions, and compatibility. Labs were removed; source files remain unchanged.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Drain previously read and newer handoffs for one task; each survives plain-row collapse and repeats until acknowledged. ✅ pass live Live CLI transcript: mixed lab
Drain oversized UTF-8 handoffs; every abbreviated row retains a working lookup returning its complete continuation. ✅ pass live Live CLI transcript: bounded lab
Exceed the presentation budget; acknowledge only the emitted boundary and retrieve all withheld outcomes on the next drain. ✅ pass live Live CLI transcript: bounded lab; 3597 presented bytes, acknowledgement through 6, remaining sequences 7–9
Receive processing instructions requiring reconciliation, authorized continuation handling, duplicate prevention, and full lookup before acknowledgement. ✅ pass live Live CLI transcript: emitted BRANCH OUTCOMES header
Drain legacy and routine outcomes, then disable host presentation; routine visibility stays compatible and disabled presentation leaves handoffs unread. ✅ pass live Live CLI transcript: mixed and opt-out labs
Evidence: Live CLI transcript

Source: Live CLI transcript


$ FM_HOME=<disposable lab> bash bin/fm-lab-home.sh create ~/.no-mistakes/worktrees/7f0ec18181b6/01M70GTNYFBFR3KQHVN2KVHAEZ/fm-lab.jscr3kks/mixed
~/.no-mistakes/worktrees/7f0ec18181b6/01M70GTNYFBFR3KQHVN2KVHAEZ/fm-lab.jscr3kks/mixed
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-harness.sh
codex
[exit 0]
Actual current harness detected without test seams: codex

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary implementation complete --continuation Implementation complete.
Start	the authorized validation;
then report its result.
1
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh mark-read --through 1
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary older CI note
2
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary second stage complete --continuation Start authorized stage two.
3
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary newest CI note
4
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task legacy --verdict captain --summary needs a decision
5
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task routine --verdict routine --summary still working
6
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task silent --verdict routine --summary unchanged --silent true
7
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-wake-drain.sh
BRANCH OUTCOMES (captain outcomes the supervision session recorded for you, plain rows collapsed per task, continuation rows kept separately, oldest first; each says what was true when it was recorded, so check the task's current state first, including its still-open decisions listed above under OPEN DECISIONS, and sort them into still open and already settled, such as a decision since answered, a PR since merged, or a task since finished - process the still-open ones as firstmate: tell the captain, land or merge what is ready, answer or escalate a decision, or act on a blocker; your reply to the captain covers only those, as if the settled ones had never been listed, and a settled one without a pending continuation needs only the acknowledgement. For each continuation handoff, reconcile current task/stage state and existing authority, then start the authorized spawn, steer, or handoff before acknowledging; if already started, do not duplicate it. Record the actual blocker, decision, or evidence that no further action is needed when you cannot advance. If a handoff is abbreviated, read the full outcome using its lookup --seqs command before acting or acknowledging):
[seq 1, recorded 0m ago] gamma: implementation complete; MAIN continuation handoff: Implementation complete. Start the authorized validation; then report its result.
[seq 4, newest of 2 for this task, recorded 0m ago] gamma: newest CI note
[seq 3, recorded 0m ago] gamma: second stage complete; MAIN continuation handoff: Start authorized stage two.
[seq 5, recorded 0m ago] legacy: needs a decision
BRANCH OUTCOMES: after processing them run bin/fm-branch-outcome.sh mark-processed --through 5; until then every drain presents them again
BRANCH OUTCOMES, ROUTINE (handled by the supervision session since your last drain; for your awareness, nothing to acknowledge):
[seq 6] routine: still working
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-wake-drain.sh
BRANCH OUTCOMES (captain outcomes the supervision session recorded for you, plain rows collapsed per task, continuation rows kept separately, oldest first; each says what was true when it was recorded, so check the task's current state first, including its still-open decisions listed above under OPEN DECISIONS, and sort them into still open and already settled, such as a decision since answered, a PR since merged, or a task since finished - process the still-open ones as firstmate: tell the captain, land or merge what is ready, answer or escalate a decision, or act on a blocker; your reply to the captain covers only those, as if the settled ones had never been listed, and a settled one without a pending continuation needs only the acknowledgement. For each continuation handoff, reconcile current task/stage state and existing authority, then start the authorized spawn, steer, or handoff before acknowledging; if already started, do not duplicate it. Record the actual blocker, decision, or evidence that no further action is needed when you cannot advance. If a handoff is abbreviated, read the full outcome using its lookup --seqs command before acting or acknowledging):
[seq 1, recorded 0m ago] gamma: implementation complete; MAIN continuation handoff: Implementation complete. Start the authorized validation; then report its result.
[seq 4, newest of 2 for this task, recorded 0m ago] gamma: newest CI note
[seq 3, recorded 0m ago] gamma: second stage complete; MAIN continuation handoff: Start authorized stage two.
[seq 5, recorded 0m ago] legacy: needs a decision
BRANCH OUTCOMES: after processing them run bin/fm-branch-outcome.sh mark-processed --through 5; until then every drain presents them again
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh mark-processed --through 5
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-wake-drain.sh
[exit 0]
Persisted state: processed=5; immutable outcome-log digest preserved; next drain has no outcomes.

$ FM_HOME=<disposable lab> bash bin/fm-lab-home.sh create ~/.no-mistakes/worktrees/7f0ec18181b6/01M70GTNYFBFR3KQHVN2KVHAEZ/fm-lab.jscr3kks/bounded
~/.no-mistakes/worktrees/7f0ec18181b6/01M70GTNYFBFR3KQHVN2KVHAEZ/fm-lab.jscr3kks/bounded
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary stage complete --continuation <2125 UTF-8 bytes>
1
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary <2100 UTF-8 bytes> --continuation <2125 UTF-8 bytes>
2
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary stage complete --continuation <2125 UTF-8 bytes>
3
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary <2100 UTF-8 bytes> --continuation <2125 UTF-8 bytes>
4
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary stage complete --continuation <2125 UTF-8 bytes>
5
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary <2100 UTF-8 bytes> --continuation <2125 UTF-8 bytes>
6
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary stage complete --continuation <2125 UTF-8 bytes>
7
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary <2100 UTF-8 bytes> --continuation <2125 UTF-8 bytes>
8
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary later CI note
9
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-wake-drain.sh
BRANCH OUTCOMES (captain outcomes the supervision session recorded for you, plain rows collapsed per task, continuation rows kept separately, oldest first; each says what was true when it was recorded, so check the task's current state first, including its still-open decisions listed above under OPEN DECISIONS, and sort them into still open and already settled, such as a decision since answered, a PR since merged, or a task since finished - process the still-open ones as firstmate: tell the captain, land or merge what is ready, answer or escalate a decision, or act on a blocker; your reply to the captain covers only those, as if the settled ones had never been listed, and a settled one without a pending continuation needs only the acknowledgement. For each continuation handoff, reconcile current task/stage state and existing authori

... [40668 bytes truncated] ...

界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界 Start authorized step 7."}
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh lookup --seqs 8
{"seq":8,"epoch":1794240520,"task":"gamma","wake":"","verdict":"captain","summary":"界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界","silent":false,"statusEndpoint":0,"statusIdent":"-","continuation":"界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界界 Start authorized step 8."}
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh mark-processed --through 9
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-wake-drain.sh
[exit 0]
Observed UTF-8 row byte lengths including newline: [600, 599, 600, 599, 600, 599]; total=3597; after first acknowledgement unprocessed seqs=[7, 8, 9]; final processed=9.

$ FM_HOME=<disposable lab> bash bin/fm-lab-home.sh create ~/.no-mistakes/worktrees/7f0ec18181b6/01M70GTNYFBFR3KQHVN2KVHAEZ/fm-lab.jscr3kks/opt-out
~/.no-mistakes/worktrees/7f0ec18181b6/01M70GTNYFBFR3KQHVN2KVHAEZ/fm-lab.jscr3kks/opt-out
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh append --task gamma --verdict captain --summary pending handoff --continuation Start authorized validation.
1
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-wake-drain.sh
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-wake-drain.sh
BRANCH OUTCOMES (captain outcomes the supervision session recorded for you, plain rows collapsed per task, continuation rows kept separately, oldest first; each says what was true when it was recorded, so check the task's current state first, including its still-open decisions listed above under OPEN DECISIONS, and sort them into still open and already settled, such as a decision since answered, a PR since merged, or a task since finished - process the still-open ones as firstmate: tell the captain, land or merge what is ready, answer or escalate a decision, or act on a blocker; your reply to the captain covers only those, as if the settled ones had never been listed, and a settled one without a pending continuation needs only the acknowledgement. For each continuation handoff, reconcile current task/stage state and existing authority, then start the authorized spawn, steer, or handoff before acknowledging; if already started, do not duplicate it. Record the actual blocker, decision, or evidence that no further action is needed when you cannot advance. If a handoff is abbreviated, read the full outcome using its lookup --seqs command before acting or acknowledging):
[seq 1, recorded 0m ago] gamma: pending handoff; MAIN continuation handoff: Start authorized validation.
BRANCH OUTCOMES: after processing them run bin/fm-branch-outcome.sh mark-processed --through 1; until then every drain presents them again
[exit 0]

$ FM_HOME=<disposable lab> bash bin/fm-branch-outcome.sh mark-processed --through 1
[exit 0]

All disposable lab directories removed on exit.
Evidence: Reproducible CLI scenario driver

Source: Reproducible CLI scenario driver

import os, pathlib, subprocess, tempfile, json, re, hashlib
ROOT = pathlib.Path('~/.no-mistakes/worktrees/7f0ec18181b6/01M70GTNYFBFR3KQHVN2KVHAEZ')
EVIDENCE = pathlib.Path('~/.no-mistakes/evidence/01M70GTNYFBFR3KQHVN2KVHAEZ')
log = (EVIDENCE / 'continuation-cli-transcript.txt').open('w')
env = os.environ.copy()
for key in list(env):
    if key.startswith('FM_') or key in ('STATE', 'HERDR_ENV', 'HERDR_SESSION', 'HERDR_SOCKET_PATH'):
        env.pop(key)

def run(home, script, *args):
    local = dict(env, FM_HOME=str(home))
    command = ['bash', str(ROOT / 'bin' / script), *args]
    display = ' '.join([script, *[a if len(a) < 240 else f'<{len(a.encode())} UTF-8 bytes>' for a in args]])
    result = subprocess.run(command, cwd=ROOT, env=local, text=True, capture_output=True, timeout=30)
    log.write(f'\n$ FM_HOME=<disposable lab> bash bin/{display}\n{result.stdout}{result.stderr}[exit {result.returncode}]\n')
    log.flush()
    assert result.returncode == 0, (display, result.stdout, result.stderr)
    return result.stdout

def append(home, task, summary, continuation=None, verdict='captain', silent=False):
    args = ['append', '--task', task, '--verdict', verdict, '--summary', summary]
    if continuation is not None: args += ['--continuation', continuation]
    if silent: args += ['--silent', 'true']
    return int(run(home, 'fm-branch-outcome.sh', *args).strip())

def drain(home):
    return run(home, 'fm-wake-drain.sh')

def ack(home, n):
    return run(home, 'fm-branch-outcome.sh', 'mark-processed', '--through', str(n))

def lines(output):
    return [x for x in output.splitlines() if x.startswith('[seq ')]

def stored(home, name):
    path = home / 'state' / name
    return path.read_text().strip() if path.exists() else None

results=[]
with tempfile.TemporaryDirectory(prefix='fm-lab.', dir=ROOT) as parent:
    parent = pathlib.Path(parent)
    def home(name):
        h=parent/name
        run(h, 'fm-lab-home.sh', 'create', str(h))
        (h/'config'/'supervision-host').touch()
        return h

    h=home('mixed')
    detected=run(h,'fm-harness.sh').strip()
    assert detected not in ('pi','pi-signed','unknown'), detected
    log.write(f'Actual current harness detected without test seams: {detected}\n')
    continuation='Implementation complete.\nStart\tthe authorized validation;\rthen report its result.'
    append(h,'gamma','implementation complete',continuation)
    # Use the public read interface as a prior presenter would. No processing acknowledgement.
    run(h,'fm-branch-outcome.sh','mark-read','--through','1')
    append(h,'gamma','older CI note')
    append(h,'gamma','second stage complete','Start authorized stage two.')
    append(h,'gamma','newest CI note')
    append(h,'legacy','needs a decision')
    append(h,'routine','still working',verdict='routine')
    append(h,'silent','unchanged',verdict='routine',silent=True)
    digest=hashlib.sha256((h/'state'/'branch-outcomes.jsonl').read_bytes()).hexdigest()
    first=drain(h)
    for seq in (1,3,4,5): assert any(x.startswith(f'[seq {seq},') for x in lines(first))
    assert 'MAIN continuation handoff: Implementation complete. Start the authorized validation; then report its result.' in first
    assert 'MAIN continuation handoff: Start authorized stage two.' in first
    assert 'gamma: newest CI note' in first and 'gamma: older CI note' not in first
    assert 'newest of 2 for this task' in first
    assert 'legacy: needs a decision' in first
    assert 'routine: still working' in first and 'silent: unchanged' not in first
    assert 'mark-processed --through 5;' in first
    assert stored(h,'.branch-outcomes-processed') is None
    second=drain(h)
    for seq in (1,3,4,5): assert any(x.startswith(f'[seq {seq},') for x in lines(second))
    assert 'BRANCH OUTCOMES, ROUTINE' not in second
    duty=[
        'reconcile current task/stage state and existing authority',
        'start the authorized spawn, steer, or handoff before acknowledging',
        'if already started, do not duplicate it',
        'Record the actual blocker, decision, or evidence that no further action is needed',
        'read the full outcome using its lookup --seqs command before acting or acknowledging',
        'a settled one without a pending continuation needs only the acknowledgement',
    ]
    for instruction in duty: assert instruction in first
    # This driver validates the emitted processing contract, not LLM interpretation or a real spawn.
    ack(h,5)
    after=drain(h)
    assert 'BRANCH OUTCOMES' not in after
    assert stored(h,'.branch-outcomes-processed') == '5'
    assert hashlib.sha256((h/'state'/'branch-outcomes.jsonl').read_bytes()).hexdigest()==digest
    log.write('Persisted state: processed=5; immutable outcome-log digest preserved; next drain has no outcomes.\n')
    results += ['older and newer continuations survive plain-row collapse and repeat until acknowledged',
                'emitted processing contract requires reconciliation, authorized action, duplicate prevention and blocker/no-action evidence',
                'legacy rows and visible/silent routine presentation remain compatible']

    h=home('bounded')
    padding='界'*700
    expected={}
    for n in range(1,9):
        expected[n]=padding+f' Start authorized step {n}.'
        append(h,'gamma','stage complete' if n%2 else padding,expected[n])
    append(h,'gamma','later CI note')
    first=drain(h)
    rowlines=lines(first)
    assert len(rowlines)==6
    sizes=[len((x+'\n').encode('utf-8')) for x in rowlines]
    assert max(sizes)<=600 and sum(sizes)<=4000
    assert '3 newer captain outcome(s) are held back' in first
    assert 'mark-processed --through 6;' in first
    assert not any(x.startswith('[seq 7,') or x.startswith('[seq 8,') or x.startswith('[seq 9,') for x in rowlines)
    for n,line in enumerate(rowlines,1):
        match=re.search(r'full MAIN continuation handoff: (bin/fm-branch-outcome.sh lookup --seqs (\d+))$',line)
        assert match and int(match[2])==n
        full=json.loads(run(h,'fm-branch-outcome.sh','lookup','--seqs',str(n)))
        assert full['continuation']==expected[n]
    assert stored(h,'.branch-outcomes-processed') is None
    again=drain(h)
    assert lines(again)==rowlines
    ack(h,6)
    unprocessed=[json.loads(x)['seq'] for x in run(h,'fm-branch-outcome.sh','unprocessed').splitlines()]
    assert unprocessed==[7,8,9]
    second=drain(h)
    assert len(lines(second))==3
    for n in (7,8):
        assert f'lookup --seqs {n}' in second
        full=json.loads(run(h,'fm-branch-outcome.sh','lookup','--seqs',str(n)))
        assert full['continuation']==expected[n]
    assert 'later CI note' in second and 'mark-processed --through 9;' in second
    ack(h,9)
    assert 'BRANCH OUTCOMES' not in drain(h)
    log.write(f'Observed UTF-8 row byte lengths including newline: {sizes}; total={sum(sizes)}; after first acknowledgement unprocessed seqs={unprocessed}; final processed=9.\n')
    results.append('UTF-8 handoffs keep executable full-outcome lookups and contiguous bounded acknowledgement')

    h=home('opt-out')
    append(h,'gamma','pending handoff','Start authorized validation.')
    (h/'config'/'supervision-host-off').touch()
    assert 'BRANCH OUTCOMES' not in drain(h)
    assert stored(h,'.branch-outcomes-cursor') is None
    (h/'config'/'supervision-host-off').unlink()
    output=drain(h)
    assert 'MAIN continuation handoff: Start authorized validation.' in output
    ack(h,1)
    results.append('host opt-out leaves the handoff unread for later presentation')
log.write('\nAll disposable lab directories removed on exit.\n')
log.close()
(EVIDENCE/'continuation-scenario-results.json').write_text(json.dumps({'harness':detected,'live_cli_scenarios':results},indent=2)+'\n')
print(json.dumps({'harness':detected,'results':results,'transcript':str(EVIDENCE/'continuation-cli-transcript.txt')},indent=2))

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 1 issue found → auto-fixed ✅
  • ⚠️ docs/supervision-host.md - merge conflict rebasing onto origin/main

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

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Drain previously read and newer handoffs for one task; each survives plain-row collapse and repeats until acknowledged. ✅ pass live Live CLI transcript: mixed lab
Drain oversized UTF-8 handoffs; every abbreviated row retains a working lookup returning its complete continuation. ✅ pass live Live CLI transcript: bounded lab
Exceed the presentation budget; acknowledge only the emitted boundary and retrieve all withheld outcomes on the next drain. ✅ pass live Live CLI transcript: bounded lab; 3597 presented bytes, acknowledgement through 6, remaining sequences 7–9
Receive processing instructions requiring reconciliation, authorized continuation handling, duplicate prevention, and full lookup before acknowledgement. ✅ pass live Live CLI transcript: emitted BRANCH OUTCOMES header
Drain legacy and routine outcomes, then disable host presentation; routine visibility stays compatible and disabled presentation leaves handoffs unread. ✅ pass live Live CLI transcript: mixed and opt-out labs
  • bash tests/fm-supervision-host-drain.test.sh
  • python3 ~/.no-mistakes/evidence/01M70GTNYFBFR3KQHVN2KVHAEZ/drive-continuation.py
  • Inspected the branch diff, captured actual CLI output and persisted acknowledgement state, and verified lab cleanup and a clean working tree.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@peterOC26 peterOC26 closed this Nov 9, 2026
@peterOC26 peterOC26 reopened this Nov 9, 2026
@peterOC26
peterOC26 force-pushed the fm/fm-drain-continuation-offpi-c1 branch from 7acb110 to 76b3544 Compare November 9, 2026 14:14
@peterOC26
peterOC26 force-pushed the fm/fm-drain-continuation-offpi-c1 branch from 76b3544 to 17ce69c Compare November 9, 2026 16:10
@peterOC26 peterOC26 changed the title fix: preserve continuation handoffs in off-Pi wake drains fix: preserve continuation handoffs in wake drains off Pi Nov 9, 2026
@peterOC26
peterOC26 merged commit 1c6ea21 into main Nov 9, 2026
65 of 71 checks passed
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.

1 participant