Skip to content

feat(bin): add a spoken interface that answers from records and hands work over - #2767

Merged
kunchenguid merged 18 commits into
kunchenguid:mainfrom
Inthuson:fm/voice-relay-build-v4
Aug 22, 2026
Merged

kunchenguid merged 18 commits into
kunchenguid:mainfrom
Inthuson:fm/voice-relay-build-v4

Conversation

@Inthuson

Copy link
Copy Markdown
Contributor

Intent

Give the captain a spoken round trip to firstmate that actually works: they talk to a voice agent on their laptop, it answers from firstmate's records and queues real work by handing over rather than pretending to be firstmate, on amazon.nova-2-sonic-v1:0 in eu-north-1 with the model session held on this desktop so no AWS credential sits on the laptop. The second goal is a real measurement to replace an unmeasured 1.5 to 2.5 second estimate for that relay shape: time from the end of the captain's speech to the first audio out, reported as a spread. Push to talk is the deliberate default because the captain has not chosen open mic yet. Barge-in and conversational memory across turns are step three and out of scope here.

What Changed

  • Adds the spoken round trip as four new files: bin/fm-voice-relay.py holds the amazon.nova-2-sonic-v1:0 bidirectional session on the desktop (region, model, profile and voice id read from gitignored config/voice-* or FM_VOICE_*, with a missing required value refusing rather than defaulting), bin/fm-voice-client.py captures and plays on the laptop over an SSH exec channel with no AWS credentials, bin/fm_voice_frame.py owns the shared frame format, and bin/fm_voice_records.py owns the read scope and the handover. The relay opens one model session per turn, appends 400 ms of trailing silence on talk end, treats a contentEnd/END_TURN as the end of a reply, and resolves credentials once instead of per session; --listen push-to-talk is the only mode that runs and --listen open-mic refuses at startup.
  • Adds bin/fm-inbox.sh (note, say, status, ask, list, drain --ack) and the state/inbox/ records it writes, and routes the voice agent's real-work handover through note so it appends one check wake instead of carrying a second queue. Status reads are scope-controlled: config/voice-read-scope defaults to counts, full adds open ids, titles and PR links, config/voice-read-deny substrings reduce a matching open item to a count, and done history and free-form note bodies are never assembled at any scope.
  • Adds tests/fm-voice-relay.test.sh, an offline suite covering the frame format, the read-scope and deny boundary (planted markers in finished work and a note body must never reach an answer), and the handover. Documents the interface in new docs/voice-relay.md, including the measured end-of-speech-to-first-audio spread over six runs per path (direct 1.165–1.352 s, median 1.232; over the relay 1.138–1.283 s, median 1.172) that replaces the prior unmeasured 1.5–2.5 s estimate, and registers the new scripts, config files and doc in README.md, AGENTS.md, docs/configuration.md, docs/scripts.md and docs/documentation-audiences.json.

Risk Assessment

⚠️ Medium: The two fixes from the last round are correct and well pinned, every intent criterion is satisfiable from source, and nothing left is a merge blocker; but this is 5685 lines of new subsystem whose microphone and speaker paths are unrunnable here by construction, and three narrow diagnostic gaps remain that are better closed as follow-ups than left unstated.

Testing

I drove the real client, framing, ssh path, relay, records reader and fm-inbox.sh end to end with only Nova Sonic stood in for, and captured what the captain actually sees: a spoken status answer whose numbers match an independent read of the same records, a request for real work handed over with a note and one wake on disk, and the round-2 case where the model finishes with a session mid key press — before the fix the relay is gone and the next question is never asked, after it the captain loses the rest of one key press and the next talk key gets a full working session. Both halves of the commit go red against the pre-fix files and against one-line mutations of the checked-out code, with the other 36 cases still passing. While gathering the measurement evidence I found the documented desktop check, fm-voice-relay.py --self-test, had no coverage at all, so I added two offline cases for it — that it answers from the records and times from the talk end, and that a reply arriving before the end of the clip is flagged as an unusable clock instead of recorded as a fast number — and confirmed with three mutations that neither passes vacuously. There is no rendered UI here; the end-user surface is a terminal transcript and audio, so the artifacts are the captain's transcripts, the persisted note and wake queue, the desktop's per-session records, and the reply audio as a playable WAV. Two limits stand, both already known and accepted: the absolute 1.2-1.5 s figures in docs/voice-relay.md need the live endpoint in eu-north-1 (offline the relay's own framing and process hop cost about 3 ms of median, so the docs' 0.22 s is dominated by something only the live run sees), and the microphone and speaker paths still cannot be exercised from a host with no audio device.

Evidence: Round-2 evidence index: what each file shows, and the red-before/green-after table
# Round 2: the relay survives the model finishing with a session

Round 1's evidence (`README.md`, the `harness/` and `home/` directories and the
flat `relay-*` / `handover-*` files) covers the intent as a whole. This round
covers the two changes the target commit makes, and both are the same failure
seen from the two ends of the connection:

* the relay no longer treats a clean model-session end as its own reason to stop;
* the client no longer writes a talk start ahead of the previous turn's queued
  frames, which is only reachable once a turn can end with no answer to wait for.

Everything below is the real client, the real `ssh -T` argv through a shim that
starts the relay from `env -i` plus the desktop's own environment, the real relay,
the real records reader and the real `bin/fm-inbox.sh`. Nova Sonic is the only
stand-in, and it composes its words out of the tool results the relay hands it.
It is scripted to finish with the first session 300 ms into a two second key
press, which is an ordinary end of a Bedrock session: no exception, no stop
reason, nothing to report.

## What the captain sees

Before the fix - `round2-prefix-relay-transcript.txt`. The relay is gone. The
captain is holding the talk key and there is nothing on the other end; the second
question is never asked at all, because the connection is closed before they
press again. One turn taken, one model session opened.

`` `
client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s
client: the relay ended the session
`` `

After the fix - `round2-fixed-transcript.txt`. The same session end costs the
remainder of one key press, and the next talk key gets a whole working session:
a real answer, composed from a real read of the records, over the same connection.

`` `
client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s
client: the relay ended the session
  you: how is the fleet doing right now
  assistant: Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two.
`` `

Said once, not seventeen times: the rest of that key press is another seventeen
audio frames arriving at a session that is already over.

The desktop's own record of the two sessions, `demo/session-b-fixed/model-sessions.jsonl`:

| Turn | Ended early | Audio in | Said |
| --- | --- | --- | --- |
| 1 | yes | 9,600 of 76,800 bytes | nothing |
| 2 | no | 76,800 bytes, the whole question and the talk-end padding | the answer above |

`round2-recovered-turn-reply.wav` is the reply audio the replacement session sent,
as the client wrote it, playable.

## The client half

`round2-prefix-client-transcript.txt` is the same scenario with the pre-fix client
and the fixed relay. The relay survives, but the replacement session heard
**12,800 bytes of a 76,800 byte question** - the talk-end padding and nothing else.
The captain's entire question was written after the next turn's talk start, so it
arrived with no turn open and was dropped, and the model answered a question
nobody had finished asking. The sender thread also died on
`ValueError: write to closed file`.

## Red before, green after

Each of these is the suite with one line of product code changed back, so the
cases are not passing vacuously.

| Log | Mutation | Result |
| --- | --- | --- |
| `mutation-4-session-end-break-restored.log` | the `break` on a clean session end, restored | `not ok - a model session ending did not leave the relay serving`: "the relay stopped serving when the model ended its session: 1 turn(s) taken". 36 other cases still pass. |
| `mutation-5-talk-start-unordered.log` | talk start written from the turn thread again | `not ok`: "the replacement session heard 12800 bytes of a 76800 byte question". 36 other cases still pass. |
| `mutation-1-guard-removed.log` | the self-test wrong-clock guard removed | `not ok - the guard must say why the timings cannot be used` |
| `mutation-3-clock-from-speech-start.log` | the self-test clock moved to the clip's start | `not ok`: "first audio at 2.409 is not measured from the talk end" |
| `mutation-2-wrong-clock.log` | the self-test clock keyed on a mark that does not exist | `not ok`: "no tool_use_s figure" |

## The measuring instrument

`docs/voice-relay.md` sends the captain to `fm-voice-relay.py --self-test
<clip.pcm>` before they touch the laptop, and that is also what the direct column
of the latency table was measured with. Nothing ran it. Two cases now do, and
`relay-cost-table.txt` is the instrument driven both ways, six runs each:

`` `
| Path | First audio out, seconds (6 runs) | Median |
| --- | --- | --- |
| Direct from this desktop, no relay (--self-test) | 0.409 0.409 0.409 0.409 0.409 0.413 | 0.409 |
| Over the relay, real client and framing         | 0.409 0.409 0.409 0.414 0.416 0.420 | 0.411 |
`` `

The absolute numbers are the stand-in's fixed 0.400 s think time, not Nova Sonic.
What is real is the shape - a spread, measured from the captain's talk end - and
the difference between the rows, which is framing plus the extra process hop:
about 3 ms with no network and no real session setup between the two ends. The
1.2 to 1.5 second figures in the docs need the real endpoint in `eu-north-1` and
still cannot be reproduced from this host.

## Reproducing

`` `
REPO=<firstmate checkout> bash demo/run-demo.sh <outdir> <relay path> clean-end,status 2
`` `

`demo/fakesdk/aws_sdk_bedrock_runtime/__init__.py` is lifted verbatim out of
`tests/fm-voice-relay.test.sh`, so the demo and the suite drive the same stand-in.
`prefix-relay/` and `prefix-client/` are shadow trees whose only difference from
the checkout is the one pre-fix file each.
Evidence: Captain's transcript AFTER the fix: the model finishes with the session mid key press, the next talk key still gets an answer out of the records

client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s client: the relay ended the session you: how is the fleet doing right now assistant: Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two.

client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s
client: the relay ended the session
  you: how is the fleet doing right now
  assistant: Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two.
Evidence: Captain's transcript BEFORE the fix (pre-fix relay, same scenario): the relay is gone and the second question is never asked

client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s client: the relay ended the session (1 turn taken, 1 model session opened, client exit 1)

client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s
client: the relay ended the session
Evidence: The two spoken turns: a status answer from the records, then real work handed over with the note id the queue gave it

client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s you: how is the fleet doing right now assistant: Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two. you: take the flaky sign-in test on alpha and open a pull request for it assistant: I am not the first mate, so I am handing that to it. handed to the first mate: take the flaky sign-in test on alpha and open a pull request for it assistant: That is queued with the first mate as 1787355719-RWCPAm. I have not done any of it myself.

client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s
  you: how is the fleet doing right now
  assistant: Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two.
  you: take the flaky sign-in test on alpha and open a pull request for it
  assistant: I am not the first mate, so I am handing that to it.
  handed to the first mate: take the flaky sign-in test on alpha and open a pull request for it
  assistant: That is queued with the first mate as 1787355719-RWCPAm. I have not done any of it myself.
Evidence: The note and the single wake the handover actually wrote to firstmate's own queue

state/inbox/1787355719-RWCPAm.note id=1787355719-RWCPAm at=2026-08-21T23:41:59Z source=text -- take the flaky sign-in test on alpha and open a pull request for it state/.wake-queue 1787355719 1 check inbox:1787355719-RWCPAm check: captain inbox note 1787355719-RWCPAm - take the flaky sign-in test on alpha and open a pull request for it

id=1787355719-RWCPAm
at=2026-08-21T23:41:59Z
source=text
--
take the flaky sign-in test on alpha and open a pull request for it
Evidence: Pre-fix client: the relay survives but the replacement session hears only the talk-end padding

model sessions: turn 2 audio_bytes_in = 12800 of a 76800 byte question Exeption in thread Thread-2 (_sender): ValueError: write to closed file (the captain's whole question arrived with no turn open and was dropped)

client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s
client: the relay ended the session
  you: how is the fleet doing right now
  assistant: Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two.
Exception in thread Thread-2 (_sender):
Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.14.7/lib/python3.14/threading.py", line 1082, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.14.7/lib/python3.14/threading.py", line 1024, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/no-mistakes-evidence/01M0JSJBAA3G54NKRYJSW9XKF4/demo/session-c2-prefix-client/laptop/fm-voice-client.py", line 543, in _sender
    self.uplink.send(frame.TALK_END)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/tmp/no-mistakes-evidence/01M0JSJBAA3G54NKRYJSW9XKF4/demo/session-c2-prefix-client/laptop/fm-voice-client.py", line 179, in send
    self._writer.send(kind, payload)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/tmp/no-mistakes-evidence/01M0JSJBAA3G54NKRYJSW9XKF4/demo/session-c2-prefix-client/laptop/fm_voice_frame.py", line 148, in send
    self._stream.write(encode(kind, payload))
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
ValueError: write to closed file
Evidence: The desktop side of the recovery: session 1 ended after 9,600 of 76,800 bytes and said nothing; session 2 heard the whole question and answered

{"turn": 1, "kind": "clean-end", "ended_early": true, "audio_bytes_in": 9600, "said": [], "reply_audio_bytes": 0} {"turn": 2, "kind": "status", "ended_early": false, "audio_bytes_in": 76800, "said": ["Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two."], "reply_audio_bytes": 19200}

{"turn": 1, "turn_kind": "clean-end", "model_id": "amazon.nova-2-sonic-v1:0", "endpoint": "https://bedrock-runtime.eu-north-1.amazonaws.com", "region": "eu-north-1", "credential_key_id": "AKIADESKTOPONLYEXAMPLE", "tool_names_offered": ["get_fleet_status", "hand_over_to_firstmate"], "audio_bytes_in": 9600, "tool_calls": [], "heard": "", "said": [], "reply_audio_bytes": 0, "ended_early": true}
{"turn": 2, "turn_kind": "status", "model_id": "amazon.nova-2-sonic-v1:0", "endpoint": "https://bedrock-runtime.eu-north-1.amazonaws.com", "region": "eu-north-1", "credential_key_id": "AKIADESKTOPONLYEXAMPLE", "tool_names_offered": ["get_fleet_status", "hand_over_to_firstmate"], "audio_bytes_in": 76800, "tool_calls": [{"name": "get_fleet_status", "arguments": {}, "result": {"scope": "full", "basis": "Last recorded event, which is history and not a live check.", "workers_on_deck": 1, "worker_states": {"working": 1}, "in_flight": 2, "queued": 1, "awaiting_captain": 2, "open_pull_requests": 1, "captain_notes_waiting": 0, "in_flight_detail": [{"id": "alpha-one", "title": "Fix the sign-in redirect", "state": "working"}, {"id": "beta-two", "title": "Decide the storage shape", "state": "not started"}], "awaiting_captain_detail": [{"id": "beta-two", "title": "Decide the storage shape"}, {"id": "delta-four", "title": "Add the retry"}], "pull_request_detail": [{"id": "alpha-one", "url": "https://github.com/example/alpha/pull/7"}], "withheld_as_confidential": 0, "detail": "The lists name at most 5 items each; the counts above are the whole picture. Give the captain the counts and a couple of names, not every row."}}], "heard": "how is the fleet doing right now", "said": ["Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two."], "reply_audio_bytes": 19200}
Evidence: The measuring instrument driven both ways, six runs each, reported as a spread

| Path | First audio out, seconds (6 runs) | Median | | --- | --- | --- | | Direct from this desktop, no relay (--self-test) | 0.409 0.409 0.409 0.409 0.409 0.413 | 0.409 | | Over the relay, real client and framing | 0.409 0.409 0.409 0.414 0.416 0.420 | 0.411 | relay cost at the median: 0.003 s model stand-in think time: 0.400 s (so the direct row is instrument overhead only) The absolute numbers are the stand-in, not Nova Sonic; the DIFFERENCE is real.

The measurement instrument, run against an offline model stand-in that
thinks for a fixed 0.400 s. The absolute numbers are the stand-in, not
Nova Sonic; the DIFFERENCE between the rows is real - it is framing, the
extra process hop and the per-turn session reconnect.

| Path | First audio out, seconds (6 runs) | Median |
| --- | --- | --- |
| Direct from this desktop, no relay (--self-test) | 0.409 0.409 0.409 0.409 0.409 0.413 | 0.409 |
| Over the relay, real client and framing | 0.409 0.409 0.409 0.414 0.416 0.420 | 0.411 |

relay cost at the median: 0.003 s
model stand-in think time: 0.400 s (so the direct row is instrument overhead only)
Evidence: The documented desktop check, run as docs/voice-relay.md tells the captain to run it

$ fm-voice-relay.py --self-test clip.pcm {"mode": "self-test", "model": "amazon.nova-2-sonic-v1:0", "region": "eu-north-1", "read_scope": "full", "input_seconds": 2.0, "tail_ms": 400, "connect_seconds": 0.0, "tool_calls": 1, "tool_names": ["get_fleet_status"], "tool_use_s": 0.404, "first_audio_s": 0.419, "reply_end_s": 0.46, "reply_audio_seconds": 0.4, "answered": true, "timed_out": false, "relay_error": null, "clock_unusable": [], "heard": "how is the fleet doing right now", "said": "Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two."}

{"mode": "self-test", "model": "amazon.nova-2-sonic-v1:0", "region": "eu-north-1", "read_scope": "full", "input_seconds": 2.0, "tail_ms": 400, "connect_seconds": 0.0, "tool_calls": 1, "tool_names": ["get_fleet_status"], "tool_use_s": 0.404, "first_audio_s": 0.419, "reply_end_s": 0.46, "reply_audio_seconds": 0.4, "answered": true, "timed_out": false, "relay_error": null, "clock_unusable": [], "heard": "how is the fleet doing right now", "said": "Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two.", "notices": []}
Evidence: Mutation: restore the break on a clean session end — the new regression goes red

session ended: the relay stopped serving when the model ended its session: 1 turn(s) taken not ok - a model session ending did not leave the relay serving (36 other cases still ok)

ok - wire format round trips and rejects a desynchronised stream
ok - the relay refuses a desynchronised uplink header instead of waiting for its payload
ok - the relay reads whose account to use from this home and refuses to guess
ok - an unconfigured home can still read how to configure the relay
ok - the model-backed subcommands refuse by name while note keeps working
ok - fm-inbox.sh --help prints its whole header, privacy paragraph included
ok - the relay and the reader agree on the tool names and the handover argument
ok - credentials are resolved once per relay, refreshed before expiry, off the event loop
ok - a turn the model refuses is announced and costs one turn, not the relay
ok - audio that arrives with no turn open is dropped, not turned into a turn
ok - a failure inside the model reader costs one turn, not every later one
ok - a reader failure is named to the captain, a clean end and a close are not
usage: fm-voice-client.py [-h] [--host HOST] [--local] [--relay RELAY]
                          [--relay-python RELAY_PYTHON]
                          [--relay-arg RELAY_ARG]
                          [--listen {push-to-talk,open-mic}] [--runs RUNS]
                          [--talk-seconds TALK_SECONDS] [--in-file IN_FILE]
                          [--out-file OUT_FILE] [--input-device INPUT_DEVICE]
                          [--output-device OUTPUT_DEVICE] [--timeout TIMEOUT]
                          [--wait-for-reply | --no-wait-for-reply]
                          [--gap-seconds GAP_SECONDS]
                          [--audio-idle AUDIO_IDLE] [--verbose]
fm-voice-client.py: error: say where the relay is: --relay <path to fm-voice-relay.py on the desktop>, or set FM_VOICE_RELAY
usage: fm-voice-client.py [-h] [--host HOST] [--local] [--relay RELAY]
                          [--relay-python RELAY_PYTHON]
                          [--relay-arg RELAY_ARG]
                          [--listen {push-to-talk,open-mic}] [--runs RUNS]
                          [--talk-seconds TALK_SECONDS] [--in-file IN_FILE]
                          [--out-file OUT_FILE] [--input-device INPUT_DEVICE]
                          [--output-device OUTPUT_DEVICE] [--timeout TIMEOUT]
                          [--wait-for-reply | --no-wait-for-reply]
                          [--gap-seconds GAP_SECONDS]
                          [--audio-idle AUDIO_IDLE] [--verbose]
fm-voice-client.py: error: --listen open-mic is not built yet: it needs end-of-speech detection to know when a turn ended, which lands with session continuity across turns, so it would stream forever and never end a turn. Use the default --listen push-to-talk.
client: discarded 15 bytes your login shell printed before the relay started: b'You have mail.\n'
ok - the laptop client builds the right remote command and survives a chatty login shell
ok - the client runs from a laptop holding only the two files the guide names
ok - --listen open-mic refuses at startup, before it opens anything
ok - the narrow scope answers how much is waiting without saying what it is
ok - the wide scope names open work and reports state without quoting event lines
ok - an absent read-scope setting means the narrowest answer, not the widest
ok - a home widens its own read scope by writing the setting
ok - finished work and note bodies never reach a spoken answer at any scope
ok - excluding a note body does not distort the counts
ok - a denied item becomes a withheld count without hiding that work exists
ok - the deny list matches regardless of case
ok - an item denied in more than one list is counted as withheld once
ok - one deny decision per item covers every list that item could appear in
ok - the state verb is a closed vocabulary, so free text cannot ride out on it
ok - the backlog and the state directory always come from the same home
ok - a finished task's pull request is neither counted nor named
ok - a deny substring on an open title removes its pull request and says so
ok - an unknown read scope refuses instead of widening
ok - the configured read scope is honoured
ok - handover queues the request for firstmate and wakes it exactly once
ok - the reader and the queue resolve the state directory the same way
ok - an empty request is refused rather than queued as a blank note
ok - a home with no records answers nothing rather than failing
ok - a spoken turn goes out and comes back: the records answer, firstmate gets the work
session ended: the relay stopped serving when the model ended its session: 1 turn(s) taken, 'client: relay ready, amazon.nova-2-sonic-v1:0 in eu-north-1, read scope full, connected in 0.0s\nclient: the relay ended the session\n'
not ok - a model session ending did not leave the relay serving
Evidence: Mutation: talk start written from the turn thread again — the client half goes red

session ended: the replacement session heard 12800 bytes of a 76800 byte question not ok - a model session ending did not leave the relay serving (36 other cases still ok)

ok - wire format round trips and rejects a desynchronised stream
ok - the relay refuses a desynchronised uplink header instead of waiting for its payload
ok - the relay reads whose account to use from this home and refuses to guess
ok - an unconfigured home can still read how to configure the relay
ok - the model-backed subcommands refuse by name while note keeps working
ok - fm-inbox.sh --help prints its whole header, privacy paragraph included
ok - the relay and the reader agree on the tool names and the handover argument
ok - credentials are resolved once per relay, refreshed before expiry, off the event loop
ok - a turn the model refuses is announced and costs one turn, not the relay
ok - audio that arrives with no turn open is dropped, not turned into a turn
ok - a failure inside the model reader costs one turn, not every later one
ok - a reader failure is named to the captain, a clean end and a close are not
usage: fm-voice-client.py [-h] [--host HOST] [--local] [--relay RELAY]
                          [--relay-python RELAY_PYTHON]
                          [--relay-arg RELAY_ARG]
                          [--listen {push-to-talk,open-mic}] [--runs RUNS]
                          [--talk-seconds TALK_SECONDS] [--in-file IN_FILE]
                          [--out-file OUT_FILE] [--input-device INPUT_DEVICE]
                          [--output-device OUTPUT_DEVICE] [--timeout TIMEOUT]
                          [--wait-for-reply | --no-wait-for-reply]
                          [--gap-seconds GAP_SECONDS]
                          [--audio-idle AUDIO_IDLE] [--verbose]
fm-voice-client.py: error: say where the relay is: --relay <path to fm-voice-relay.py on the desktop>, or set FM_VOICE_RELAY
usage: fm-voice-client.py [-h] [--host HOST] [--local] [--relay RELAY]
                          [--relay-python RELAY_PYTHON]
                          [--relay-arg RELAY_ARG]
                          [--listen {push-to-talk,open-mic}] [--runs RUNS]
                          [--talk-seconds TALK_SECONDS] [--in-file IN_FILE]
                          [--out-file OUT_FILE] [--input-device INPUT_DEVICE]
                          [--output-device OUTPUT_DEVICE] [--timeout TIMEOUT]
                          [--wait-for-reply | --no-wait-for-reply]
                          [--gap-seconds GAP_SECONDS]
                          [--audio-idle AUDIO_IDLE] [--verbose]
fm-voice-client.py: error: --listen open-mic is not built yet: it needs end-of-speech detection to know when a turn ended, which lands with session continuity across turns, so it would stream forever and never end a turn. Use the default --listen push-to-talk.
client: discarded 15 bytes your login shell printed before the relay started: b'You have mail.\n'
ok - the laptop client builds the right remote command and survives a chatty login shell
ok - the client runs from a laptop holding only the two files the guide names
ok - --listen open-mic refuses at startup, before it opens anything
ok - the narrow scope answers how much is waiting without saying what it is
ok - the wide scope names open work and reports state without quoting event lines
ok - an absent read-scope setting means the narrowest answer, not the widest
ok - a home widens its own read scope by writing the setting
ok - finished work and note bodies never reach a spoken answer at any scope
ok - excluding a note body does not distort the counts
ok - a denied item becomes a withheld count without hiding that work exists
ok - the deny list matches regardless of case
ok - an item denied in more than one list is counted as withheld once
ok - one deny decision per item covers every list that item could appear in
ok - the state verb is a closed vocabulary, so free text cannot ride out on it
ok - the backlog and the state directory always come from the same home
ok - a finished task's pull request is neither counted nor named
ok - a deny substring on an open title removes its pull request and says so
ok - an unknown read scope refuses instead of widening
ok - the configured read scope is honoured
ok - handover queues the request for firstmate and wakes it exactly once
ok - the reader and the queue resolve the state directory the same way
ok - an empty request is refused rather than queued as a blank note
ok - a home with no records answers nothing rather than failing
ok - a spoken turn goes out and comes back: the records answer, firstmate gets the work
session ended: the replacement session heard 12800 bytes of a 76800 byte question
not ok - a model session ending did not leave the relay serving
Evidence: Mutations proving the two new self-test cases are not vacuous

guard removed: not ok - the guard must say why the timings cannot be used clock from clip start: self-test: first audio at 2.409 is not measured from the talk end clock on a missing mark: self-test: no tool_use_s figure

ok - wire format round trips and rejects a desynchronised stream
ok - the relay refuses a desynchronised uplink header instead of waiting for its payload
ok - the relay reads whose account to use from this home and refuses to guess
ok - an unconfigured home can still read how to configure the relay
ok - the model-backed subcommands refuse by name while note keeps working
ok - fm-inbox.sh --help prints its whole header, privacy paragraph included
ok - the relay and the reader agree on the tool names and the handover argument
ok - credentials are resolved once per relay, refreshed before expiry, off the event loop
ok - a turn the model refuses is announced and costs one turn, not the relay
ok - audio that arrives with no turn open is dropped, not turned into a turn
ok - a failure inside the model reader costs one turn, not every later one
ok - a reader failure is named to the captain, a clean end and a close are not
usage: fm-voice-client.py [-h] [--host HOST] [--local] [--relay RELAY]
                          [--relay-python RELAY_PYTHON]
                          [--relay-arg RELAY_ARG]
                          [--listen {push-to-talk,open-mic}] [--runs RUNS]
                          [--talk-seconds TALK_SECONDS] [--in-file IN_FILE]
                          [--out-file OUT_FILE] [--input-device INPUT_DEVICE]
                          [--output-device OUTPUT_DEVICE] [--timeout TIMEOUT]
                          [--wait-for-reply | --no-wait-for-reply]
                          [--gap-seconds GAP_SECONDS]
                          [--audio-idle AUDIO_IDLE] [--verbose]
fm-voice-client.py: error: say where the relay is: --relay <path to fm-voice-relay.py on the desktop>, or set FM_VOICE_RELAY
usage: fm-voice-client.py [-h] [--host HOST] [--local] [--relay RELAY]
                          [--relay-python RELAY_PYTHON]
                          [--relay-arg RELAY_ARG]
                          [--listen {push-to-talk,open-mic}] [--runs RUNS]
                          [--talk-seconds TALK_SECONDS] [--in-file IN_FILE]
                          [--out-file OUT_FILE] [--input-device INPUT_DEVICE]
                          [--output-device OUTPUT_DEVICE] [--timeout TIMEOUT]
                          [--wait-for-reply | --no-wait-for-reply]
                          [--gap-seconds GAP_SECONDS]
                          [--audio-idle AUDIO_IDLE] [--verbose]
fm-voice-client.py: error: --listen open-mic is not built yet: it needs end-of-speech detection to know when a turn ended, which lands with session continuity across turns, so it would stream forever and never end a turn. Use the default --listen push-to-talk.
client: discarded 15 bytes your login shell printed before the relay started: b'You have mail.\n'
ok - the laptop client builds the right remote command and survives a chatty login shell
ok - the client runs from a laptop holding only the two files the guide names
ok - --listen open-mic refuses at startup, before it opens anything
ok - the narrow scope answers how much is waiting without saying what it is
ok - the wide scope names open work and reports state without quoting event lines
ok - an absent read-scope setting means the narrowest answer, not the widest
ok - a home widens its own read scope by writing the setting
ok - finished work and note bodies never reach a spoken answer at any scope
ok - excluding a note body does not distort the counts
ok - a denied item becomes a withheld count without hiding that work exists
ok - the deny list matches regardless of case
ok - an item denied in more than one list is counted as withheld once
ok - one deny decision per item covers every list that item could appear in
ok - the state verb is a closed vocabulary, so free text cannot ride out on it
ok - the backlog and the state directory always come from the same home
ok - a finished task's pull request is neither counted nor named
ok - a deny substring on an open title removes its pull request and says so
ok - an unknown read scope refuses instead of widening
ok - the configured read scope is honoured
ok - handover queues the request for firstmate and wakes it exactly once
ok - the reader and the queue resolve the state directory the same way
ok - an empty request is refused rather than queued as a blank note
ok - a home with no records answers nothing rather than failing
ok - a spoken turn goes out and comes back: the records answer, firstmate gets the work
ok - a model session that ends mid-conversation costs one turn, not the relay
self-test: first audio at 2.409 is not measured from the talk end -- {'mode': 'self-test', 'model': 'amazon.nova-2-sonic-v1:0', 'region': 'eu-north-1', 'read_scope': 'full', 'input_seconds': 2.0, 'tail_ms': 400, 'connect_seconds': 0.0, 'tool_calls': 1, 'tool_names': ['get_fleet_status'], 'tool_use_s': 2.401, 'first_audio_s': 2.409, 'reply_end_s': 2.45, 'reply_audio_seconds': 0.4, 'answered': True, 'timed_out': False, 'relay_error': None, 'clock_unusable': [], 'heard': 'how is the fleet doing right now', 'said': 'Right now, 2 in flight, 2 waiting on you, 1 open pull requests. The ones moving are alpha-one and beta-two. 1 note is queued for the first mate.', 'notices': []}
not ok - the desktop check did not report a usable measurement
- Evidence: The reply audio the replacement session sent, as the client wrote it, playable (local file: /tmp/no-mistakes-evidence/01M0JSJBAA3G54NKRYJSW9XKF4/round2-recovered-turn-reply.wav)
Evidence: Full targeted suite run, 39 cases

ok - a spoken turn goes out and comes back: the records answer, firstmate gets the work ok - a model session that ends mid-conversation costs one turn, not the relay ok - the desktop's own check answers from the records and times it from the talk end ok - a reply that arrives before the end of the clip is named as an unusable clock all voice relay cases passed

ok - wire format round trips and rejects a desynchronised stream
ok - the relay refuses a desynchronised uplink header instead of waiting for its payload
ok - the relay reads whose account to use from this home and refuses to guess
ok - an unconfigured home can still read how to configure the relay
ok - the model-backed subcommands refuse by name while note keeps working
ok - fm-inbox.sh --help prints its whole header, privacy paragraph included
ok - the relay and the reader agree on the tool names and the handover argument
ok - credentials are resolved once per relay, refreshed before expiry, off the event loop
ok - a turn the model refuses is announced and costs one turn, not the relay
ok - audio that arrives with no turn open is dropped, not turned into a turn
ok - a failure inside the model reader costs one turn, not every later one
ok - a reader failure is named to the captain, a clean end and a close are not
usage: fm-voice-client.py [-h] [--host HOST] [--local] [--relay RELAY]
                          [--relay-python RELAY_PYTHON]
                          [--relay-arg RELAY_ARG]
                          [--listen {push-to-talk,open-mic}] [--runs RUNS]
                          [--talk-seconds TALK_SECONDS] [--in-file IN_FILE]
                          [--out-file OUT_FILE] [--input-device INPUT_DEVICE]
                          [--output-device OUTPUT_DEVICE] [--timeout TIMEOUT]
                          [--wait-for-reply | --no-wait-for-reply]
                          [--gap-seconds GAP_SECONDS]
                          [--audio-idle AUDIO_IDLE] [--verbose]
fm-voice-client.py: error: say where the relay is: --relay <path to fm-voice-relay.py on the desktop>, or set FM_VOICE_RELAY
usage: fm-voice-client.py [-h] [--host HOST] [--local] [--relay RELAY]
                          [--relay-python RELAY_PYTHON]
                          [--relay-arg RELAY_ARG]
                          [--listen {push-to-talk,open-mic}] [--runs RUNS]
                          [--talk-seconds TALK_SECONDS] [--in-file IN_FILE]
                          [--out-file OUT_FILE] [--input-device INPUT_DEVICE]
                          [--output-device OUTPUT_DEVICE] [--timeout TIMEOUT]
                          [--wait-for-reply | --no-wait-for-reply]
                          [--gap-seconds GAP_SECONDS]
                          [--audio-idle AUDIO_IDLE] [--verbose]
fm-voice-client.py: error: --listen open-mic is not built yet: it needs end-of-speech detection to know when a turn ended, which lands with session continuity across turns, so it would stream forever and never end a turn. Use the default --listen push-to-talk.
client: discarded 15 bytes your login shell printed before the relay started: b'You have mail.\n'
ok - the laptop client builds the right remote command and survives a chatty login shell
ok - the client runs from a laptop holding only the two files the guide names
ok - --listen open-mic refuses at startup, before it opens anything
ok - the narrow scope answers how much is waiting without saying what it is
ok - the wide scope names open work and reports state without quoting event lines
ok - an absent read-scope setting means the narrowest answer, not the widest
ok - a home widens its own read scope by writing the setting
ok - finished work and note bodies never reach a spoken answer at any scope
ok - excluding a note body does not distort the counts
ok - a denied item becomes a withheld count without hiding that work exists
ok - the deny list matches regardless of case
ok - an item denied in more than one list is counted as withheld once
ok - one deny decision per item covers every list that item could appear in
ok - the state verb is a closed vocabulary, so free text cannot ride out on it
ok - the backlog and the state directory always come from the same home
ok - a finished task's pull request is neither counted nor named
ok - a deny substring on an open title removes its pull request and says so
ok - an unknown read scope refuses instead of widening
ok - the configured read scope is honoured
ok - handover queues the request for firstmate and wakes it exactly once
ok - the reader and the queue resolve the state directory the same way
ok - an empty request is refused rather than queued as a blank note
ok - a home with no records answers nothing rather than failing
ok - a spoken turn goes out and comes back: the records answer, firstmate gets the work
ok - a model session that ends mid-conversation costs one turn, not the relay
ok - the desktop's own check answers from the records and times it from the talk end
ok - a reply that arrives before the end of the clip is named as an unusable clock
all voice relay cases passed
- Outcome: 🔧 2 issues found → auto-fixed ✅ across 2 runs (58m27s)

Pipeline

Updates from git push no-mistakes

... (10 earlier update rounds omitted to keep the PR body within GitHub's 65536-char limit; full history is in the run log.)

⚠️ **Review** - 3 infos

🔧 Fix: survive reader failures, release devices, fix claims
4 issues (1 warning, 3 infos) still open:

  • ⚠️ bin/fm-voice-relay.py:733 - _read_model's new finally releases ended and turn_done but tells nobody, so a reader-side failure is the one turn failure that reaches neither the client nor the run record. Verified by probe (stubbed bidirectional stream, _send raising while answering a tool call, a turn open with talk_end stamped): the reader ends, ended and turn_done are set, session.failed stays False, and the only frame the Downlink ever saw was the tool_use MARK, with notices == []. Two consequences. In --serve, the client is waiting on reply_done, which only a reply_end MARK or a notice sets (bin/fm-voice-client.py:552-572), so the captain gets the whole --timeout (30 s by default) of nothing and then a record with answered: false and relay_error: null - the field whose own comment at bin/fm-voice-client.py:632-634 says it exists precisely so a results file that only says answered: false cannot invite averaging an infrastructure failure into a latency figure. In --self-test, the same failure now prints answered: false with timed_out: false and no cause at all, where before this round it at least tripped the turn timeout and said so. The sibling uplink failure is named within milliseconds (turn-failed, line 928-930) and the client already handles that notice by ending the turn and recording the reason, so the fix is to name the reader's failure from the same place and carry it into the self-test record. While there, the new docstring says "a turn waiting on turn_done, and a serve loop watching ended, are how the relay recovers": nothing in serve ever awaits turn_done, only --self-test does.
  • ℹ️ bin/fm-voice-client.py:423 - The except Exception that becomes DeviceError wraps the file-backed playback and capture as well as the real devices, so a bad --in-file or --out-file is now reported as a device failure whose advice names the flag that just failed. Verified by probe with subprocess.Popen and sync_magic stubbed: --in-file /tmp/definitely-missing.pcm raises DeviceError: could not open the audio devices (FileNotFoundError: [Errno 2] No such file or directory: &#39;/tmp/definitely-missing.pcm&#39;). Name another device with --input-device or --output-device, or run without them using --in-file and --out-file, and an --out-file under a missing directory produces the same sentence. Before this round both were plain OSErrors that main printed verbatim, which named the actual path. This is the file path rather than the device path: it is what every figure in docs/voice-relay.md was measured with and what the guide tells the captain to use for --runs 5 &gt; runs.jsonl, so it is the shape most likely to be hit while the device paths stay unverified. Wrap only the SpeakerPlayback and MicCapture constructions in DeviceError and let FilePlayback/FileCapture keep raising OSError.
  • ℹ️ bin/fm_voice_records.py:420 - open_pull_requests is len(with_pr) computed before the deny decision at lines 453-464, so a denied open item is still counted while its row is gone, and the new test pins that as the wanted outcome (&#39;&#34;open_pull_requests&#34;: 1&#39; with the only open pull request denied, tests/fm-voice-relay.test.sh:1876). The round-8 instruction asked for the opposite: "remove that task's row from pull_request_detail, drop open_pull_requests accordingly, and increment withheld_as_confidential". The implemented behaviour is the more internally consistent of the two, because every other count in the answer is pre-deny (in_flight at line 418, queued, awaiting_captain) and two earlier accepted cases pin exactly this for this field (tests/fm-voice-relay.test.sh:1612 and :1685), so dropping the count would have contradicted them. Raising it rather than changing it: which behaviour the captain wants is a product call about what a spoken answer says, and a deviation from an explicit instruction should be visible rather than silent.
  • ℹ️ bin/fm-voice-relay.py:963 - serve still ends the relay whenever a session reports ended without failed, which is the state a dropped model stream leaves behind, so a single stream drop mid-utterance can cost the whole session rather than one turn. Verified by probe: after the reader dies, session.failed is False, and driving one more frame of that same turn through handle_uplink_frame (a TALK_END, or a stray AUDIO once the block is already closed, which audio() drops without raising) returns normally, at which point session.ended.is_set() and not session.failed is True, so serve sends session-ended, breaks, and the client stops on the BYE. It only bites when that frame does not itself raise: an AUDIO chunk pushed into a broken input half raises and is correctly converted into turn-failed, which is why the common shape survives. The branch predates the per-turn reconnect and its comment reasons only about the failed case; with renew rebuilding on every TALK_START, an ended-but-not-failed session could be replaced on the next talk key instead of ending the run, which is the property rounds 3 and 8 were spent establishing. Whether a model-initiated session end should still end the relay is the author's call, so it is flagged rather than changed.

🔧 Fix: name reader failures, split file and device refusals
3 infos still open:

  • ℹ️ tests/fm-voice-relay.test.sh:12 - The suite header still says "The captain granted the voice agent full read access to their records, so the reader defaults to the wider scope." That was true before the genericisation round and is now false: SCOPE_DEFAULT = SCOPE_COUNTS (bin/fm_voice_records.py:104), and this same file asserts the opposite 1650 lines further down ("an unconfigured home should get the narrow scope", line 1662). This file is named in docs/voice-relay.md:160 and in the Owners table as the executable owner of the confidentiality boundary, so its header is where someone auditing "what does an unconfigured install send to a model in another region?" will look first, and it currently answers full. Rewrite those two lines to say what the code does: the default is the narrow scope, the captain widens their own home by writing full into config/voice-read-scope, and what keeps the wide setting safe is the structural exclusion described in the sentence that follows. Comment only, no behaviour change.
  • ℹ️ bin/fm_voice_frame.py:124 - Reader's docstring promises "A stream that ends part way through a frame raises FrameError, because a truncated frame is a real fault and silently treating it as end of input would hide a dropped connection" (lines 104-107), but that only holds for a truncated payload. _exact returns None on ANY short read, including a partial 5 byte header, and read() treats head is None as a clean close. Verified by probe against the real module: Reader(BytesIO(encode(AUDIO, b&#39;1234&#39;)[:3])).read() returns None, while cutting the payload instead raises FrameError: stream ended inside a 4 byte payload. The suite pins only the payload case (line 124-128), so the gap is unguarded. Consequence on the laptop: bin/fm-voice-client.py:557 breaks on None with no message, where a FrameError would have printed "client: connection lost: ...", so a relay killed mid-header produces a turn record with answered: false and relay_error: null and no line saying why. That is the exact silent shape the last two fix rounds were spent eliminating. Make _exact distinguish "nothing read at all" from "a short read", and raise FrameError for the latter in both the header and the payload path.
  • ℹ️ bin/fm-voice-client.py:623 - take_turn sends TALK_START directly on the uplink with no guard, and run() checks self.closed BEFORE _let_reply_finish (lines 801-804), not after. So a relay that dies during the inter-turn wait, which is up to the reply's own spoken duration plus --gap-seconds, is not noticed: the loop returns to take_turn, self.uplink.send(frame.TALK_START) writes to a pipe whose read end is gone, and BrokenPipeError propagates. main wraps client.run() in except KeyboardInterrupt only (line 897), so it escapes as a raw traceback and exit 1 instead of the one-line refusal every other failure in this file gives, and the remaining runs produce no records. The _sender thread already guards its own writes for this reason (line 547). It is reachable in the documented measurement flow, --runs 5 &gt; runs.jsonl per docs/voice-relay.md:138; a single-run session is unaffected because there is no second turn. Either re-check self.closed at the top of take_turn and stop with a named message, or catch BrokenPipeError/OSError around the TALK_START send and report it the way a lost connection is reported at line 555.
🔧 **Test** - 2 issues found → auto-fixed ✅
  • ⚠️ docs/voice-relay.md:45 - The headline measurement in docs/voice-relay.md (1.229-1.516 s over the relay, 1.147-1.317 s direct, on amazon.nova-2-sonic-v1:0 in eu-north-1) cannot be reproduced or checked from this host: there is no ~/.fm-voice-venv, no aws-sdk-bedrock-runtime, and no credential for a Bedrock region. I verified the measuring instrument instead - the clock starts at the captain's talk end, the marks are ordered, and a six-run spread is what comes out - but the absolute numbers that replace the 1.5 to 2.5 second estimate rest on the author's own live run. Decide whether one live --self-test pass against the real endpoint is required before this merges.
  • ⚠️ bin/fm-voice-client.py:318 - The laptop microphone capture and speaker playback paths have still never been executed, here or by the author, because no machine in reach has an audio device; MicCapture and SpeakerPlayback are written from the sounddevice interface alone. Everything around them - framing, transport, relay handshake, turn sequencing, reply audio, timing arithmetic - I exercised with --in-file and --out-file. The captain's first live run is therefore the first test of the two device classes, which is the part of "they talk to a voice agent on their laptop" that no evidence here covers.
  • bash tests/fm-voice-relay.test.sh - baseline before my change: all 36 cases pass
  • bash tests/fm-voice-relay.test.sh - after adding the new case: 37 cases pass, 16.3 s, no leftover /tmp/fm-voice-relay.* fixtures
  • New case a spoken turn goes out and comes back: the records answer, firstmate gets the work - real client -> ssh shim -> real relay --serve -> scripted Nova Sonic stand-in -> real reader -> real fm-inbox.sh, two turns (status, handover)
  • Mutation check: client clocks the turn from the start of speech instead of talk end -> new case fails with turn 1 reported first audio at 2.423s, which is not measured from the captain&#39;s talk end (caught by nothing else)
  • Mutation check: relay returns a fabricated {queued: true, note_id: pretend-1} instead of calling records.queue_request -> new case fails with no note on disk at .../inbox/pretend-1.note (caught by nothing else)
  • Mutation check: relay serves scope "counts" regardless of config/voice-read-scope -> new case fails with the spoken answer named no open work
  • Mutation check: relay stops sending the 400 ms talk-end padding -> caught by the existing tool-surface case and by the new case's audio_bytes_in == 16000*2*2 + 400*32 assertion
  • bash harness/run-evidence.sh - six spoken status turns over the relay, one status/handover/status session, six fm-voice-relay.py --self-test control runs, all 15 sessions answered
  • bin/fm-inbox.sh status and bin/fm-inbox.sh list on the fixture home after the handover - one note waiting carrying the captain's words, one check wake in state/.wake-queue
  • python3 bin/fm_voice_records.py status --home &lt;fixture&gt; --scope full - independent read, compared field by field against the tool result the relay served the model
  • fm-voice-client.py --listen open-mic from the laptop directory - refuses at startup with exit 2 and zero model sessions opened
  • python3 harness/report.py - spread table, strip-plot SVG, and byte-for-byte check that the reply audio the client wrote equals what the model sent (172800 and 86400 bytes, identical)
  • bash tests/fm-documentation-audiences.test.sh - the new docs/voice-relay.md surface is classified exactly once and its owner pointers resolve

🔧 Fix: survive model session end, order client turn frames
✅ Re-checked - no issues remain.

  • bash tests/fm-voice-relay.test.sh — 39 cases, all pass, 28s
  • bash demo/run-demo.sh session-a bin/fm-voice-relay.py status,handover 2 — manual end-to-end: captain transcript, per-turn timings, inbox note and wake queue on disk
  • bash demo/run-demo.sh session-b-fixed bin/fm-voice-relay.py clean-end,status 2 — the model ends its session 300 ms into a two second key press; relay keeps serving, next talk key answers from the records
  • bash demo/run-demo.sh session-c1-prefix-relay prefix-relay/bin/fm-voice-relay.py clean-end,status 2 — pre-fix relay (parent commit): 1 turn taken, second question never asked
  • bash demo/run-demo.sh session-c2-prefix-client ... clean-end,status 2 with REPO=prefix-client — pre-fix client: replacement session heard 12,800 of 76,800 bytes and the sender thread died on write to closed file
  • fm-voice-relay.py --self-test clip.pcm under the stand-in — the documented desktop check, run manually and then covered by a new suite case
  • fm-voice-relay.py --self-test ×6 vs client --runs 6 — the six-run spread both ways, the shape the docs table reports
  • mutation: restore the break on a clean session end → not ok - a model session ending did not leave the relay serving
  • mutation: self.uplink.send(frame.TALK_START) instead of self.up_q.put(START) → not ok, replacement session heard 12800 of 76800 bytes
  • mutation: early = [] (wrong-clock guard removed) → not ok - the guard must say why the timings cannot be used
  • mutation: self-test clock shifted to the clip's start → not ok, "first audio at 2.409 is not measured from the talk end"
  • mutation: self-test clock keyed on a nonexistent mark → not ok, "no tool_use_s figure"
  • new cases added to tests/fm-voice-relay.test.sh: "the desktop's own check answers from the records and times it from the talk end", "a reply that arrives before the end of the clip is named as an unusable clock"
🔧 **Document** - 2 issues found → auto-fixed (3) ✅
  • ℹ️ README.md:205 - README's Features list and docs/architecture.md still have no spoken-interface entry. I routed docs/voice-relay.md from README's Documentation index but deliberately did not add a product-feature bullet or an architecture section, because the laptop capture and playback paths are explicitly unverified (bin/fm-voice-client.py module docstring, docs/voice-relay.md "Setting up the laptop"), so a Features claim would promise a path nobody has run. Worth revisiting once a live run verifies the audio devices.
  • ℹ️ docs/voice-relay.md:39 - docs/voice-relay.md (classified operator-current) carries maintainer-verification-shaped evidence: dated six-run latency spreads, the wide-vs-counts byte and second figures, and the padding-floor runs. The repo has a maintainer-verification audience and a docs/verification/ home for exactly that. I left it in place because the user intent requires the measurement be reported as a spread and splitting it would create a new surface for one feature; propose it as a follow-up consolidation (operator page keeps the headline "about 1.2 to 1.5 s plus your round trip", docs/verification/ owns the runs) if that page grows further.

🔧 Fix: re-measure relay latency and correct its cause
1 info still open:

  • ℹ️ docs/voice-relay.md:274 - The Cost section's $0.00293 per exchange says it is "on the numbers above", and that cross-reference now points at the re-measured table, but the figure itself was derived from the first pass and I could not re-derive it: it needs the per-run token counts and session seconds, which the page does not carry and which the re-measurement report did not include. I left it as it stands because the drift is below the figure's own stated precision - the session is about 0.27 s shorter per exchange, which at the quoted $0.0101 per minute is about $0.00005, so "roughly a dollar for three hundred and forty questions" still holds and the old figure is the conservative side. Worth re-deriving from the new runs' token counts if the author has them.

🔧 Fix: correct measurement date and name the unmeasured SSH hop
1 info still open:

  • ℹ️ docs/voice-relay.md:48 - Line 48 credits the direct control with reproducing "the 1.164 second measurement in the earlier survey", and no such survey exists anywhere in the repository: 1.164 and the phrase "earlier survey" appear only on this line, so a reader who wants to check the control's calibration has nothing to open. That clause is the one remaining provenance pointer on this page that leads nowhere, and it is load-bearing, because it is the sole stated reason the direct column is usable as a control at all. I did not touch it: the instruction for this round was three enumerated edits and nothing else in this or any other file, and repairing it needs a fact I do not have, either the survey's location so the clause can become a link or the author's decision to drop the appeal and let the noise floor carry the calibration on its own.

🔧 Fix: describe the unpublished control measurement, fix list formatting
✅ Re-checked - no issues remain.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 127)
✅ **Push** - passed

✅ No issues found.

…cost

Step one of the spoken interface: the laptop captures and plays audio, this
desktop holds the model session, and no AWS credential leaves the desktop.

Measured, amazon.nova-2-sonic-v1:0 in eu-north-1, end of speech to first byte
of reply audio, 6 runs each, all answered, on a question that forces a records
read:

  relay path   1.229 1.379 1.428 1.447 1.481 1.516  median 1.438
  direct       1.147 1.179 1.203 1.237 1.244 1.317  median 1.220

The relay costs about 0.22s of the median. The direct figure reproduces the
earlier survey, which is what makes it a usable control. Excluded: the
captain's own ssh round trip, microphone capture, and speaker output. This
desktop has no microphone and no speaker, so every run used audio files.

Three pieces:

  bin/fm-voice-relay.py    holds the conversation on this host
  bin/fm_voice_records.py  what a spoken answer may read, and the handover
  bin/fm-voice-client.py   the laptop end; audio devices UNVERIFIED
  bin/fm_voice_frame.py    the wire format both machines share

Real work is handed to the existing bin/fm-inbox.sh rather than a second
queueing surface, and the agent says it is handing over rather than answering
as firstmate.

Read scope: Done history and free-form note bodies are never assembled at any
scope, so the wide default cannot reach the places commercial detail
accumulates. config/voice-read-scope narrows it to counts only, and
config/voice-read-deny excludes a named item in one line. The boundary is an
executable test that widening the reader fails.

Push to talk is the default because it is cheaper and the choice is still open;
--listen open-mic is the single flip.

Two traps worth knowing: a clip with no trailing silence is never answered, and
the end of a reply is contentEnd with stopReason END_TURN, not completionEnd.
A second user turn in one session is treated as barge-in unconditionally, and
an interrupted turn that calls a tool is lost, so the session reconnects per
turn and gives up conversational memory. That is the concrete thing step three
has to solve.
…aims

A failure while handling a model event, or while sending a tool result,
left the reader task dead with ended and turn_done clear, and close()
re-raised the stored failure on every await. One dropped stream became a
relay that could never build another session. The reader now reports the
session over in a finally whatever killed it, and close() absorbs the
task the same way it already absorbed its sends.

The laptop client releases what it already started when a later startup
step refuses, SystemExit from the handshake wait included, and names a
device refusal instead of leaking a raw PortAudio error. Whether it
releases correctly against a real device is still unverified here.

The records docstring claimed every reading was filtered to open ids.
Only the pull request count and list are; the worker count and the state
histogram cover every live runtime record, finished ids included,
because a meta file still on disk still needs tearing down.

The finished-work deny half of the suite asserted things that held with
the deny list absent. It is replaced by a deny on an open title, which
removes the row and says so while the count stays honest.
…sals

A failure inside the model reader released the waiting turn and told
nobody. The session was not marked spent, no notice reached the client,
and the client waits for a reply end or a notice, so the captain got
their whole timeout of silence and then a record saying the turn went
unanswered with nothing about why. Both ends of the relay now name a
failed turn through one function, once per turn, and --self-test carries
the cause in relay_error the way the client's own record does.

Two things that are not failures stay that way. A stream that simply
ends is the end of a session, which serve still reads on its own terms.
A stream that goes away because close() asked it to is an ordinary
renew, and announcing it would have put a failure notice in front of the
captain on every turn.

On the laptop end, the refusal that became a device error covered the
file-backed playback and capture too, so a mistyped --in-file was
reported as an audio device failure and the advice named the flag that
had just failed. The file ends now report the path and the flag that
chose it and stay an OSError; the device ends keep the device advice and
name the flag for that end. The device paths remain unrun here, so only
the file halves are covered by a test.