A Telemetry Rewrite That Defaults Off: ODIN's V2 Cutover Gate
A Telemetry Rewrite That Defaults Off: ODIN's V2 Cutover Gate
Most printer telemetry rewrites flip the new path on, ship the diff, and triage the regressions in production. The V2 telemetry pipeline ODIN shipped behind a flag did the opposite — it merged the new code and defaulted the flag off, alongside an operator step list and a side-by-side parity primitive. This post is about why that gate exists and what it actually contains.
The Before-State
The legacy Bambu telemetry adapter is a single 713-line BambuPrinter class at backend/modules/printers/adapters/bambu.py, with 10 callsite migrations across 8 backend route files. Status reads, command dispatch, AMS sync, FTP upload, and the long-running MQTT monitor all funneled through that one path.
That is a lot of behavior to rewrite at once. It is also a lot of behavior to flip atomically. A telemetry rewrite that goes wrong at any of those callsites does not produce a single pinpointable failure — it produces drift in one route while the others look fine. Print farms run on whatever the monitor daemon writes to the database; a quiet drift between legacy and V2 in that loop is the kind of bug that surfaces three days later as "why did this printer never alert?"
What V2 Is, Concretely
V2 lives at backend/modules/printers/telemetry/. It splits the legacy adapter into typed Pydantic raw models, a pure state-machine transition() function, an ingestion adapter, a command adapter, a legacy-shaped status view, an FTPS upload helper, and session helpers that expose one-shot reads and one-shot commands so REST routes do not have to spin up a long-running adapter.
V2 also surfaces things legacy didn't:
FAILEDandFINISHEDare distinct fromIDLEin canonical state. Legacy collapsed all three.ERRORis overlaid on top ofgcode_statewhenprint_error != 0or any HMS code has severityerror. Legacy never surfaced HMS-driven errors.- An
active_errorslist exposes every HMS code the printer is currently broadcasting. - A
stage_codefield carries the specific Bambu stage number rather than a fallback string.
These are not improvements in a marketing sense. They are intentional. Legacy silently dropped HMS codes that V2 will now show. Some V2 alerts are going to look new on day one, and that is the documented behavior.
The Cutover Gate
Here is the gate, in the operator's words, distilled from the cutover doc shipped with the rewrite:
- Default in
feature_flag.pyisODIN_TELEMETRY_V2=0. Legacy runs in production today. - Flip the default to
1in staging only. Validate live-status, command dispatch, AMS sync, file dispatch, and the monitor daemon against a real Bambu printer. - Soak in staging for at least one release cycle — minimum seven days of real traffic.
- Flip the default to
1in production. Observe. - Once prod is stable on V2, strip the
if is_v2_enabled(): ... else: <legacy path>branches across the 8 migrated files, delete the legacy adapter and monitors, retire the flag module, retire the cutover and migration docs. - Tag the next release.
If V2 breaks under real traffic at any step, operators set ODIN_TELEMETRY_V2=0 in the running environment and the legacy path resumes in place. Both code paths coexist by design until step 5.
Live-Shadow as a First-Class Primitive
The package contains a live_shadow.py and a live_replay.py module. The replayer can spin up a local mosquitto broker subprocess and re-publish a captured MQTT fixture; the shadow module compares V2 against legacy on the same input. The shadow flag value is reserved — not currently wired into the dispatcher — but the diff primitive itself exists and is what backs the parity classifier.
That is the part that matters for the gate. "Run V2 alongside legacy and compare" is not a slide-deck commitment in this rewrite — it is a runnable module against captured fixtures.
What Is Verified Today
- 348 telemetry contract tests pass, covering every module in the V2 package, including flag-routing tests that verify the if-V2/else-legacy branches fire correctly.
- A demo CLI is runnable from the repo against committed fixture slices.
- Both legacy and V2 callsites are wired in production code; the flag default is
0.
What Is Not Yet Claimed
As of 2026-04-29:
- ODIN's next release tag has not been cut. The cutover doc treats that as the closing step after V2 is stable in production.
- The staging soak window described in step 3 has not been closed in public evidence.
- "V2 is the only path" is not true today. Both paths run, and any operator who needs to roll back can do so by toggling one environment variable.
These are deliberate omissions. A telemetry rewrite that ships the new code with the flag off is making a specific commitment: nothing changes in production until the operator decides it changes. The release narrative comes after the soak data does, not before.
Why a Default-Off Flag Is the Right Default
Three reasons.
First, telemetry rewrites have an asymmetric blast radius. A bug in a status route is a UI annoyance. A bug in the long-running monitor that writes telemetry to the database is a silent data corruption that does not get noticed until someone looks at a chart that should not have been flat.
Second, real Bambu printer behavior is not fully captured by any test fixture corpus, no matter how careful. The HMS code catalog grows by observation. Legacy quietly dropped codes V2 surfaces. Operators need a window to see the new alerts at staging volume before the same alerts hit production users.
Third, the rollback path has to be cheaper than the forward path. With both branches present and a single env var dispatching between them, "set it back to 0" is the rollback. There is no revert PR to coordinate during an incident.
That is the discipline ODIN should keep on rewrites of this size: ship the new code, document the gate, default the flag off, run the side-by-side, and let the operator decide when the cutover happens.
ODIN's telemetry pipeline is also exposed to AI agents through an MCP surface. Read about ODIN's agent-facing roadmap →