# Diagnostic build record — 2026-10-04 (Asia/Shanghai)

- Branch: `codex/speech-downlink-diagnostics-0.5.1`.
- Implementation / build source commit: `e12cad3cf9bfb900e376347da8c8d05eeeabf15e`.
- Base: fetched `origin/main` at `cdaba7c965e7c04070935d9ce54a7a15d04f9091`.
- Firmware: **0.5.1** (diagnostic candidate, no version bump).
- ESP-IDF 5.5.4; esp_websocket_client 1.8.0; esp_codec_dev 1.5.4.
- Worktree: `/home/lighthouse/esp32-dev/.cache/speech-downlink-diagnostics-0.5.1`.
- Artifact: `dist/m5stack-stopwatch/merged-flash.bin` within that worktree.
- Merged size: **2,128,672 bytes** (`0x207b20`).
- Merged SHA-256: **`ed1ac67bdaeecdbb59f71a715f0dab9103fb153901f9a78a924f8d9c69db4739`**.
- App image size: 2,063,136 bytes; app SHA-256:
  `5b9eebec038cc0592c22b28fc35c0de4b4d02097628ca548f56e394eafbfa466`.
- Flash metadata: `dist/m5stack-stopwatch/flash.json` (same worktree).

The final build/package command was run at the implementation commit above. Incremental
objects were reused from the same final source. Later commits only add handoff/build
records; they do not alter this artifact. Do not expect a byte-identical SHA after a
new build with different time/path/toolchain inputs; verify that build's own metadata.

## Validation

`./scripts/test-server.sh`: **PASS**, 152 Python tests, 18 Node tests, seven host C++
firmware harnesses (approval, button, speech control, physical input, WebSocket text
reassembly, agent render, new speech diagnostics). Existing local HTTP/WS Gateway
smoke and Pi/Codex TLS WSS voice transport smoke also passed. STT in these smoke tests
is explicitly fake; no provider request was made. The sole pytest warning is the
existing Starlette/AnyIO BlockingPortal deprecation.

New tests cover virtual-time 0/100/300/1000/2000ms bounded ASGI consumption, concurrent
snapshot/agent traffic, the actual sequential system-monitor topology, a single 2s
stall without catch-up, timeout/cancellation/lock release, snapshot timeout closing
1011, default-off behavior/privacy/sampling, fragment timing/reset, old-generation
playback accounting, and sampled/truncated/multi-stream correlation with A/B/C/D rules.

`./scripts/build.sh m5stack-stopwatch`: **PASS**, trace ON. Cross-compiled the three
modified firmware translation units with trace OFF using the same generated config
except removing its diagnostic define: **PASS** (compile validation, not a second
linked artifact). `git diff --check`: **PASS**. Correlation CLI run against a synthetic
2s-gap fixture: **CLASS B**, with unobserved samples left blank and no earlier/other-ID
disconnect misattribution. This is parser verification, not a physical trace.

Compared every generated CONFIG key against the baseline production build:
**the only difference is `CONFIG_DEVICE_LAB_SPEECH_TRACE=y`**. Kconfig default remains
OFF. Gateway environment flag default remains OFF. No TCP, Wi-Fi, DMA, codec, chunk,
queue-capacity or speech-timeout setting changed.

First full test attempt hit sandbox EPERM on local Unix sockets; the authorized rerun
used temporary local sockets/ephemeral Gateway ports and passed. The fresh worktree's
component download hit network isolation; build used independent copies of the already
installed, lockfile-matching managed components. No SDK source edits or dependency
upgrades were made. Production service and root `main` checkout were not changed.

## Evidence limits

Proven: source call/lock chains, no catch-up pacing, controlled backpressure fingerprints,
software trace/parser behavior and a buildable diagnostic candidate.

Unknown until physical test: actual Gateway/public-network/ESP receive timeline, hotspot
contribution, live receive/callback scheduling, instrumentation overhead on hardware,
actual I2S/DMA/codec/speaker behavior and audible completeness. Successful codec API byte
counts alone do not prove physical output. No new PHYSICAL PASS is claimed.

Follow [the Mac handoff](speech-downlink-next-physical-test.md). First physical action:
connect StopWatch to Mac by USB; after candidate setup, perform one fixed-text READ SCREEN
NOW and correlate both logs before considering changes.

**No further TCP/Wi-Fi/I2S tuning was performed without physical evidence.**
