Skip to content

Time-of-day aware routing: peak/off-peak pool, model, and effort selection #9378

Open

Description

@dezren39

Ask (Drew, 2026-11-13): routing should make time-of-day decisions — pick pools, models, and efforts with peak vs off-peak pricing and quota pressure in mind, instead of running one static chain around the clock.

Why now: the quota Analytics & projection section (live 2026-11-13, /quota#analytics + /api/quota-analytics.json) now measures hour-of-day and day-of-week burn patterns per pool/model/effort, week-over-week deltas, and projected time-to-wall per reset window. The data to drive time-aware routing exists; the policy layer doesn't.

Scope:

  • A time-aware routing policy: per pool, the cheap/expensive windows (provider peak pricing where it exists, quota-window pressure where it doesn't — e.g. a weekly pool at 90% on Monday is "expensive" until its reset; the same pool Sunday night pre-reset is "use it or lose it").
  • Decision inputs: time of day, day of week, holidays (the analytics section already labels US federal holidays), current pool % + projected wall, reset proximity.
  • Actions the policy may take: prefer flat/free tiers during peak, shift deferrable batch work (triage sweeps, hygiene, design-register scans) into off-peak windows, raise/lower effort by window for the workhorse class, and pre-burn a pool that would otherwise expire unused.
  • Represent the policy as data in the route config (like the rest of the routing rules), not hard-coded branches; every time-based switch must be visible in the route_attempt record so its effect is measurable against the analytics.
  • Guardrails: never starve interactive/priority-10 work for a pricing window; quota routing rules (100% = leg not attempted, sticky working leg, no probes on scarce quota) still apply — time-of-day chooses among HEALTHY legs, it never resurrects a walled one.

Acceptance: policy spec + config representation merged; one live pool demonstrably switching preference by window with route_attempt evidence; analytics shows the before/after burn-by-hour for that pool.

Refs: /quota#analytics-patterns (hour/day patterns), code#9363/#9364 (analytics build), the Luna effort round-robin trial (PR #9018) as the measurement pattern to reuse.

Activity

  1. developing-today commented on Nov 13, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    Picked up by repo-worker-code-a — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-code-a posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  3. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 13, 2026
  4. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    Progress from repo-worker-code-a: triaged: Drew-specified design program (sibling #9399); laptop exec route down this shift so implementation cannot start/verify; releasing free with first step + acceptance recorded

  5. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged (released free — design program, not a one-shift fix)
    worker: repo-worker-code-a (fallback mode, queue backend down)

    Triage assessment (fresh read of the issue, 2026-11-13):

    • Kind: design + implementation program (sibling of the pool & effort system program on Program: pool & effort system — effort tiers per pool, OpenChamber category pools, granular stats store (design mill) #9399). Drew's ask is already well-specified: scope, decision inputs, guardrails, and acceptance are all stated in the body, so no further specification is needed before work starts.
    • First concrete step for whoever takes it: draft the policy spec + config representation (policy as data in the route config, every time-based switch visible in route_attempt), reusing the Luna effort round-robin measurement pattern (PR opencode config: workhorse Luna seat round-robins medium/high via luna-effort-rr (Drew 2026-11-12) #9018) and the live quota analytics inputs (/quota#analytics, feat(pm-aggregator): quota analytics & projection section #9363/fix(pm-aggregator): read skill names from state.input.id #9364). Acceptance requires one live pool demonstrably switching preference by window with route_attempt evidence plus before/after burn-by-hour analytics — that live-evidence stage cannot be faked or shortcut.
    • Why this lane is not implementing it in this shift: implementation and live verification must run on the laptop (route config + pool evidence), and the laptop-agent exec route failed repeatedly this shift ("proxy closed during CONNECT" on every exec attempt after an initial health success), so no repo worktree work could be started or verified. The queue backend is also down (fallback mode), which is why this note carries the state instead of a broker checkpoint.
    • Released free with the full remaining scope intact: policy spec, config representation, one-pool live switch with route_attempt evidence, analytics before/after. Nothing about the issue is blocked by a decision — it is ready to claim.
  6. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    Released by repo-worker-code-a (outcome: free). triaged only, NOT done: Drew-specified time-of-day routing design program (sibling #9399); remains: policy spec + route-config representation, one live pool switching by window with route_attempt evidence, analytics before/after. Released free because laptop-agent exec route failed all shift (proxy closed during CONNECT), so laptop implementation/verification could not start; triage note with first concrete step posted on #9378

  7. added and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 13, 2026
  8. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    Triage verdict for #9378 (queue task 18944, detached route opencode-route/workhorse). Not resolved; route a spec packet, no implementation.

    Fresh evidence, read 2026-11-17T05:13Z:

    Action taken:

    • Follow-on packet queue task 20400 on repo-health-code-pilot (kind small_fix, dedupe repo-health:v1:fix:developing-today/code:issue:9378). Scope: a docs-only policy spec and config representation (per-pool windows, decision inputs, guardrails, route_attempt fields for measurability, open questions with defaults). Excluded: any live pool switch, any config change, the before/after analytics, and holiday implementation (opencode#821).
    • Task 18944 (this triage) is completed with that routing.

    Open questions, each with the default I chose:

    1. Should calendar and holiday exclusion land in the spec now? Default: name it as a dependency on opencode#821, do not implement.
    2. Is Program: pool & effort system — effort tiers per pool, OpenChamber category pools, granular stats store (design mill) #9399 a blocker for the live switch? Default: no for the spec; the live switch is sequenced after the spec packet.
    3. Which pool is the first live switch? Default: left to the spec packet to propose, with DeepSeek peak windows as the candidate because they already exist in config.
  9. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    Dispatch binding record for queue task 18944: session ses_e5e18119063ffeHQWB7nd5Wovj was launched on opencode-route/workhorse in /home/user/git/fleet/queue-18944-9378-time-aware-routing (branch queue/18944-9378-time-aware-routing) and verified by assistant-message content engaging the triage. The session completed triage and routed the remaining spec scope to follow-on task 20400; see the triage note above. Queue-side bind did not succeed (no lane ledger row at attempt time); the later lane row is direct with no session id. Queue task 18944 remains claimed and must be terminalized by its authorized claim owner; this comment records the session/task/issue relationship, not a queue completion.

  10. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    Queue close-out update: task 18944 was completed at 2026-11-17T05:27:57Z by its recorded claimant repo-worker-conductor, with outcome triaged and follow-on task 20400. The finished session was not attached to the later direct lane row; the claim was terminalized under its actual worker identity. Issue #9378 remains open and unresolved for the policy-spec follow-on.

  11. dezren39 commented on Nov 18, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: parked
    task: 20400
    lane: oc-code-01 (OpenChamber scheduled lane, worker repo-worker-code)
    stage: claimed -> route_validation

    OpenChamber scheduled lane claimed task 20400 and wrote the required first checkpoint (origin: openchamber-scheduled-lane). Fresh GitHub state confirms #9378 remains OPEN with queue/queued and existing prior triage notes. The packet is a standalone 45-minute policy-spec deliverable, not a quick triage; it needs a dedicated focused docs session/worktree. Its scope and acceptance are already explicit, and the prior triage says the spec is ready to claim, not blocked on #9399. This scheduled lane is keeping to revalidation/disposition and will not start the larger spec in the shared working tree. No duplicate follow-on created.

    backlog_updated: false

  12. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed on Nov 18, 2026
  13. added a commit that references this issue on Nov 18, 2026
  14. dezren39 commented on Nov 18, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    lane: openchamber-scheduled-lane (code-j) · worker repo-worker-code · queue task 20400 · dedupe repo-health:v1:fix:developing-today/code:issue:9378
    state: triaged → spec merged
    Stage-1 policy spec merged as PR #11797 (merge commit c87db55): doc/2026-11-18T12-00-00Z_design_time_of_day_routing_policy/spec.md. Docs only; no config or code changed. Covers the policy (window classes, A1-A4), config representation extending model_route_windows, guardrails G1-G4, route_attempt fields with before/after metrics, and open questions with defaults. Holiday exclusion is delegated to opencode#821. Prior art: #8838 design (ranking schedules). The live switch packet can start from this spec.

  15. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 18, 2026
  16. removed their assignment
    on Nov 20, 2026
  17. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Merged work, still open. Every pull request that references this issue has merged (#11797) and none is open, but the issue kept status:in-review. Tasks that name it as a blocker have been waiting on it.

    status:in-review is removed. Whoever takes this next: run the issue's done check against main. Close the issue if it passes; if not, list what is left here and carry on with it (AGENTS.md, "Finishing work").

    By: Claude, 2026-11-22 flow review.


    Generated by Claude Code

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