Skip to content

fix(runtime): bound execution and preserve cancellation progress - #1200

Merged
XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/issue-1199-execution-convergence
Nov 3, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/issue-1199-execution-convergence

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Capability assessment: Updated: Shared CLI/Server cancellation distinguishes accepted intent from proven executor settlement; child inspection exposes bounded partial activity. Bash background projection uses the resolved executor authorization. Runtime lifecycle, session observability and Edge execution references are updated.

Summary

Long turns could renew their own allowance, reject ordinary completion, lose useful partial results, and repeatedly write cancellation requests while execution and Session ownership diverged. Keep a finite admitted allowance and converge cancellation through the existing Run, Session and invocation owners.

  • Remove ordinary mutation/observation completion obligations and budget renewal. Preserve explicit Work validation, caller-declared checks and physical execution custody.
  • Freeze the root timeout from actual loaded configuration (default 300 seconds). Observe cancellation without repeated writes, retry typed owner recovery within one deadline, and recheck final Session cancellation under its admission fence.
  • Preserve provider/child partial text, exact identities, applied guidance and conservative accounting on cancellation and failure. Share terminal housekeeping without invoking successful rendering or checkpoints on cancellation.
  • Recover canonical C0/C1 results in bounded batches and page child activity from existing owner-scoped C3 events. Report partial coverage rather than claiming a complete transcript.
  • Align Bash capability projection and compound-command timeouts with execution. An undeclared opaque shell command no longer invents project-validation debt; existing validation freshness and custody remain independent.

Related issue

Refs #1199. Canonical history compaction and stale-live TUI reconciliation are owned by #1196 and excluded here. This PR does not close the entire issue or claim reproduction of the original 26-minute provider stall.

Change type

  • Bug fix
  • Refactor or performance improvement
  • Test
  • Documentation

User and compatibility impact

Ordinary turns can finish without artificial write/observe obligations. Incomplete and cancelled turns retain useful partial output. Cancellation stays pending until physical execution and durable ownership are settled; an unavailable owner is not treated as proof of exit. Child activity reads are bounded and explicitly partial. No history migration or compatibility shim is introduced; obsolete checkpoint fields are removed. The frozen MOI chat API is unchanged.

Architecture and complexity delta

  • Canonical owners extended: shared turn loop, Run terminal receipts/C1, Session admission transaction, existing invocation ledger, and CLI Edge execution.
  • Existing direct/remote child delivery, replay, capability projection and cancellation callers are updated together.
  • Remove superseded completion obligations, renewals, checkpoint fields, adapters and tests of retired behavior. Total delta: 59 files, +5,628/-9,786 (net -4,158 lines).
  • No new scheduler, state table, per-tool trace writes or replay copy. Recovery uses capped streamed batches; activity uses indexed, owner/run-scoped bounded reads. Work validation is derived at its current boundary, without a cross-session cache or persisted state.

Verification

Base: c2e4ea411; tested head: 6a72b4693. CLI, Server and harness were rebuilt from that clean commit, checked for embedded SHA/dirty status, hashed and sealed before the final live run.

  • Incremental SCA: eight affected packages checked earlier; all subsequent Runtime/CLI changes passed cargo clippy -p astra-runtime -p astra-cli --all-targets -- -D warnings. Formatting and git diff --check pass.

  • Unit tests: initial affected library matrix produced 17,430 passes and exposed an obsolete finite-budget assertion, corrected and verified in the subsequent full Runtime/CLI run (5,910 passes). Its sole timing-sensitive cancellation fixture was replaced with a semantic deadline control; all 13 cancellation tests pass. Final Work validation/settlement suite: 37/37. Both new observable Work regressions failed against the old production code before the correction. The added receipt-priority regression also failed against 8c4d7f4ee, then passed with the correction, including typed rejection of delivery after an observed change.

  • Actual race instrumentation: nightly ThreadSanitizer with rebuilt std passed cancellation, spawner, terminal materialization and canonical DB scopes. Final affected Work run: Runtime 308, CLI 78, ThinClient 13 passed, no race report. Scopes overlap earlier runs and are not summed as distinct tests. Baseline nightly macro warnings remain; stable Clippy passes.

  • Real MatrixOne: 12/12 isolated-schema tests pass: canonical commit/cold replay, multiple admissions, owner/activity isolation and paging, held Session fence, stale-local/live-remote lease, and cancellation/admission barriers. No database boundary changed afterward.

  • Full original local harness (sealed 5a4ccb6c7, before the final Work correction): DeepSeek-v4.1-flash, 75 original available cases: 68 passed / 7 failed. Seven additional originals require old GLM-5.2/Qwen3.7 credentials returning HTTP 401; retain them as unavailable. The shallow-history setup failure was rerun unchanged with complete history and passed.

  • Fresh targeted harness on 8c4d7f4ee: 7/8 passed on that earlier commit: five corrected, same-semantics modern-model diagnostics all pass; the original news Work failure and an adjacent Work journey pass. The remaining strict case rejects one premature settlement after the model reads before Work genesis; it recovers and completes, but its no-rejection criterion correctly remains failed. The previous invented validation debt and unrelated cargo check are absent. In this one news trial, execution changed from 224.6 seconds/incomplete to 53.7 seconds/completed; this is not a throughput benchmark.

  • Final-head public control: the unchanged original news Work case passes 1/1 on clean 6a72b4693, using the same DeepSeek-v4.1-flash root/judge and two-model registry. It completes in 12 rounds without an unrelated build; a recovered pre-existing Bash policy rejection remains visible in the trace.

Remaining harness evidence and scope limits

These results are not an all-green harness claim, and diagnostic variants are not added to the original score.

  • Original failures also include provider punctuation differing from an exact marker, a model declaring four initial items instead of two, and a pre-existing cancellation/tool same-batch ordering ambiguity. They are not hidden by retries or weaker assertions.
  • The retrospective oracle expects JSON /run_id, while the supported introspection result is a paged artifact with the correct previous-Run header.
  • Of the other two valid modern-model diagnostics on sealed 5a4ccb6c7, one returns the correct integer but spawns an extra unwanted child; the other returns both correct fanout markers but cannot prove the oracle's exact logical-round count: the unchanged canonical terminal projection no longer carries the legacy turn_evaluation field. Missing proof remains unavailable, not passed.
  • Required design and final overall review: gpt-6.1-terra / max, accepted on exact commit 6a72b4693 and diff fingerprint 1d16ab6462b9181afc9f25e70f263bbc996561930b94a666bf634456b4fe698c, with no unresolved material introduced blocker. CI results are pending.

Final checklist

  • Tests exercise owning layers and failure/cancellation/concurrency boundaries.
  • Public/design documentation is updated.
  • The diff excludes credentials, private endpoints and generated artifacts.
  • The title follows Conventional Commit format.

Keep one finite admitted budget and remove ordinary completion obligations.
Converge cancellation with existing Run and Session fences, retain partial
results through canonical recovery, and expose bounded child activity.
Align Edge capabilities and compound shell timeouts with execution.

Refs matrixorigin#1199
@XuPeng-SH
XuPeng-SH force-pushed the fix/issue-1199-execution-convergence branch from 555e0b7 to a905f41 Compare November 3, 2026 02:30
@XuPeng-SH
XuPeng-SH merged commit 70b1fe5 into matrixorigin:main Nov 3, 2026
@XuPeng-SH XuPeng-SH mentioned this pull request Nov 3, 2026
8 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant