Repository navigation
feat(router): add controlled canary rollout and operations - #911
Conversation
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed commit 00942ca, including all changed files, the existing Auto/child-admission paths, canonical run status and event persistence, and the live MatrixOne CI coverage.
Requesting changes for three outcome-path defects detailed inline:
- A conflicting critical report can roll back the deployment even though the report itself is rejected.
- The new terminal-status allowlist omits the existing terminal
delegatedstate, permanently preventing reviewed outcomes for those runs. - Concurrent identical outcome submissions conflict because the generated reviewer/timestamp envelope is compared by the canonical immutable-event writer.
Please add regressions for noncritical-then-conflicting-critical reports, delegated terminal runs, and overlapping identical submissions. The existing sequential retry/conflict test does not cover these cases.
Code growth and branch integration:
- The net increase is 2,649 lines: 1,252 implementation, 1,141 tests/support, and 256 documentation. The main responsibilities justify new code: durable deployment/CAS/audit, canonical qualification/scoring, rollout validity checks, and operational reporting. Reusing the existing run ledger and Offering admission is appropriate. Deterministic Auto remains necessary for control and rollback.
- Remove the unreachable treatment-rejection check at
services/src/evaluation/router/mod.rs:295-300, or move it to a position where it owns a useful diagnostic.authorizerequires the deterministic manifest policy;validate_identityrequires treatment to use the learned policy; the preceding policy-equality check therefore rejects every valid treatment first. The new test explicitly confirms those earlier errors. Keep the invariant test, but do not maintain an additional rejection branch that cannot fire. RolloutRun.run_idandRolloutRun.reasonhave no production reader. Remove the unused projection fields and associated SELECT/JSON decoding; the SQL can still order bye.run_idwithout projecting it.- The live path hashes/deserializes the same candidate in
score_liveand again forpinned_pair. Reuse the validated candidate/contracts within the decision preparation rather than doing the same validation twice. - One deliberate restriction still needs a clear product rationale: out-of-scope/non-primary tasks can receive a treatment cohort, abstain to strong, and subsequently have child/skill execution rejected. The PR documents child rejection, so this is an explicit tradeoff rather than an undisclosed implementation bug; nevertheless, primary-only learned routing does not by itself justify removing baseline capabilities from structurally excluded tasks. Please justify that coupling or keep excluded tasks on baseline execution authority, and cover the interaction with parallel subruns/forked skills.
Validation: git diff --check passed. CI is green on the reviewed head; I checked logs confirming the new live scoring/recovery/budget tests, the MatrixOne deployment transaction test, and the MatrixOne admin HTTP workflow actually ran and passed. No local Rust tests were run because this environment has no Rust/Cargo toolchain.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed head fdb643a against base 5f59bad, including the complete follow-up diff from 00942ca and its interaction with canonical event persistence, deployment transitions, and existing Auto execution.
The three previous P2 findings are addressed:
- Immutable outcome acceptance now precedes the safety-stop side effect. A conflicting report exits before changing deployment state or audit.
- Outcome admission uses the canonical terminal-status predicate, including delegated runs.
- A failed concurrent append is reconciled against the durable semantic outcome, preserving the original reviewer/time envelope for identical submissions.
I also traced both orders of concurrent critical reports, a manual rollback winning the race, replacement during an older report, and retry after outcome acceptance. The deployment-row check preserves the winning stop reason/revision/audit, and an older report cannot stop a replacement. Acceptance and stopping remain separate transactions: an interrupted request depends on an identical retry to finish the stop before successful acknowledgment, as now documented and covered by the retry regression.
No additional blocking correctness findings in this pass. Approving the code review.
Complexity assessment: the follow-up adds 478 net lines, consisting of 29 implementation, 442 tests/support, and 7 documentation. The five new HTTP/MatrixOne regressions exercise public behavior and relevant unhappy paths; this increase has a concrete purpose. The whole PR now adds 3,127 net lines (1,281 implementation, 1,583 tests/support, 263 documentation). The new production branches reconcile existing authority rather than introducing another outcome store or weakening immutable-event validation.
The earlier nonblocking cleanup suggestions remain: remove the unreachable dataset treatment check and unused RolloutRun projections, and avoid parsing/validating the candidate twice per decision. The documented coupling between treatment assignment and child restrictions for out-of-scope abstentions also remains a product limitation; this follow-up does not change it.
Validation: git diff --check passed. I read the new HTTP regressions and the updated transaction/audit assertions. Local Rust execution is unavailable in this environment. Test Suite and Static Checks for this exact head are still running, so their results remain required before merge; the previous head's green CI is not evidence that these new regressions passed.
Merge Queue Status
This pull request spent 14 seconds in the queue, including 3 seconds running CI. Required conditions to merge
|
Summary
Qualified offline router candidates can now progress through live shadow and an operator-controlled canary. Auto sessions receive stable control/treatment assignment, with a maximum 10% treatment fraction. Admins can inspect outcome coverage, quality, corrections, cost and latency, then roll back or revoke source evidence.
Publication reruns offline qualification and checks current Offering contracts. Durable decisions pin deployment, candidate, cohort and rubric; recovery and primary execution revalidate treatment. Routing-budget failures remain visible and cannot resume. Delayed outcomes and identical retries remain valid after deployment replacement without stopping the replacement.
Related issue
Related to #764 (model routing, Stage 6). Escalation and child treatment remain subsequent work.
Change type
User and compatibility impact
/admin/model-router/{owner}publication/status and canary, rollback, revoke and reviewed-outcome endpoints. Activation is opt-in; explicit model selections retain their behavior.2026-09-27-v90, addingmodel_router_deployments. A fresh database is required under the existing bootstrap policy; no in-place migration or backfill is provided.Architecture and complexity delta
agent_run_events; no parallel trace or outcome store was added.Verification
cargo test --locked --offline -p astra-services --lib evaluation::router -q— 12 passed.cargo test --locked --offline -p astra-turn-core --lib model_routing -q— 24 passed.cargo test --locked --offline -p astra-runtime --lib model_routing -q— 11 passed.cargo test --locked --offline -p astra-runtime --test admin_contract -- --include-ignored --test-threads=1— 13 passed, including the real MatrixOne HTTP regression.cargo test --locked --offline -p astra-services --test router_rollout_db_it -- --include-ignored --test-threads=1— 3 passed during initial Stage 6 verification (transaction/CAS/audit and dashboard checks).cargo clippy --locked --offline -p astra-runtime -p astra-services -p astra-turn-core --all-targets -- -D warnings— passed after both review fixes.make format-checkandgit diff --check— passed.make checkpassed Rust lint/type/format checks but encountered a sandbox npm network restriction; an authorizedmake check-webretry passed. No web changes were made afterward.ASTRA_TEST_DB_IT=1,ASTRA_AUTO_CREATE_DATABASE=1, empty database prefix, and matchingASTRA_DATABASE/ASTRA_TEST_DATABASE. Verified fresh v90 schema bootstrap, actual dashboard joins/JSON projections, fenced outcome appends, atomic state/audit writes, concurrent CAS and deployment-scoped safety stops. Containers were removed afterward. Existing databases were not migrated or modified.Final checklist