Round 24 handoff and evidence (documentation only)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
# Handoff for Cody, Round 24
|
||||
|
||||
From: Claude (implementation). Date: 2026-11-29 (UTC).
|
||||
|
||||
**Not reviewed.** Your Round 23 on `d65beeab77288049b801e4969ac9b68821833b23`: SHIP / SHIP FOR
|
||||
TRIAL. That commit **was** deployed and uploaded as 0.4.1 (Dan: "go"); record in
|
||||
`docs/evidence/device/2026-11-29.md`. The package hash matched yours.
|
||||
|
||||
| Item | Value |
|
||||
|---|---|
|
||||
| Branch | `cody/droplet-deploy` |
|
||||
| `main` | `f02715fb6487f4e2ff0adeccfaad2403e1724aa5` (unchanged) |
|
||||
| Code change | `9874e1bb5b38458a6bc55159362f39234746fb67` |
|
||||
| New head | the tip after this push (this file and evidence only on top of the code change) |
|
||||
|
||||
## 0. This goes beyond your Round 23 constraints, on Dan's instruction
|
||||
|
||||
Round 23 said not to add "ElevenLabs or another provider, credentials, automatic playback" under
|
||||
that verdict, and that issue #1 stays an investigation. This round adds an ElevenLabs adapter and
|
||||
playback of answers. It is a new change for a new verdict, not a claim under the old one. What
|
||||
authorises it:
|
||||
|
||||
1. The probe ran on Dan's phone (results below).
|
||||
2. I proposed a "Voice: on/off" entry on the opening menu, off at every launch, with the bridge
|
||||
calling ElevenLabs per agent, and asked whether to cap long answers. Dan: "yes on the voice
|
||||
menu entry, cap it".
|
||||
3. Shown the finished build and told a push starts a review round, Dan: "to cody".
|
||||
|
||||
No credential is in the repository. No key has been given to me or placed on the server. No
|
||||
native code. Nothing plays unless the user switched Voice on in that session.
|
||||
|
||||
## 1. What the sound check found
|
||||
|
||||
Dan, earbuds connected, verbatim in the evidence file: tone heard "in buds"; delayed tone "yes,
|
||||
in 20s"; "without touching phone: allowed"; "phone voice: not available in this page"; outputs
|
||||
"1. without names". Not stated: whether the phone was locked for the delayed tone, phone model,
|
||||
Android and Even app versions, whether the earbuds were worn or what Android had selected.
|
||||
|
||||
Consequences drawn in `docs/decisions/0006-spoken-answers.md`: the page can play and Android
|
||||
routes; the voice must be synthesised elsewhere; the page cannot know the route, hence a manual
|
||||
switch that is never remembered.
|
||||
|
||||
## 2. The change
|
||||
|
||||
Bridge:
|
||||
- `services/bridge/src/tts.ts`: `ElevenLabsTts` (`POST {base}/v1/text-to-speech/{voice}?output_format=mp3_44100_64`,
|
||||
`xi-api-key`, body `{text, model_id}`), written from the provider's documentation as fetched
|
||||
on 2026-11-29. **Never called against the real service.** A non-2xx body is read and discarded
|
||||
(it may quote the text). `speechText()` removes markup, fenced code and web addresses and cuts
|
||||
at a sentence end within the limit.
|
||||
- Config: `HERMEVEN_ELEVENLABS_API_KEY` (absent = off), `_MODEL` (default `eleven_flash_v2_5`),
|
||||
`_BASE_URL` (https unless loopback; exists so the tests can point at a fake),
|
||||
`HERMEVEN_AGENT_VOICE` / `HERMEVEN_AGENT_<ID>_VOICE`, `HERMEVEN_SPEECH_MAX_CHARS` (900),
|
||||
`HERMEVEN_SPEECH_PER_MINUTE` (6), `HERMEVEN_SPEECH_TIMEOUT_SECONDS` (20).
|
||||
- `GET /v1/speech`: `{available, agent_ids, max_chars}`. A new route rather than a new field on
|
||||
`/v1/device` or `/v1/agents` because those schemas are closed and the deployed 0.4.1 client
|
||||
would reject an added field.
|
||||
- `GET /v1/turns/{id}/speech`: `audio/mpeg`. Only the caller's own turn, only `succeeded` or
|
||||
`incomplete`, only if its agent has a voice; everything else is one indistinguishable 404.
|
||||
Per-device limiter counts new syntheses only; concurrent requests for one turn share one
|
||||
provider call; the last three clips are kept in memory (not on disk) so a retry is not paid
|
||||
for twice. Logs `speech.done` / `speech.failed`: ids, character count, byte count, duration,
|
||||
provider status. No text.
|
||||
|
||||
Client (0.5.0):
|
||||
- Reducer: `voiceOffered`, `voice`; menu entry `voice` is a switch that flips in place;
|
||||
`init` resets both, so it is off at every launch and after pairing.
|
||||
- Controller: `speaker` option (absent = nothing is asked or played). After a successful or
|
||||
partial answer, if Voice is on and the agent has a voice, fetch then play. Stopped by any
|
||||
dispatch that leaves `answer`, changes the request, or switches Voice off; the fetch is
|
||||
aborted too, and audio arriving after that is dropped. Idle exit is not scheduled while
|
||||
fetching or playing and restarts when it ends.
|
||||
- `ui/speaker.ts`: Web Audio `decodeAudioData` and a buffer source. **Not covered by any
|
||||
test; never run in a browser.** The tests use a fake `SpeakerPort`.
|
||||
- Phone page: one status row saying whether spoken answers are available, on, speaking.
|
||||
|
||||
## 3. A shutdown fault found on the way (also in what is deployed)
|
||||
|
||||
A test that abandoned a slow speech request hung in `bridge.close()`. Reproduced in isolation,
|
||||
and equally with `/v1/transcribe` (deployed since 0.4.0): once a handler finishes on a
|
||||
connection whose client aborted, the server still counts one open connection and
|
||||
`server.close()` never calls back. Closing while the handler is still running, or with no
|
||||
abort, returns at once. I did not find out why the connection stays open (the test client is
|
||||
Node's fetch; behind Caddy it may differ); I am reporting the observation, not a diagnosis.
|
||||
|
||||
Change: `forceCloseConnections: true`. To judge: shutdown no longer waits for in-flight
|
||||
requests. A turn being submitted at that instant is cut off and retried by the app with the same
|
||||
request id (deduplicated); polls are retried. On the droplet the alternative was systemd's
|
||||
`TimeoutStopSec=20` then SIGKILL; I have no evidence it ever happened there (both restarts in
|
||||
the evidence returned promptly), and previews may never have been requested by the device.
|
||||
Regression test: "closes promptly after an abandoned speech/transcribe request"; without the
|
||||
option both fail (observed before the change, as `HUNG` in a throwaway reproduction, not
|
||||
re-run as a formal control on the final tree).
|
||||
|
||||
## 4. Things to judge
|
||||
|
||||
- **Answers leave Dan's infrastructure when Voice is on** (security 3g). Questions do not.
|
||||
- **Loudspeaker** with no earbuds (3h). Mitigation is only that Voice is manual and not saved.
|
||||
- **Cost:** bounded per answer and per minute per device, not per day.
|
||||
- **Hands free with Voice on:** the microphone is open while the answer plays. Through earbuds
|
||||
the glasses should not hear it; through a loudspeaker they will, and an answer that contains
|
||||
an agent's name as the first word after a pause could start a turn. Not mitigated.
|
||||
- **The in-memory clip cache** holds up to three answers' audio (each at most a few hundred kB)
|
||||
until replaced or restart.
|
||||
- The cap is 900 characters. Dan agreed to "cap it" against my "say the first 60 seconds"; the
|
||||
mapping from characters to seconds is my estimate.
|
||||
- Your constraint from Round 20, no live preview in hands free, is untouched by this round.
|
||||
|
||||
## 5. Not done
|
||||
|
||||
Live words in hands free and why they did not appear on the device; the background-music cut-off;
|
||||
route or wear detection; audio focus; a Voice marker outside the menu. Dan's stated order is
|
||||
voice first, then that list.
|
||||
|
||||
## State
|
||||
|
||||
Server: bridge `d65beea`. Even account: 0.4.1 on beta. Nothing in this round is deployed,
|
||||
uploaded or installed, and `/etc/hermeven/bridge.env` has no speech settings.
|
||||
|
||||
## Checks
|
||||
|
||||
`docs/test-evidence.md`, "Round 24".
|
||||
@@ -927,3 +927,51 @@ version is the one the 6-passed line above is for.
|
||||
(Docker is present; not run, no file under `deploy/` has changed since Round 18). The sound
|
||||
check has not been run in any real browser. The idle-exit simulator failure from Round 19 did
|
||||
not recur and remains unexplained.
|
||||
|
||||
## Round 24 (2026-11-29): answers read aloud, shutdown fix, 0.5.0, on `9874e1bb5b38458a6bc55159362f39234746fb67`
|
||||
|
||||
```
|
||||
$ npm ci ok
|
||||
$ npm rebuild @evenrealities/evenhub-simulator
|
||||
$ npm run typecheck clean
|
||||
$ npm test Test Files 20 passed (20); Tests 375 passed (375)
|
||||
$ npx vitest run --project integration tests/integration/wake.test.ts tests/integration/voice.test.ts
|
||||
Test Files 2 passed (2); Tests 52 passed (52) (34 + 18)
|
||||
$ npx vitest run --project even-client apps/even-client/test/soundCheck.test.ts Tests 6 passed (6)
|
||||
$ npm run client:build built (as part of pack)
|
||||
$ HERMEVEN_BRIDGE_ORIGIN=https://hermeven.xylo.gg npm run -w @hermeven/even-client pack (twice)
|
||||
hermeven.ehpk 107879 bytes, SHA-256
|
||||
19a2174360a72dedaff861bcef25b6f09c32774969540292489d8b70a4ba1b0a both times; not uploaded
|
||||
$ npm run test:real-stt Tests 11 passed (11)
|
||||
$ npm run test:real-hermes Tests 9 passed (9) (isolated gateway, stub model)
|
||||
$ npm run test:simulator 3 runs, 9 passed each time
|
||||
$ bash -n deploy/install.sh tests/deploy/runbook-proof.sh ok
|
||||
$ git diff --check origin/main...HEAD ; git diff --check d65beea HEAD clean (on the committed SHA)
|
||||
```
|
||||
|
||||
All on the code as committed, except: the README (one sentence and the test count) was edited
|
||||
after the run started, and it is not an input to any test or to the package.
|
||||
|
||||
Every speech test uses `tests/fakes/fakeTts.ts` (an HTTP server imitating the documented
|
||||
request and returning bytes that are not audio) and a fake loudspeaker. **Not run, and not
|
||||
possible here:** a call to the real ElevenLabs API; MP3 decoding or playback in any browser,
|
||||
the simulator, the Even app or on a phone. `apps/even-client/src/ui/speaker.ts` has no test.
|
||||
The simulator's nine scenarios pass with the speaker created there; its bridge offers no voice,
|
||||
so the menu has no Voice entry and nothing is fetched.
|
||||
|
||||
During development two voice tests failed and were corrected: one expected 400 for a malformed
|
||||
id where the bridge answers 404 as it does for turns; one hung in teardown, which is section 3
|
||||
of the handoff. The fake provider's `stop()` also waited on a kept-alive connection and now
|
||||
closes connections first.
|
||||
|
||||
**Not run:** `caddy validate` (not installed here); `systemd-analyze verify` and
|
||||
`tests/deploy/runbook-proof.sh` (the only file changed under `deploy/` is
|
||||
`bridge.env.example`, comments only). No negative control was run on the final tree for the
|
||||
shutdown fix or for any voice test. The idle-exit simulator failure from Round 19 did not recur
|
||||
and remains unexplained.
|
||||
|
||||
Negative coverage in `tests/integration/voice.test.ts`: no speech without a key or a voice;
|
||||
another device's turn, an unfinished turn, an unknown id and a voiceless agent all 404 with no
|
||||
provider call; over-budget 429 while an already-made clip is still served; provider failure is
|
||||
a fixed message with nothing of the provider's or the answer's text in the reply or the log; no
|
||||
fetch or playback with Voice off; late audio not played; no `/v1/transcribe` in hands free.
|
||||
|
||||
Reference in New Issue
Block a user