feat: the realtime transport is always TLS #20
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/fleet-tls-piece-3-computer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
feat: the realtime transport is always TLS
What this is
Piece 3 of the fleet-wide TLS-only change, in
computer. The design(
docs/superpowers/specs/2026-10-14-fleet-tls-only-design.md) names one defectshared by three repos: TLS material is optional, and its absence silently
degrades the realtime transport to plaintext
ws://. Incomputerthat was--ws_tls_cert/--ws_tls_keybeing optional, with a partial config alsofalling back to plaintext.
The defect was not hypothetical. On 2026-10-14 the attached ESP32 joined its
network, obtained an IP, and died at the WebSocket upgrade because the server
served
wss://while the flashed build spoke plaintextws://. A plaintextHTTP upgrade into a TLS listener is closed with zero bytes, so it read as "the
wake word stopped working".
After this branch, no code path in
computercan put the realtime protocol onthe wire unencrypted, and missing / partial / unusable material always fails
loudly — a startup error or a failed connection, never a downgrade.
This supersedes the transport default in
docs/plans/2026-09-10-ota-computer.md(that plan is history).
Change
Server — trust material is required. New
src/computer/server_tls.pyownstrust resolution and the one startup log line that says which material is live
(
cert=<path> subject=<subject> source=<explicit|dev>).build_pipelineresolves once, for the serving modes only, before any heavy model load:
--ws_tls_cert/--ws_tls_keyare required. Absent or partial is astartup
ValueErrornaming both flags, and mentioning--dev-trustas thedev alternative. The plaintext and partial-config fallbacks are deleted from
both
build_uvicorn_configandWebSocketStreamer.--dev-trustis the explicit dev convenience: it resolves the shared dev set(
$STARFLEET_TRUST_DIR, else../.dev-trust), requiresserver.pemandserver.keyon disk, and logssource=dev. It refuses to combine withexplicit material.
device wrongly trusting a dev CA merely fails to connect; a server quietly
coming up on plaintext or a dev CA is a security regression on a shared LAN.
--mode local/socketserve no socket and are deliberately unaffected.Client — always
wss, required bundle._build_realtime_urlloses itsuse_tlsparameter (alwayswss://);websocket_clientraises, andcomputer-client'smain()errors, when neither--ca-bundlenorSTARFLEET_CA_BUNDLEis given.client.sh/client.sh.examplegain--ca-bundlein the same change, because they connect with none today andbreak the moment the server requires TLS.
Scripts — same rule for every PC-side dialer.
synthetic_conversation_realtime_client.py(and its explicit--urlplaintextrejection),
listen_and_play_realtime.py,test_audio_path.py(whose--localself-test now mints its own throwaway certificate and serves/dials TLS),
test_live_speech.py, andtest_server_local.py(a server launcher, so itforwards
--ws-tls-cert/--ws-tls-key/--dev-trust).tests/test_tls_invariant.pyis a static fence over the five scripts, which CI's
pytest tests/never imports.Test double.
tests/conformance/fake_realtime_server.pynow takes arequired
ssl_contextand serves TLS from an in-test throwaway self-signedcertificate (
tests/tls_certs.py+ a session fixture) — not the shared devset, which keeps the suite self-contained.
Docs. README,
AGENTS.md,CONFORMANCE.md,server.sh.example, thecanonical
src/computer/api/openai_realtime/README.md, and every realtimeexample carry the required material.
Verification
Sandbox suite at the branch head: 968 passed, 1 deselected,
ruff check/ruff format --check/mypy src/clean. The sandbox needs three mitigationsand
/tmpdoes not survive a sandbox recreate:CI (
.forgejo/workflows/ci.yml, ubuntu-latest withlibportaudio2and the NLTKdata) is the authoritative full-suite run. Every plaintext-asserting test was
inverted rather than deleted, per the spec's "Testing and verification":
the partial-pair config test now requires both flags, the empty-pair case is
pinned, the
ws://URL assertions flipped towss://, the fake server and thereconnect test perform real TLS handshakes against the throwaway certificate,
and the local self-test in
test_audio_path.pywas run green.Whole-branch review: no Critical findings; one Important documentation
regression (the canonical realtime README's examples could no longer start, and
the file was missing from the root README's pointer sentence) found and fixed,
plus two same-class Minor traps.
Known cross-repo impact (accepted, follow-up required)
communicator-esp32/host/tests/fake_server_fixture.pyloads this repo'stests/conformance/fake_realtime_server.pyby file path and callsFakeServer()overws://. TLS is now a required constructor argument, soesp32's host suite fails immediately with a missing-argument
TypeErroratfixture setup — loud and self-explanatory, not a silent protocol drift. The
esp32 follow-up (pass an
ssl_context, dialwss://with the throwaway CA) isnot part of this branch.
Notes
Deferred Minors recorded during per-task review and triaged "ship" by the
whole-branch review — each has a one-line upgrade path: narrowing
server_tls.py's broadexcept Exception; an untested<empty>subjectbranch; the
__file__-derived default dev path (fragile under a non-editableinstall); a tautological
resolve_trust_dirdefault-path test (a plan defect);RealtimeServer.__init__'s guard untested;assert server_tls is not None(stripped under
python -O); the untestedsocket-mode exemption; apre-existing hard-coded test CA blob in
test_client_capture_mode.py; thegrep-shaped
test_tls_invariant.py;test_audio_path.py's optionalca_bundledefault; a missing
wss://guard onlisten_and_play_realtime.py's--websocket-base-url; conformance dead code; theSTT/README.mdandTTS/README.mdsnippet lists (pointer-covered); and one superseded sentence inthe dated
docs/plans/2026-09-10-ota-computer.md.On hardware, the unit currently pins the production CA (it still does); no
on-hardware run was part of piece 3.