Repository navigation
fix(runtime): activate new runs from committed owner leases - #1105
mergify[bot] merged 3 commits into
Conversation
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed commit 0558d9a. No blocking findings.
Creation returns initial authority from the canonical transaction with its original lease bound. Delayed acknowledgements cannot extend that bound, and exact replays cannot activate another executor. Existing heartbeat renewal and durable provider/tool fencing retain their responsibilities. Cache-scope diagnostics reuse the grading/progress path without changing acceptance criteria or exposing private payloads.
Local validation passed: 846 Runtime run tests, 194 Services run tests, 621 harness tests, 15 Python progress tests, and two additional ACK/cancellation tests covering four create/stream scenarios. Formatting and diff checks passed. The current-head live harness completed 18/18.
This approves the reviewed source. Real multi-CN fault qualification was not performed, historical cache-failure attribution remains unproven, and the cancelled PR-title check still needs its normal CI disposition.
Merge Queue Status
This pull request spent 18 seconds in the queue, including 2 seconds running CI. Required conditions to merge
|
Capability assessment: Unchanged: Agent chat remains Beta, and Durable Work and Checkpoints and recovery remain Partial in the existing CLI/Server/Web profiles. This fixes initial run activation without adding a capability, expanding a profile, or claiming new live-database qualification.
Summary
A newly created run could return
409 execution_authority_not_currentbefore any model or tool execution even though its creation transaction had committed. Startup immediately renewed the new owner's lease through another pooled connection; a different MatrixOne CN snapshot can lag that commit. A later diagnostic read does not establish which predicate rejected the earlier UPDATE.Return the committed initial owner generation and a conservative monotonic lease bound from the canonical run store. Normal creation anchors the bound before INSERT; timeout reconciliation retains the earlier admission bound. A delayed acknowledgement never restarts the lease clock.
Activate fresh root and child runs from that receipt, start the existing heartbeat, and check the same live local authority before root execution. Exact retries return the existing run without fresh authority. Preclaimed and recovered children retain durable authority confirmation.
Preserve existing periodic renewal, provider/tool database authorization, generation fencing, cancellation, and expiry checks. Preparation that loses its lease cannot terminalize the run or remove the workspace needed by recovery.
Add entrypoint and lease-boundary regressions, an opt-in MatrixOne creation/replay test, English rationale comments, and the durable-run contract update.
Unblock the required security audit with a Cargo-generated lockfile-only patch:
rustls-webpki0.103.16 andwebpki-roots/webpki-root-certs1.0.10 fix RUSTSEC-2026-0381/0382/0383. This matches the dependency update in fix(deps): update webpki crates for RustSec advisories #1104; no audit exceptions or gate changes are added.Retain safe grading-time evidence for the live cache-scope CI investigation. The aggregate intentionally drops physical execution captures; the existing progress observer could therefore publish neither the observed post-cold cache reads nor which execution capture was missing, pending, unverified, or conflicted. Publish only typed states, identity-match flags, scope counts, and numeric cache counters through the existing progress/summary chain. Acceptance predicates, assertions, thresholds, models, timeouts, workflow selection, and audit policy remain unchanged.
Related issue
Fixes matrixorigin/matrixflow#19270
Related security update: #1104.
Change type
User and compatibility impact
Fresh run creation no longer depends on a second connection immediately recognizing the lease just committed by creation. Exhausted or cancelled startup authority still cannot execute, and exact replays do not launch another executor.
HTTP/SDK wire formats, database schema, SQL statements, lease durations, renewal budgets, and migrations are unchanged. The Rust store contract changes:
insert_runandinsert_run_with_deadlinereturnDurableRunStartAuthority, andDurableRunStartClaim::Startedcarries that receipt. Repository implementations and callers are updated. No MOI code is changed. The compatible TLS security patches reject distrusted certificate paths and remove the affected trust root.Architecture and complexity delta
RunStateStore/DatabaseRunStateStorereturn evidence of their own creation transaction;RunEnginevalidates its original safety window and installs the existing owner heartbeat.Verification
Runtime commands and results (from the Astra repository root, at
81fa532b0before the security-only lockfile update):cargo test --locked -p astra-runtime --lib fresh_run_uses_committed_lease_before_preparation -- --nocapturereproduced the unwanted 409 and failed.cargo test --locked -p astra-runtime --lib server::run:: -- --test-threads=1 --nocapture: 846 passed, 0 failed, 62 ignored.cargo test --locked -p astra-services --lib runs::tests -- --nocapture: 194 passed, 0 failed, 71 ignored.cargo clippy --locked -p astra-runtime -p astra-services --all-targets -- -D warnings: passed.cargo fmt --all -- --check: passed.git diff --check: passed.Public entrypoint exercised:
create_runandstream_chat, including idempotent stream replay, through the production lifecycle with a fault-injected store.Unhappy paths exercised: delayed acknowledgement with no lease extension, expired receipt, cancellation, wrong generation, missing/dropped heartbeat, lease loss during preparation, replay without a new executor, and existing preclaimed-child cancellation/fencing paths.
Database verification: schema and SQL are unchanged. The new MatrixOne creation/replay test was not run locally, but passed in the CI online services lane on
81fa532b0: 503 passed, includingdatabase_creation_returns_initial_lease_without_granting_it_to_replays. The complete Test Suite, online integration, and MOI compatibility lanes also passed on that head. This does not establish real multi-CN qualification. No local MOI tests or QA operations were performed.Security follow-up: required Static Checks on
81fa532b0passed Clippy and formatting, then failed cargo-audit on three newly published certificate advisories affecting the unchanged upstream lockfile. Cargo regenerated only the three compatible package versions, their checksums, and version-qualified references (+10/-10); the result is byte-identical to fix(deps): update webpki crates for RustSec advisories #1104's lockfile.cargo audit --json, the exact CI entrypointmake audit,cargo metadata --locked --offline --no-deps --format-version 1,cargo check --locked -p astra-core,make format-check, andgit diff --checkpassed. Audit scanned the current advisory database and found no unignored vulnerabilities; existing audit policy is unchanged. The security-fix head57279d39esubsequently passed Static Checks, including the audit and required aggregate, and the complete Test Suite, including all selected online and MOI compatibility lanes.Live-model follow-up on head
57279d39e: attempt 1 completed 17/18; the remainingtask_agent_profile_callablecase was interrupted after its child completed. One unchanged diagnostic rerun, attempt 2, also completed 17/18. The task-profile case and all three failures from the original head passed in attempt 2. Its sole failure was insteadcache_provider_matrix_regression: the initial request and all three follow-up steps completed with exit 0; the explicit alert/ratio composite passed, while the additional hardprompt_cache_reuse_scopecheck failed. That check requires ordered canonical per-execution explain coverage and positive cache reads after the cold turn; aggregate reported cache reads alone cannot establish it. Public artifacts omit the criterion detail and per-turn explain capture, so they cannot distinguish unavailable/conflicting scope evidence from absent post-cold reuse. The precise cause remains unestablished; neither classifier labels nor the changed failing case prove provider randomness or a regression from this PR. No further blind rerun, assertion/timeout/model change, CI exemption, or production fallback was applied. That attempt remained red; its omitted per-turn scope/capture diagnostics prevent establishing the historical failure cause. The current-head result is recorded below.Cache-scope diagnostic follow-up (Astra only):
invalid_progressfor the missing diagnostic type.cargo test --locked -p astra-test-harness --lib -- --test-threads=1: 620 passed. The unchanged acceptance coverage includes cold/warm reuse, unknown creation counters, missing evidence, ordering, and replay boundaries. The new checks retain a warm read witness and distinguish a pending snapshot without certifying it as cache reuse.python3 -m unittest discover -s scripts/ci -p 'test_manual_harness_progress.py': 15 tests, OK (3 existing platform skips), including the real summary subprocess, preserved failing verdict, and rejection of private/malformed fields.cargo clippy --locked -p astra-test-harness --all-targets -- -D warnings: passed.cargo fmt --all -- --check,git diff --check, andscripts/ci/validate_repository.pywith the bundled Python runtime: passed. The system Python lackstomllib; the repository script itself is unchanged.0558d9a0fpassed Static Checks, the complete Test Suite including online integration and MOI compatibility, and live regression, 18/18. The cache case retained four verified execution captures, matching run/session bindings, one scope per execution, and 27,448 post-cold cache-read tokens; its unchanged hard scope check passed. This verifies the safe diagnostic path and this execution of the regression; the previous intermittent failure cause remains unestablished, and the diagnostic-only change is not presented as a production cache fix. No QA access or local MOI tests.Final checklist