Skip to content

Serving: router lane live with holdout, outage handling and rollback #13

Open

Description

@lukemaj

What: The router lane serves judgment entries live from the GPU serving host on every message and every tool call, with a 10% holdout, outage handling and one-step adapter rollback.
Why: Procedures such as design or verification methods apply without their trigger words appearing, so only a judgment model can serve them, and the user ruled to ship it now.
So what: Cue is live on rocky, cavallo, and bestia. This stays open because rocky retries Cue during an outage (toolboxmd/chromeria#271).

Parent

#3

Outcome

The serving server starts a router request at the pre-tool moment and collects it at the tool result, and scores at every user message. The router scores the 9 trained AgentsMD entries in scope, serves fires above the validation threshold with their "applies when" line first, and logs every candidate. 10% of sessions, chosen at session start, get no router injections while would-fires are still logged.

Elon record

  • Requirements and who asked: ship router serving now; run at every message and tool call with latency hidden behind the tool run; start with the 9 trained AgentsMD entries; 10% comparison group without router serving (user, 2026-10-12); one GPU request at a time and deadline drops; rescore with the tool result after failures; adapter rollback (gap reviews).
  • Deleted: shadow mode and a go-live quality gate; a semantic prefilter; a pack ceiling; a server-side log with window text.
  • Bottleneck: the serving server and log; router availability depends on the serving host (host work Issue), not a blocker because outages are logged and local lanes are unaffected.
  • Checked myself: router latency about 620 ms median with 9 entries on the serving GPU for the base model (the deployed adapter's latency is not yet measured); held-out precision and recall of the chosen adapter; the before-action delivery research. Close-out 2026-10-14: live moments on rocky, cavallo, and bestia; bestia Cue health, journal, and the rollback log. The remaining gap is rocky re-arming during the overnight stop (Cue client on rocky retries the service after marking it down chromeria#271).

Acceptance criteria

  • The router serves on live sessions with end-to-end latency per caller (mean, median, p90, timeout rate) measured on the deployed adapter.
  • Windows exist on the serving host only in memory; logs hold ids, scores and moment references.
  • A connect failure marks the remote unavailable machine-wide with a periodic probe; later calls skip the router and local lanes are unaffected; a slow call logs timeout for that call only. Local lanes and per-call timeouts held. The skip held on bestia and did not hold on rocky (Cue client on rocky retries the service after marking it down chromeria#271).
  • 10% of sessions are holdout for router injections, recorded per session, with would-fires logged.
  • Rolling back to the previous adapter is one step and logged.

Non-goals

Blocked by

Required proof

  • A day of live logs with router outcomes, latency per caller, holdout share and one outage handled; the rollback check. Recorded 2026-10-14: the live span is the whole period since go-live (rocky 15.6 h from 2026-10-13 15:35Z), including the overnight stop. The outage skip on rocky is the open part.

Activity

  1. lukemaj commented on Oct 13, 2026

    @lukemaj
    ContributorAuthor

    Model (2026-10-13). Cue (this router lane) serves with Qwen3-Reranker-4B plus the trained q4b-cloud adapter, run as int8 W8A8 and compiled, on the serving GPU. Measured about 340 ms per message against about 620 ms in bf16. The user asked whether Cue uses an int8 model; it does, and it is the 4B model, not a 3B one. An explicit user confirmation of the 4B size is not on record yet.

    Standing decisions from 2026-10-12, unchanged: ship now, no shadow mode (wrong fires are accepted and will be changed if they prove annoying or harmful), 10% holdout of sessions.

  2. lukemaj commented on Oct 13, 2026

    @lukemaj
    ContributorAuthor

    User confirmed 2026-10-13: Cue runs Qwen3-Reranker-4B with the q4b-cloud adapter, int8 W8A8 compiled.

  3. lukemaj commented on Oct 13, 2026

    @lukemaj
    ContributorAuthor

    Handoff: Cue lane implemented, service live on bestia, Chromeria not yet deployed (2026-10-13)

    State: the Cue service runs on bestia; no Chromeria calls it yet, because each machine's Chromeria needs the PR build and a restart (planner's go-ahead per machine). None of the five acceptance criteria is checked off: they need live sessions.

    PRs (independent review round 2 running on each head)

    PR Head Contents
    toolboxmd/chromeria#227 c815cbe Cue lane in the serving module: client, holdout, outage handling, user-message seam, log columns
    #36 b0d11e0 Cue entry loader, cue/cue_url config, check for both stores; the Cue service, unit, rollback (v0.2.0)
    toolboxmd/agentsmd#221 1f86923 the nine trained Cue entries in contextmd-cue/ with pinned texts (v17.1.0, closes agentsmd#220)

    Round 1 found one blocker in each of chromeria#227 (a non-http: cue_url could exit the server) and contextmd#36 (malformed citation markup dropped the request; README gaps against ADR 0001). Both are fixed and in review again.

    Live on bestia (contextmd 74882a8, runbook 236a7cd)

    • User unit contextmd-cue.service on 100.116.0.2:8710. Active variant q4b-cloud-step64-w8a8c (Qwen3-Reranker-4B + q4b-cloud step-64, merged, W8A8, compiled); previous variant q4b-cloud-step64-bf16.
    • Threshold 0.5625, not 0.4375. The kernels compiled on bestia score differently from the INT8 report's run: mean 0.34 logits, max 3.06 over 2,448 dev pairs, the same size as the W8A8-vs-bf16 drift. The report's two compiled runs are identical to each other, and its eager and compiled W8A8 runs differ by the same 0.35. So I re-picked the threshold on the deployed kernels' own held-out val scores (eval.py report):
    Scores t Held-out val min Dev R / P (objective) Dev AUC / AP
    INT8 report, W8A8 compiled 0.438 0.537 71/97 / 48/93 (0.516) 0.947 / 0.691
    deployed, report's threshold 0.438 0.537 69/97 / 46/95 (0.484) 0.947 / 0.693
    deployed, own threshold 0.562 0.545 67/97 / 45/90 (0.500) 0.947 / 0.693
    • After a restart the live service gives exactly the offline scores on 360 pairs, so the threshold matches what serves.
    • Rollback check: contextmd-cue rollback switched to bf16 (serving within about 5 s, restart: ok, 584 ms median), and a second rollback switched back to W8A8 (95 s warm restart). All three switches are in ~/.local/state/contextmd-cue/deployments.jsonl.
    • Window format: the port reproduces all 2,305 training windows byte for byte. About 15% of live message windows are trimmed less than in training, because training counted the agent's later plan text against the 10,000-character budget. Noted for Router: a local model that matches the judge on unseen entries within one second #4.

    Latency on the deployed adapter (synthetic callers; live per-caller numbers follow the Chromeria deploy)

    272 dev windows sent as /score requests (items up to the message, 9 entries), sequential, from each machine:

    Caller mean median p90 p99 failed over 650 ms
    rocky 392 347 575 851 0 21 (7.7%)
    cavallo 420 375 627 931 0 24 (8.8%)
    bestia 381 328 568 841 0 19 (7.0%)

    GPU time alone: median 321 to 327 ms, p90 558 to 566 ms. Consequence: with the 650 ms wait at a user message, about 7 to 9% of message moments will log timeout. Pre-tool requests hide behind the tool run.

    Next actions

    1. Review round 2 passes, then the developer merges chromeria#227 and the user merges contextmd#36 and agentsmd#221.
    2. Planner's go-ahead per machine: deploy the merged Chromeria build and restart on rocky, cavallo and bestia.
    3. Add to each ~/.config/contextmd/serving.json (only after step 2, since an older server rejects unknown keys and stops serving): "cue": ["~/dev/toolboxmd/agentsmd/contextmd-cue"], "cue_url": "http://100.116.0.2:8710". This needs AgentsMD at 17.1.0 or later in each clone.
    4. After a day: per-caller latency and timeout rate from moments.cue_ms, cue_wait_ms, cue_status; holdout share; one outage (systemctl --user stop contextmd-cue for a few minutes shows connect_failed, then not_called, then recovery by the probe).

    Rollback: variant: contextmd-cue rollback on bestia (README). Code: swap app/ and app.previous/. Turn Cue off on a machine: remove cue/cue_url from its serving.json; this takes effect on the next moment with no restart. Remove the service: ContextMD README, "Cue service".

  4. lukemaj commented on Oct 13, 2026

    @lukemaj
    ContributorAuthor

    Update: independent review round 2 passed on all three heads (chromeria#227 c815cbe, contextmd#36 b0d11e0, agentsmd#221 1f86923), and CI is green. They are ready to merge. Deploy steps 2 to 4 of the handoff above are unchanged. Filed toolboxmd/agent-observer#72 (publishing cost by Issue finds no sessions).

  5. 3 remaining items

  6. lukemaj commented on Oct 13, 2026

    @lukemaj
    ContributorAuthor

    Deploy note (2026-10-13, Chromeria a6fc44664607, Cue q4b-cloud-step64-w8a8c): live moments scored on all three machines. bestia and cavallo user messages: ok in 286 and 288 ms. rocky, first minutes after cue/cue_url were added (15:34:58Z): tool results ok 9 (590 ms average, 1,120 ms max), timeout 3, lost 5; user messages ok 1 (383 ms, window 3,799 characters), timeout 2 (waited 652 and 655 ms against the 650 ms limit). The rocky-to-bestia round trip runs about twice the other machines', so rocky's user-message wait is often too short; worth watching in the day-one numbers.

  7. lukemaj commented on Oct 13, 2026

    @lukemaj
    ContributorAuthor

    Rocky's Cue latency and a bestia outage (2026-10-13).

    • Relay path: tailscale status on rocky shows bestia as active; relay "waw", so rocky reaches the Cue service (100.116.0.2:8710) through a Tailscale relay (DERP) rather than directly. cavallo shows the same relay "waw" line. That fits rocky's round trip of about 590 ms against 286 to 288 ms measured from bestia and cavallo live moments earlier; a direct path was not measured, because:
    • Bestia went offline at about 15:44Z: Tailscale on rocky and cavallo reports it offline ("last seen 19m ago" at 16:03Z); ping, SSH and /health all time out. The Cue service runs there, so Cue is down for every machine.
    • Outage handling worked: rocky's serving log shows connect_failed at 15:47Z, then only not_called (machine-wide unavailable); exact-key serving continued (1,261 moments ok, 0 failed). The 30-second /health probe should restore Cue when bestia returns.

    Next: once bestia is back, compare tailscale ping bestia (direct vs DERP) and /health timing from rocky; if the path stays relayed, a direct connection (for example a LAN route or opened UDP) is the fix rather than a longer Cue wait.

  8. lukemaj commented on Oct 13, 2026

    @lukemaj
    ContributorAuthor

    Correction to my earlier relay note: rocky's Cue latency is the model, not the network. Bestia came back (rebooted about 16:10Z); tailscale status on rocky now shows direct 10.101.5.27:41645, tailscale ping bestia 5 ms, /health about 10 ms (cavallo: also direct, 13 to 30 ms). The earlier relay "waw" line was taken while bestia was going offline.

    Rocky, 288 ok Cue calls in the 30 minutes after recovery (from cue_json):

    p50 p90
    Round trip (cue_ms) 478 ms 667 ms
    Service time (ms) 425 ms 527 ms
    Queue (queue_ms) 7 ms 166 ms
    Window tokens 1,326 1,839

    Service time grows with the window: under 500 tokens 265 ms, 500 to 1,500 tokens 403 ms, 1,500 to 3,000 tokens 480 ms. The 286 to 288 ms seen on bestia and cavallo came from fresh test threads with 58-token windows. So rocky's user-message waits (650 ms limit) miss when windows are long; over the same 30 minutes: user messages 20 ok, 1 timeout; tool results 266 ok, 12 timeout, 37 lost. Levers, if the miss rate matters: a shorter window, a faster adapter, or a longer user-message wait; the network is not one.

  9. lukemaj commented on Oct 14, 2026

    @lukemaj
    ContributorAuthor

    Close-out, read-only, 2026-10-14. Four of the five acceptance items hold. The outage skip does not hold on rocky, so this stays open. Counts only; no window text.

    Elon record, checked myself: rocky, cavallo, and bestia contextmd.sqlite opened file:...?mode=ro; bestia contextmd-cue journal, deployments.jsonl, and /health. No rollback and no restart.

    Serves live, on the deployed adapter q4b-cloud-step64-w8a8c

    Round trip is cue_ms on cue_status=ok. Timeout rate is timeout / (ok + timeout), which leaves out the outage skips.

    Caller Span (UTC) Kind ok mean median p90 timeout timeout rate
    rocky 2026-10-13 15:35Z to 2026-10-14 07:08Z (15.6 h, 8,498 Cue rows) user message 94 400 384 566 46 33%
    rocky same tool result 2,458 646 562 956 297 11%
    rocky same tool failure 37 529 512 625 33 47%
    bestia 2026-10-13 15:10Z to 2026-10-14 07:10Z (16.0 h; 716 of 717 ok rows are 2026-10-14) user message 77 399 340 613 27 26%
    bestia same tool result 620 603 515 943 856 58%
    bestia same tool failure 20 655 625 853 19 49%
    cavallo 2026-10-13 15:15Z to 18:24Z (3.2 h, then no further Cue rows) user message 11 302 306 333 0 0%
    cavallo same tool result 37 407 350 713 10 21%

    Every ok row names that adapter. Nine entries are scored on each ok moment (rocky 2,589 moments, 23,301 scores, 695 at or above 0.5625). Fires on the non-holdout arm were injected (rocky 120, bestia 79, cavallo 4).

    Timed-out rows do not store a window size (rocky 376 timeouts, 0 with window_tokens). Among rocky ok user messages the round trip rises with the window: under 500 tokens median 297 ms (n=32), 500 to 1,499 median 411 (n=47), 1,500 to 2,999 median 566 and p90 640 (n=15), against the 650 ms wait. Among rocky ok tool results, 1,500 to 2,999 tokens median 636 ms with 495 of 1,057 over 650 ms, and 3,000 or more median 906 ms with all 140 over 650 ms. The longer-span miss rate belongs with toolboxmd/chromeria#248.

    Windows stay off disk

    cue_json is at most 105 characters. Its keys are ms, queue_ms, window_chars, window_tokens, window_cut, and sequences, all numbers or a bool. Intent reasons are at most 7 characters. The service journal from 2026-10-13 (224 messages) has startup lines, torch noise, and broken-pipe tracebacks, and no window markers. ~/.local/state/contextmd-cue/ holds only deployments.jsonl.

    Holdout

    The arm is one bit per session, stable for the whole session (0 sessions with both values).

    Caller Holdout sessions Share Would-fires (outcome=holdout) Intent injected on a holdout moment
    rocky 9 of 84 11% 107, scores 0.563 to 3.375 0
    bestia 5 of 58 9% 13, scores 0.75 to 3.563 0
    cavallo 8 of 86 9% 0 above threshold 0

    Rocky also injected 1 exact-key match on a holdout moment (plus passed 5, lifted 1, suppressed 4). The arm withholds Cue fires. Exact-key serving still happens there.

    Outage: fail-open holds; the skip does not, on rocky

    contextmd-cue.service inactive at 2026-10-13 19:52:42Z, started 2026-10-14 06:21:55Z, bound 06:23:36Z, adapter q4b-cloud-step64-w8a8c, threshold 0.5625. This matches the runbook stop and the morning start.

    Rocky in that window: first row connect_failed at 19:52:42Z, then not_called from 19:52:52Z. Totals: not_called 1,142, connect_failed 60, started 41, lost 10, timeout 2. Moment status ok 1,378 and exact-key injected 8, so local serving kept going. The skip did not stay: 42 times a not_called run was followed by started or connect_failed. Around 22:00Z that pair repeated about once a minute, with not_called in between. Heartbeats kept a ~30 s beat, and the longest gap was under 90 s, so this was one living process. Filed as toolboxmd/chromeria#271.

    Bestia, from its first row in the window (05:47:10Z connect_failed) until the bind: only not_called. First ok 06:24:03Z. Moment status ok 557, exact-key injected 4.

    A timeout does not itself take the machine down. Of 376 rocky timeouts, the next Cue row was ok 271, timeout 84, lost 19, not_called 2. Both not_called follow-ons are inside the stop (19:52:45Z and 21:07:05Z).

    Cavallo sent no Cue rows during the stop.

    Rollback

    One step, logged, not run again this close-out. deployments.jsonl: 2026-10-13 11:47:45Z q4b-cloud-step64-w8a8c to q4b-cloud-step64-bf16, restart ok; 11:48:37Z back, restart ok. Status now: active q4b-cloud-step64-w8a8c, previous q4b-cloud-step64-bf16, /health ok, threshold 0.5625. The command is contextmd-cue rollback.

    Acceptance

    • Live latency per caller on the deployed adapter, above.
    • Windows only in memory; logs hold ids, scores, timings, moment references.
    • Connect failure skips Cue until the probe sees health. True on bestia for its stretch of the stop. False on rocky across the same stop. Local lanes were unaffected on both, and a timeout stayed on that call.
    • About 10% of sessions are the holdout arm, recorded on the session, would-fires logged, Cue only.
    • Rollback is one logged step.

    #11 is closed. contextmd#36 merged as 5221283, chromeria#227 merged as a6fc446.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions