Repository navigation
Description
Problem and scope
Continue the persistence simplification after #1182, starting from current main 1226b37e336ef80f1ac64aea71ca4e12ef1444c5. This is a combined storage-design and product-retirement wave, covering hot-path SQL, inefficient queries/schema/indexes, and low-value tables with their complete owning logic. It must be comparable in system scope to #1182, rather than another small index-only PR.
The complete current source inventory has 121 table declarations. agent_runs still combines 50 control/identity/recovery columns, including several large serialized bodies, with frequent cursor/lease/status updates. Event tables carry many indexes. Remaining legacy snapshot/decision/harness diagnostic products need a caller and value audit before any retirement decision. These observations are source facts, not measured physical write-amplification results.
Existing work and boundaries
- refactor(storage): retire redundant state and optional product chains #1182 is merged: its retired tables/products must not be recreated or counted as new savings.
- [Feature]: Consolidate durable execution boundaries to reduce non-model turn latency #1119 tracks durable-boundary consolidation and [Bug]: A single hi turn incurs 200+ SQL operations and ~20 transactions, with seconds of non-model latency on QA #1124 records older latency evidence. This issue additionally owns the next complete schema/query/product simplification scope. It does not claim that the historical 208-query baseline still represents main, nor that [Feature]: Consolidate durable execution boundaries to reduce non-model turn latency #1119's 3x acceptance target has been met.
- Existing event batching, batched idempotency reads, on-demand observation coalescing and bounded ingestion remain the canonical owners. No second cache, scheduler or authorization state machine.
Acceptance
- Read/write/caller and ownership map for the remaining schema, with concrete retained/optimized/retired dispositions.
- A coherent substantial delivery spanning hot-path SQL and schema design plus justified low-value business-chain removal; no padding through test lines or arbitrary feature deletion.
- Preserve canonical conversation/Context custody, provider attempt/billing identity, Run recovery, owner isolation, cancellation, deletion fences, idempotency, rollback and explicit lock ordering.
- Fresh same-version deployments only; no compatibility layer, migration/new version marker, relaxed timeout or hidden fallback.
- Full closure for retired schema/index/bootstrap/cleanup/worker/API/SDK/UI/config/test/documentation paths, with explicit product loss.
- Before/after real MatrixOne evidence for changed mechanisms and bounded sustained 100/1,000-Session scenarios where applicable. Report offered/committed/rejected work, foreground interference, lock/pool wait and latency; do not equate a finite burst with sustained capacity or infer an unmeasured engine-write multiplier.
- Affected static/lint checks, owning unit tests, real DB unhappy paths and supported concurrency validation; exact source fingerprints and limitations. Explicit gpt-6.1-terra/max design and final overall review before PR delivery.
No deployment, production data changes, merge, or CI rerun/wait is part of this work.
Activity
perf(storage): shrink Run writes and retire redundant products
perf(storage): shrink Run writes and retire redundant products (#1187)