GeezerVison is showing github.com — feat(9378-stage2): record time-of-day window context on route_attempt by dezren39 · Pull Request #14523 · developing-today/code
Conversation
dezren39
commented
Nov 24, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Stage 2 of #9378 (time-of-day aware routing). Stage 1 (policy spec) merged as #11797; this packet implements the live half of the issue acceptance per that spec (§2.1 schema additions, §4.1 measurement).
What changed (additive only — no routing-behavior change)
The background route already switches preference by window (MiMo leads in the DeepSeek peak windows Mon–Fri 01:00–04:00 + 06:00–10:00 UTC, Flash off-peak). This change makes the switch visible in the ledger:
bin/opencode-route-proxy.mjs: optional window class (peak/off-peak/preburn, absent = peak), route-level windows bindings, and window_names/window_class/holiday/priority_band recorded on every route_attempt. Migration-safe: best-effort ALTER TABLE … ADD COLUMN, legacy INSERT fallback, read-only/shared stores keep recording without the columns. The ledger can never fail a completion.
bin/check-opencode-route-rules.mjs: class closed-vocabulary + binding validation (WINDOW_CLASSES export).
.opencode/opencode.jsonc: "class": "peak" on both DeepSeek windows; background binds ["deepseek-peak-early", "deepseek-peak-late"]. Recording only — ranking still comes from the existing gated positions.
- Tests: 5 new proxy tests (pinned-clock peak→off-peak switch flips LEAF-A→LEAF-B with
peak→neutral rows; unbound multi-match with peak-outranks-preburn precedence; off-peak vocabulary; unknown-class warns but still gates; G2 walled peak lead stays walled under a window and the failover row still carries peak state) + 1 checker test. Suites: 90/90 proxy, 53/53 checker, route-rule guard passes on the shipped config.
Acceptance mapping
- One live pool demonstrably switching by window, with route_attempt evidence — the production
background pool's gates are live in config (checker-verified); the switch is demonstrated end-to-end (pinned-clock dispatch flips the lead AND the ledger rows carry the window state, including the G2 failover case). Live-ledger check (read-only, trailing 14d): the switch fired in production (opendesign/mimo-v2.6-flash led two in-peak attempts on 2026-11-13 08:45 UTC).
- Analytics before/after burn-by-hour — BEFORE (trailing 14d,
route_id='background', 954 attempts): peak windows contain 4 attempts (2 mimo-family, 2 other; 0 deepseek-family) vs 950 off-peak. Queue work runs Fri-evening/Sat UTC batches, almost never inside peak hours — so the before picture is near-zero peak burn and the after comparison needs a 2-week re-measure once peak-hour traffic exists. Rerun SQL (replace the date bound):
SELECT
CASE WHEN (CAST(strftime('%w', datetime(time_started/1000,'unixepoch')) AS INT) BETWEEN 1 AND 5
AND ((strftime('%H:%M', datetime(time_started/1000,'unixepoch')) >= '01:00'
AND strftime('%H:%M', datetime(time_started/1000,'unixepoch')) < '04:00')
OR (strftime('%H:%M', datetime(time_started/1000,'unixepoch')) >= '06:00'
AND strftime('%H:%M', datetime(time_started/1000,'unixepoch')) < '10:00')))
THEN 'peak' ELSE 'off-peak' END AS window_class,
provider_id, model_id, COUNT(*) AS attempts,
SUM(COALESCE(tokens_input,0)+COALESCE(tokens_output,0)) AS tokens,
ROUND(SUM(COALESCE(cost_usd,0)),4) AS cost_usd
FROM route_attempt
WHERE time_started >= (strftime('%s','now','-14 days')*1000) AND route_id = 'background'
GROUP BY 1,2,3 ORDER BY 1,2,3;
After this change the same comparison can additionally group by the recorded window_class column directly. Follow-up re-measure will be tracked separately.
3. Guardrails hold — G1: non-background routes record interactive, background records batch; priority never demotes (recording only). G2: tested — a walled peak lead is not attempted under its window. G3/G4: no eligibility or quota-rule code touched; all fallbacks reachable as before (guard passes).
Closes #9378 (with the after-window re-measure as a dated follow-up, since a 2-week after window cannot exist yet).
{
"direct_parent": null,
"links": [],
"lineage": {
"design": null,
"roadmap_item": null,
"priority": null
},
"pm_meta": 1,
"provenance": {
"queue_id": null,
"scheduled_start": null,
"picked_up_at": null,
"work_started_at": null,
"created_at": "2026-11-24T18:09:14Z",
"session_id": "ses_e5df15b469bffeTncdoSwmGYrl",
"lane": null,
"host": "amd",
"worktree": "/home/user/git/code-h-9378-stage2",
"model": null,
"lane_start_issues": [],
"workspace_ref": {
"kind": "worktree",
"id": "/home/user/git/code-h-9378-stage2",
"repo": "developing-today/code",
"branch": "oc-code-h/9378-stage2-live-switch",
"sha": "979a47ae05477680d553ceec56ff52e27008fe49"
},
"auth_subject": "oc-code-02",
"stamped_by": "fleet 0.1.0 (native)"
}
}
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Stage 2 of #9378: the live half of the stage-1
time-of-day routing spec. The background route already switches
preference by window (MiMo leads in the DeepSeek peak windows, Flash
off-peak); this change makes the switch visible in the ledger per the
spec §4.1, with no routing-behavior change:
- proxy: optional window `class` (peak/off-peak/preburn, default
peak), route `windows` bindings, and window_names/window_class/
holiday/priority_band recorded on every route_attempt (migration-safe
ALTERs, legacy fallback so the ledger never fails a completion)
- checker: class vocabulary + binding validation
- config: class peak on both DeepSeek windows; background binds them
- tests: pinned-clock peak/off-peak switch, class precedence, unknown
class warn-still-gates, G2 walled-leg-stays-walled under a window
Before analytics (live ledger, trailing 14d, read-only): background
route ran 954 attempts, only 4 inside peak windows (queue work runs
Fri-evening/Sat UTC batches) — the switch fires (MiMo led in-peak on
2026-11-13) but peak traffic is ~nil, so the after comparison needs a
2-week re-measure once peak-hour traffic exists.
coderabbitai
Bot
commented
Nov 24, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 4 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2dc669e9-85a2-40bc-bf64-9c20cd78b998
Commits
-
Reviewing files that changed from the base of the PR and between 8b94770 and 0437ba1.
Files selected for processing: 5
-
.opencode/opencode.jsonc
bin/check-opencode-route-rules.mjs
bin/check-opencode-route-rules.test.mjs
bin/opencode-route-proxy.mjs
bin/opencode-route-proxy.test.mjs
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 24, 2026
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|