Repository navigation
feat(routing): add opt-in role-scoped sticky session tiers - #45
Conversation
Bind an authenticated session and role lane (main, delegation or aux) to its approved model tier behind SESSION_TIER_MODE=sticky (default off), keep the tier through unresolved tool calls, and change it only at a safe user-turn boundary under existing policy. Bindings are hashed and stored in D1 (migration 0021) and roleplay Durable Object storage; expiry, revision or credential failure clears them.
# Conflicts: # package.json # worker/container-env.mjs # worker/d1-schema.mjs
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
multillm-proxy | 2c5213c | Oct 09 2026, 12:42 AM |
Summary
Adds opt-in role-scoped sticky session tiers behind
SESSION_TIER_MODE=sticky. The default isoff, and with it routing, response headers and storage are unchanged. A tier keeps an approved route stable across tool calls in themain,delegationandauxlanes, so a tool-using session doesn't switch models halfway through a tool exchange.session_tiermetadata (session, lane, approved model and tier).routing.session_tier.quality_tier.SESSION_TIER_TTL_SECONDS, default 1,800), a policy revision change, or a confirmed credential failure invalidates only the affected lane.session_tier_busy.session_tiersschema.session_tier_storage_unavailable, and invalid metadata returns 400.Details are in
docs/session-tiers.md.Glue left for the Wave 4 integration PR
prepare_session_tierwith the authenticated principal and the current policy revision, stripsession_tierbefore parsing and dispatch, and finalize after classified completion.Follow-up
Migration
0021createssession_tiersin D1, and the table is in the readiness list, but no D1 reader exists yet. Managed bindings are per process (or in the injected SQLite adapter). A D1-backed adapter through the private state endpoint, so that Containers share bindings, is a separate follow-up PR, not integration glue.Stacking
This PR is based on
feat/usage-reservations(#44), so migrations0018–0021stay contiguous. Review onlyfeat(routing): add opt-in role-scoped sticky session tiersand the one-line follow-uptest(session-tiers): keep the Worker module inventory sorted; the merge commit brings in the lower layers.Deployment
Apply the migration before merging to main.
/readychecks the table, and a push to main does not apply D1 migrations:Shared registrations
tests/test_session_tiers_worker.mjstotest:worker.SESSION_TIER_MODEandSESSION_TIER_TTL_SECONDSto the Container env keys.session_tiersto the D1 readiness tables.worker/roleplay/session-tier-policy.mjsto the secret firewall inventory.Tests
tests/test_session_tiers.pyandtests/test_session_tiers_worker.mjs.npm run test:worker: 1,416 passed.npm run test:integration: 7 passed.cf:migrations:checkreports 21 contiguous, additive migrations.test:deploy, free routes, client headers and thewrangler deploy --dry-runbundle all pass.CI notes
python/nodejobs: the dependency-audit steps fail on every branch, including main. fix(deps): clear the CI dependency audit advisories #42 fixes that.AdmissionCoordinatorDurable Object migration, whichwrangler versions uploadcannot apply. This is expected untilwrangler deployruns on main.This is part of Wave 4.