Phase 18 W3: RL queue-policy shadow suggestion (officer export queue) - #52
Merged
Conversation
… queue - server/rl/queuePolicy.ts: config-gated (ML_STACK_HTTP_URL + RL_QUEUE_POLICY_SHADOW_ENABLED=true) ml-stack client for POST /score/queue-policy; fail-closed typed errors (config/untrained/ unavailable/invalid); shadow-mode enforced; candidate-set validation; OPE score pass-through; /health registry status probe. - queuePolicy tRPC router: officer-facing suggestion (authoritative FIFO/AEO order returned unchanged alongside the suggestion — RL only annotates) + append-only recordDecision log for future reward joins. - Migration 0070 queue_policy_decisions (hand-written delta + journal entry, 0069 precedent; no history rewritten). - AdminAeoFastLane queue tab: 'Suggested order (shadow policy vX)' toggle with per-row suggested-position badges, Accept/Override logging, and honest untrained / not-configured states. Never auto-applied. - REST GET /v1/rl/queue-policy/status for the ministry RL-insights card (reports:read API key; 503 down, trained/untrained honest payload). - Registered ML_STACK_SERVICE_TOKEN + CSP_*_EXTRA in env.ts (PRA-068 sweep now green), queuePolicy exempted in the Permify coverage gate (in-router officer role enforcement, aeoFastLane precedent). - Regenerated pnpm-lock.yaml (main's lockfile was stale vs package.json since Phase 17 B1 — flagged in phase17/b1 RESULT.md). Tests: server/rl/queuePolicy.test.ts (16), phase18.queuePolicy.db.test.ts (6, DB-gated), executiveApi route registration. Full suite: 5276 passed, 0 failed (baseline 5258 with 2 pre-existing failures).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Phase 18 W3 (singlewindow half): RL queue-policy SHADOW suggestion surface.
server/rl/queuePolicy.ts: config-gated ml-stack client (ML_STACK_HTTP_URL + RL_QUEUE_POLICY_SHADOW_ENABLED=true; env-only ML_STACK_SERVICE_TOKEN bearer). Typed fail-closed errors; shadow mode enforced; suggested_order validated against the candidate set; OPE pass-through; /health status probe.queuePolicytRPC router: officersuggestionreturns the policy's suggested order alongside the authoritative FIFO/AEO order (never modified);recordDecisionappend-only officer accept/override log.queue_policy_decisions(hand-written delta + journal entry, 0069 precedent).GET /v1/rl/queue-policy/status(reports:read) for the ministry RL-insights card.Tests: full vitest suite 5276 passed / 0 failed (baseline 5258 with 2 pre-existing failures, both now green). DB-gated suites skip cleanly without PostgreSQL.