Repository navigation
perf(sessions): bound projection queue-head scans per write window - #4793
ScriptedAlchemy wants to merge 65 commits into
Conversation
Avoid repeating ordered scans over permanently parked collision rows for every item in a 32-observation write transaction. Keep strict retry fences, atomic rollback, bounded windows, and restart checkpoints. Refs #4756
|
Bound re-arm write batches to actually retryable rows instead of visiting permanently parked collisions as empty batches on every fresh store mount. Add behavioral coverage for interleaved terminal and deferred queue rows, preserved retry history, and zero no-op batches. Refs #4756
|
Follow-up at d265e31 — Refs #4756, partial restart write-amplification reduction. Root cause: the background store-mount retry re-arm paginated every queue row with a positive deadline, including terminal collision rows whose deadline is The new behavioral regression seeds 12 persisted queue entries (six terminal, three deferred, three already due), asserts exactly three re-arms in two write batches of size two, verifies that terminal rows and error history remain unchanged, and checks that another fresh re-arm finds zero write batches. An independent SQLite execution of the same selection/update showed old = 5 batches / 3 updated rows, new = 2 batches / 3 updated rows, and repeat = 0 batches / 0 rows. This is SQL-level corroboration only, not a Bazel Rust test pass. No checkout or Bazel executable is available in this execution environment, so the Rust regression remains uncompiled here; exact-head CI was queued at review time. This does not establish resolution of the reported 125–160 ms projection writes or four-hour CPU saturation; no macOS end-to-end restart profile is claimed. Keep this PR draft and #4756 open pending that evidence. No changes to #4776, release #4763, other owner branches, or CI policy. |
Capture the last retryable deadline through the reader and stop after its bounded writer window, rather than taking an empty writer transaction at startup or after every completed re-arm. Reject nonpositive batch sizes. Exercise registered writer transaction counters, durable daemon remount, later retries, terminal preservation, and invalid limits. Refs #4756
Use the queue retry deadline index for an inexpensive nonterminal readiness probe. Parked collisions must not acquire a writer on idle drains; new observations still project after such a probe. Refs #4756
|
Published 5466c909 as a narrow additional Refs #4756 improvement (not full issue acceptance). Remaining hot path: after a projection becomes a terminal collision, its queue row remains parked at Fix: the pre-writer probe now checks for nonterminal work and uses a separately installed performance index on Independent checks: SQLite WAL reproduction confirmed that a terminal-only probe returns no work while another connection holds a writer, the new covering index is selected by SQLite, and a subsequently inserted ready row is visible. Synthetic 30K-parked-row query-plan checks showed a covering-index probe rather than a full queue scan; these are not end-to-end TraceDecay CPU measurements. Only This does not prove the reported 125–160 ms historical writes, multi-hour 1.7-core CPU usage, or durable Codex discovery continuation across daemon restarts are resolved. Leave #4756 open and this PR draft. The overlapping #4776 draft, decision-model work, and release #4763 were untouched. |
Use indexed deadline readiness to avoid empty writer transactions while all nonterminal rows await their retry clock. Preserve pending coverage, strict sequence authority, and newly admitted work after the probe. Exercise a persisted terminal + deferred queue across reopening with a concurrent SQLite writer reservation and subsequent durable continuation. Refs #4756
|
Follow-up at Root cause: even after the terminal-only fast path, a queue containing no due observations but one or more deferred retries still entered a SQLite writer transaction on every projection poll. A terminal collision plus deferred nonterminal row is sufficient to reproduce the needless writer lease; repeated polls can contend with foreground session writes without advancing the checkpoint. Fix: query the earliest nonterminal deadline through the PR's existing Falsifiable regression: reopen a real profile SQLite store containing a persisted terminal collision and a deferred observation; hold an unrelated Independent check: an isolated SQLite WAL rehearsal confirmed the read-only earliest-deadline query works while another writer holds a reservation, uses the covering retry-deadline index, and sees a subsequently eligible row. This is SQL-level evidence, not Rust/Bazel or host CPU verification. This is a two-file diff, published via a single-parent, exact expected-old-head, non-force fast-forward from |
Probe the lowest nonterminal observation sequence, not the earliest retry clock anywhere in the queue. A later due row must not acquire a writer while an earlier deferred row fences projection. Keep the probe and batched reads on a partial sequence index excluding permanently parked collisions. Extend the durable reopen regression to prove a later due row cannot bypass the deferred head under another SQLite writer reservation; then project both observations in bounded one-item windows. Refs #4756
|
Published Root cause: the previous read-only projection probe used the minimum retry deadline over all nonterminal rows, not the first nonterminal observation sequence. If sequence 2 was deferred but sequence 3 was already due, each idle poll still took a SQLite writer lease and committed an empty projection window despite sequence 2 fencing the later row. Many terminal parked collisions also imposed repeated ordered-prefix work. Fix: probe the lowest nonterminal sequence and compare its deadline. Use an indexed partial active-sequence lookup excluding permanent Regression: extended the real profile-store restart test with a third, already-due observation behind an earlier deferred one. Two polls while an unrelated connection holds An independent SQLite rehearsal with 30,000 parked rows confirmed the old earliest-deadline probe returned the later due row, the sequence-head probe returned the deferred row, and This single-parent commit was applied by exact expected-old-head, non-force fast-forward, changing only |
Skip ordinary projection while the canonical rebuild fence is active, without taking an idle SQLite writer transaction. Exercise pending status under a competing writer and resumed durable projection after the fence clears. Refs #4756
|
Follow-up 71195bb7 — Refs #4756, partial write-amplification reduction only. Root cause and fix: When the canonical Behavioral regression: Verification: Independently reviewed the exact two-file commit diff. A separate SQLite WAL reproduction confirmed the active-fence probe result, partial sequence-index plan and writer-lock behavior, plus immediate visibility after fence removal. This is SQL corroboration, not a Rust/Bazel pass or macOS CPU profile. Hosted CI on this exact head is queued; local Bazel/checkout are unavailable. No Cargo used. Keep this PR draft, #4756 open, and do not claim resolution of the reporter's 4-hour CPU saturation, 125–160 ms writes, or durable Codex in-progress discovery across restarts. Peer issue branches, held #4776/Kev decision-model work, release #4763, CI policy, and infrastructure were untouched. |
Apply exact rustfmt_check_2024 hunks to the projection restart regressions without changing behavior or weakening any checks. Refs #4756
|
Follow-up 348d92f8 — Refs #4756, CI repair only (not issue acceptance). The exact preceding-head Bazel workflow 42452435228 failed its PR remains draft and #4756 remains open. No modifications to held #4776, Kev/decision-model PRs, release #4763, other owner branches, or infrastructure. |
Name the terminal collision sentinel in all queue SQL. Read the first nonterminal sequence through the partial index, then apply the dynamic deadline check without a second queue-head scan. Exercise the typed queue reader across deferred heads and restart. Refs #4756
|
Follow-up source/CI repair at f7e4a6e7 and formatting-only aadc35a4 — Refs #4756, not full incident acceptance. Exact failing gate: hosted Bazel run 42456607785 passed rustfmt but failed Fix: Name the terminal sentinel as the identical SQL integer literal in all eight queries, adjusting the bind positions without changing semantic retry limits. The typed Review: GitHub compare verifies an exact-head, nonforce single-parent fast-forward from New exact-head CI 42462245774 is queued. Do not merge: PR stays draft, issue #4756 stays open until Rust tests, durable mid-scan Codex restart continuation, and incident-scale CPU/writer performance are demonstrated. No change to mixed draft #4776, Kev/decision-model PRs, or release #4763. |
Exact-head verification blocker — Refs #4756The 2026-11-08 CI run #42468061476 is Keep this PR as the issue-specific partial |
|
Refs #4756 — published 50d28225 on existing issue-specific PR #4793 with expected-old-head Additional source-rewrite write-amplification cause: a source-presence row may remain after its The fix selects an unoffered row for retirement only if it has a materialized observation without a disposition or an accepted queued revival requiring cancellation. A queued revival remains selected even with a missing observation. Already-disposed rows stay excluded. The authoritative final DELETE still settles all stale source-presence rows, and the entire completion keeps its existing atomic rollback semantics. The previously registered Independent SQL mechanism reproduction (SQLite, exact candidate predicates with primary-key indexes): 10,003 presence-only records produced 20,022 SQLite statements in the old per-record completion loop versus 6 after skipping no-op candidates; both deleted every stale presence row and passed New remaining bounded-write risk for review: if a rewritten source actually has many materialized, undisposed observations, Exact-head hosted Bazel run #42618257339 is queued. No local Bazel checkout/executable was provided; no Cargo and no claims of a new Rust test pass. Keep PR review/merge hold and #4756 open: cross-restart Codex mid-scan durability and the incident-scale CPU/125–160 ms write-latency acceptance are not yet proven on master. Protected #4776 / Kev drafts, release #4763, other owner branches and schedules untouched. |
Refs #4756 Commit each 128-record retirement page and delete its stale presence entries in the same writer transaction. An interrupted completion retains the remaining presence rows as its durable continuation frontier. Exercise real projected records, injected provenance failure, registered store reopen, and bounded transaction counts for presence-only history.
|
Refs #4756 — published Root cause: source-rewrite completion used paginated SELECTs but retired all eligible observations and deleted all old source-presence records in a single SQLite writer transaction. A large real source could therefore exhaust the writer's fixed lease; a late provenance error discarded hours of completed work, causing the next run to replay every retirement. Fix: consume all old-generation source-presence rows in 128-record writer windows (including ghosts and already disposed records); run retirement only where there is a live, unsettled observation or an accepted revival; delete exactly the processed old-generation key range in the same transaction; commit before fetching another page. Source presence plus the existing pending-rewrite row now form the durable restart frontier, without a new table, temporary staging file or pinned WAL snapshot. A failed page rolls back, while earlier committed pages survive for retry/restart. The final page removes the pending rewrite marker atomically. The source-generation guard is rechecked in every transaction. Nonvacuous registered-store regressions: 10,003 presence-only records must complete in exactly 79 committed <=128-record pages and without per-record redundant writer SQL; the real 1,005-projected-record fixture injects a provenance collision in the final page, requires previously committed dispositions/provenance cleanup to remain durable, closes/reopens the registered profile DB, and verifies the next completion retires only the remaining observations, preserving the reoffered survivor and final cleanup. The prior whole-source rollback assertion was updated to the new per-page atomicity contract; the failure and final-state assertions remain. Independent SQLite 3.46.1 reproduction (not a Rust test): indexed page query and delete matched the production SQL. A 1,005-row workload failed on the last page after 7 committed pages / 896 dispositions; reopening the DB retained the pending rewrite and frontier, then retired the remaining 108, yielding 1,004 dispositions, one retained survivor, zero pending rewrites and Verification status: exact-head Bazel CI #42621820543 is queued; Bazel and the Rust toolchain are unavailable in the local execution environment, so no passing Rust test result is claimed. This is a focused, reviewable partial fix, not |
|
Refs #4756 — published 6aab5111 on existing issue-specific PR #4793 by expected-old-head Actual CI blocker cleared in source: exact-head run #42621820543 failed New exact-head hosted Bazel run #42635755194 is queued; require fresh nonvacuous global DB tests plus CI and review before merge. No Bazel runner is installed in this authoring environment; no Cargo used. Durable Codex mid-directory restart continuation and measured four-hour CPU/profile writer-latency acceptance remain unproven. This is not Fixes #4756; keep the issue open and the PR under merge hold. No other branches, protected drafts, release #4763 or schedules were changed. |
Refs #4756. Bound the repeated SQLite reads and deletes in large source rewrites while preserving durable per-page progress and an end-of-sweep recheck for concurrent older offers.
Refs #4756. Match the three-field transactional completion return on superseded source generations.
Refs #4756. Only a resumed seek needs to recheck earlier source keys before settling; a first-page completion sees the whole source under its SQLite writer lease.
|
Refs #4756 — source-rewrite survivor-prefix keyset repair, published on this PR at Independent review found that the new 128-record retirement pages were still selecting and deleting from the beginning of the
New registered-store Rust regression measures the actual writer's SQLite VM steps, with 4,096 surviving records preceding 127 versus 1,023 obsolete records. It also checks exactly one versus eight committed retirement pages and verifies all survivors remain while all older presence rows disappear. The growth threshold fails the original prefix-rescanning algorithm in an independent SQLite approximation. Independent SQLite reproduction (not a TraceDecay end-to-end run): for the same primary-key layout, empty observation/queue tables, and the equivalent query shape, 1,023 older records cost 311,510 → 98,580 approximate VM steps over eight pages (~3.16× less); 127 older records cost 49,682 → 49,696 in one page, with eight/one page counts unchanged and zero older records left. Instrumentation used SQLite's progress callback at every virtual-machine operation; these are model results, not production latency measurements. The exact-head Bazel workflow is queued; no new Rust test pass is claimed, and local Bazel is unavailable. The PR remains unmerged. This is partial only: Codex mid-directory restart position and the reporter's four-hour CPU / 125–160 ms end-to-end write-latency acceptance are still open. No protected draft, release, another owner's branch, CI policy, or schedule was modified. |
Refs #4756 Release the first writer handle before reopening the profile database to satisfy Clippy without changing the restart regression. Seed the 10,003 presence-only rows in bounded SQL windows rather than one writer dispatch per row, retaining the over-cap page and statement-count assertions.
|
Refs #4756 — published Inspected the latest exact-head Bazel run #42643202619, including both failed jobs:
Only |
Refs #4756 A restart can begin an already pending source generation again. Do not rewrite its unchanged presence rows or accepted queue revivals under a writer lease. Preserve updates for genuinely newer generations and cover both paths with abort-on-no-op registered-store triggers.
|
Refs #4756 — published New repeated-restart writer-amplification mechanism: Focused source fix: both indexed UPDATEs now exclude entries already on the target generation ( Falsifiable registered-store Rust regression: An independent SQLite statement/trigger reproduction verified the old same-generation UPDATE fails and the guarded version succeeds; that is SQL-level mechanism evidence, not an executed Rust/Bazel regression or incident-scale benchmark. The new exact-head hosted Bazel run has not yet established a passing Rust result. The preceding run #42660546473 was still running when inspected. Retain the review/merge hold; #4756 remains open. Still missing for full acceptance: durable Codex mid-directory restart continuation (the current |
|
Refs #4756 — new exact-head CI execution blocker, not a code/test failure diagnosis. Reviewed current master Hosted Bazel run #42669877759, attempt 1 finished failure even though Repository gates and Feature gates passed: the The previous complete Linux fleet run #42643202619 had a timeout in the pre-optimization >10k-row fixture and two transport acceptance failures; the subsequent fixture repair and no-op generation update still require exact-head, nonvacuous Bazel confirmation. The transport failures should not be attributed to #4756 without isolating them against master. Remain blocked from merge/closure: passing exact-head Rust/global-DB tests and independent source review, durable Codex mid-directory restart continuation, plus incident-scale provider-attributed CPU and 125–160 ms writer latency before/after measurements. Existing PR stays open, Refs #4756 only; no new production changes or branch ref moves this run. Protected drafts, release #4763, and other owners' work untouched. |
|
Refs #4756 — partial repeated-restart writer-amplification fix published at Root cause: Source: make the conflict update conditional on a genuine generation or retained-offset change. The real pending rewrite marker is still inserted on first use, and new generation/retained-offset transitions still update it. No schema or budget changes. Regression: extended the existing registered-store Published with exact expected old head |
|
Refs #4756 — new exact-head Bazel verification blocker; PR remains under merge hold. Inspected Observed failure (not an inferred assertion failure): Linux fleet job 129445801501 ran Bazel's Isolation needed: establish which of the 16 non-completing global-DB tests is holding the suite, especially whether the new real projected-record multi-page restart fixture (1,005 observations) is expensive versus an unrelated slow fixture or fleet contention. The existing 10,003 presence-only fixture is now seeded with 79 statements, but this run still timed out; the previous fixture optimization alone did not establish a passing global-DB suite. Avoid reducing the test's multi-page restart/rollback acceptance or increasing the timeout without measured attribution. Use focused, nonvacuous Bazel test execution and source diagnosis; Cargo is forbidden. No new source change, CI weakening, merge, protected draft/Kev/#4776 change, release #4763 change, or other owner's branch/schedule mutation. Do not merge #4793 or close #4756. The Codex mid-directory durable continuation and incident-scale provider-attributed CPU / 125–160 ms profile-write improvements remain unproven on master. |
|
Refs #4756 — reviewed and published cd990101 as an exact-head, non-force fast-forward from CI diagnosisI downloaded and hash-verified Linux artifact 13714603374 from run 42696633132: SHA-256 Published correction
For the 256-row fixture, setup falls from 1,024 SQL submissions to 8; the 260-row fixture falls from 1,040 to 12. These are statement counts, not a measured Rust wall-clock speedup and not proof that the complete suite now finishes within its limit. VerificationAn independent SQLite 3.46.1 differential reproduction compared the old scalar and new rowset SQL in 11 cases (empty, mixed due/deferred, exact page boundaries and multi-page fixtures through 514 rows). Every table's stored rows, sequence identities and ordering matched exactly, including escaped/unicode text. Foreign-key checks and integrity checks passed. A duplicate receipt injected on the final page of a 260-row setup rolled the entire transaction back, leaving all four tables empty. These are SQL mechanism checks, not repository Rust execution. The detached Git commit was separately diff-reviewed before the expected-old-head This removes avoidable cumulative fixture overhead, not a confirmed production re-import fix or proven resolution of the suite timeout. Keep the PR unmerged and #4756 open pending actual hosted results, durable Codex mid-directory continuation and incident-scale CPU/write-latency acceptance. Protected #4776/Kev drafts, release #4763, other owners' branches and task schedules were not modified. |
Refs #4756 Replace four serialized SQL submissions per fixture observation with four statements per ordered 128-row page. Keep typed receipts, observations, source cursors, queue ordering and a single atomic setup transaction. Assert each statement inserted every expected row; preserve all existing recovery cases and their assertions, including writer-work measurements. Independent SQLite differential checks preserve exact rows and rollback. This removes fixture overhead; it does not establish a full Bazel pass or resolution of the reported historical-import incident.
Read one bounded lookahead identity so exact 128-row multiples settle their pending rewrite marker in the last productive page. Keep each retirement and delete page capped at 128 rows and recheck behind the keyset cursor after resumed pages. Add real registered-store regressions for 128, 256 and 257 unoffered identities, verifying commit counts, marker retirement and surviving current-generation presence. Refs #4756
Truncate the staged page to the committed limit rather than ignoring Vec::pop's must-use Option; retain the one-row lookahead invariant. Refs #4756
|
Refs #4756 — published a bounded source-rewrite tail fix to this existing issue-specific PR, without touching other work.
Nonvacuous registered-store regression: seeds 128, 256 and 257 obsolete presence identities plus one current-generation survivor, runs the real completion API, and asserts exactly 1, 2 and 3 committed writer transactions, respectively, with all obsolete identities deleted, the survivor preserved, and the pending marker cleared. The former implementation fails the first two transaction-count assertions. Independent SQLite reproduction (not Rust/Bazel): 128 obsolete rows took 2 → 1 transactions and 256 took 3 → 2; 127 and 257 stayed at 1 and 3, respectively. All cases preserved five current-generation survivors and retired every obsolete identity. Both commits were published by exact-head, non-force fast-forward to #4793 (head now Partial only. Durable Codex mid-directory restart continuation and incident-scale four-hour CPU / 125–160 ms writer acceptance remain unproven. Keep the PR unmerged and issue #4756 open. No protected drafts (including Kev/#4776), release #4763, CI policy, other owner's branches, credentials, tags, production/infra or schedules were changed. |
Refs #4756 Retirement previously upserted the same session-temporal reset once for each projected observation under the bounded SQLite writer lease. Batch retired effect IDs per page and DISTINCT their sessions before the reset, retaining the same transaction, cursor, per-observation provenance checks, and rollback semantics. Add a registered-store trigger regression that fails on the old repeated update and checks all records retire exactly once. SQLite multi-session and trigger SQL reproduced independently. Bazel verification remains required; no incident-scale acceptance is claimed.
|
Refs #4756 — published Additional write amplification root cause: Focused repair: per-observation provenance, ownership, disposition and projection retirement remain unchanged. The source-rewrite completion caller collects only successfully retired identities per page and calls the existing session-temporal store authority's new Nonvacuous registered-store regression: four real projected observations of one session are persisted, source presence is recorded, and the actual rewrite completion runs with a SQLite trigger that rejects a second UPDATE of that session's reset row. The old per-observation path would fail on observation 2. The new path must retire all four observations, create exactly one reset row, clear every stale presence identity, and clear the pending rewrite marker. Existing larger multi-page rollback/restart and per-record provenance regressions remain unchanged. Independent SQLite verification, not Bazel evidence: 1, 4 and 128 candidate IDs with same/multiple session owners passed the new CI / merge hold: exact-head hosted Bazel run #42731245831 is pending. There is no Bazel workspace or Rust toolchain in this runtime, so this change has not yet passed Rust compilation, formatting, Clippy or the nonvacuous regression. Do not merge without these. Durable Codex mid-directory restart continuation and four-hour incident-scale, provider-attributed CPU/write-latency acceptance are still outstanding. Keep issue #4756 open, Reviewed the fresh root AGENTS.md; repository recursive tree had no nested AGENTS.md. Reviewed issue body and both comments, master and merged #4848, #4793's reviews and CI; all five prior review threads remain resolved. Protected #4776/Kev drafts, release #4763, other owners' branches and schedules untouched. No Cargo, Kody, Copilot, delegation, CI weakening, production, infra, tags or credentials. |
Refs #4756 Seed all 1,005 real projected observations in 128-item admission and projection windows before the late-page source-rewrite collision. Retain the same source cursor chain, durable restart regression, record volume, and assertions. Avoid a single oversized fixture writer transaction. The timeout is not yet attributed to this setup; Bazel CI is required.
|
Refs #4756 — published Focused regression-fixture correction: The 1,005-real-observation restart regression formerly performed its entire precondition through one The regression now calls the same production-path helper in eight ordered contiguous ranges of at most 128 observations, preserving the full 1,005 rows, canonical source cursor chain, final-page provenance collision, committed-page rollback, database reopen, and all existing durable-restart assertions. An explicit nonvacuity assertion checks all 1,005 records are seeded. No production source, CI deadline, threads, expected output, or test count changed. Independent diff review verified exactly one test file and a single 9-line replacement; the Keep this PR unmerged and #4756 open. Durable mid-directory Codex restart continuation and the reporter's four-hour 1.5–1.8-core/125–160 ms write-latency acceptance remain unproven. Protected draft #4776/Kev, release #4763, concurrent owner branches and schedules were untouched. |
Refs #4756 Apply the single exact Bazel rustfmt hunk from CI 42736729359. Preserve the nonvacuous 1,005-observation restart test and all assertions.
|
Refs #4756 — published 0099fe6b on this existing issue-specific PR, with an exact expected-old-head Confirmed CI blocker: Bazel run 42736729359 failed its Repository gates because the pinned Correction and independent review: the published commit applies the exact formatter output and changes one assertion's formatting in one file (+5/-1 lines), preserving its failure semantics, fixture count, bounded 128-record setup, restart/rollback tests and production behavior. Compared the full immutable parent blob, reviewed the detached commit's only file patch, and verified GitHub reports the intended new PR head. No tests or timeouts were loosened; no Cargo was used. New exact-head Bazel run 42742041492 is queued; no Rust test/Clippy pass on this head claimed. Durable Codex mid-directory restart continuation and incident-scale CPU/write latency remain unproven. Keep PR #4793 unmerged and #4756 open until those requirements pass on master. Protected #4776/Kev drafts, release #4763, other owners' branches and existing schedules are untouched. |
|
Refs #4756 — new exact-head Bazel CI blockers, not yet a proven source regression (2026-11-10). Reviewed current At exact PR head
The published issue-specific PR still includes bounded source-presence/rewrite/retry work and restart regressions, but no exact-head full Bazel pass or reporter-scale 1.5–1.8-core / 125–160-ms write-latency proof. Durable Codex mid-directory position also still disappears on daemon restart; the whole-sweep V2 frontier cannot claim intermediate continuation. That requires a separately justified safe durable state/identity design, not an invented scan-resume claim. Merge/closure HOLD: #4793 remains unmerged and #4756 stays open; Refs only. Windows and Linux aggregate had not completed at last check. The blocker is now isolating the timed-out global-db test(s), distinguishing the MCP readiness failure from baseline load, and obtaining nonvacuous Bazel behavior on the exact source head. No Cargo, CI weakening, speculative push, forced branch movement, drafts/Kev/#4776 merges, release #4763 changes, production/infra/tags/credentials, other-owner edits or schedule changes. |
Refs #4756 — partial session re-import performance repair (verification pending)
On
3e6aa1f5cd, the workspace rustfmt gate and all 518 native global database tests passed, including the newly added rewrite-queue regression.Not
Fixes #4756. This PR removes measurable SQLite projection-queue amplification and adds restart/batch regressions. It does not yet prove durable mid-scan Codex continuation or the reporter's four-hour high-CPU and 125–160 ms profile write problem resolved.On
5aa785428ball 515 native macOS global database tests passed, including retry deadlines that become due during recovery and the source-presence batching regression. The old test expected a transaction telemetry counter to measure individual SQL statements and failed on the real registered writer. A SQLite trigger now observes the executed statement boundaries on that writer. For 257 new records it measured pages of 128, 128 and 1. A second trigger rejects redundant updates on identical reoffers. The test also verifies that a malformed last page rolls back earlier pages and that the final offer for a duplicate identity wins. The final commit89bd943319also reran the full 515-test global database suite successfully, and both the repository-wide formatter and strict library/test Clippy targets passed.On
c3ddf7348c, the registered SQLite writer also measures every executed statement. Both 257 fresh offers and 257 identical reoffers execute exactly three page statements above the measured transaction baseline. Injecting an extraSELECT 1into the reoffer transaction made the regression fail (5 statements versus 4); restoring the production code passed. The complete global database and SQLite runtime suites passed 515 and 426 tests respectively. Repository formatting and strict Clippy passed.Root causes addressed
idx_projection_queue_active_sequenceunder its query-planner stability guarantee. The retry-deadline index and historical-data index installer permit nonterminal probes without scanning the terminal prefix. Repository-level next-head reads and projection-frontier repair use the same sentinel predicate.Behavioral regression evidence
BEGIN IMMEDIATEreservation verifies that empty, terminal-only, deferred-head and rebuild-blocked projection polls do not acquire a competing writer; releasing the fence or admitting a new observation resumes durable progress.Verification and remaining acceptance
At
b7cd1afd02, the original projection queue definition is byte-identical to master. Retry ownership uses a separate table whose rows follow the queue entry by foreign key. The deadline and its owning mount commit in one writer transaction. A saved queue from the shipped schema reopens and resumes without a reset or queue alteration. A queue missing its required retry counter is refused without modification. Injecting an ownership-write failure rolled the scheduling transaction back and preserved the previous retry. The full registered database suite passed 513 cases on macOS and the session suite passed 37 projection integration cases. Both affected Clippy targets, Rust formatting, and the query plan checker for 16 partial indexes passed. Hosted Linux run · Schema reviewAt
09a27629fe, the complete registered global database suite passed 511 cases on macOS, and 37 observation-projection integration cases passed. The tests exercised opening a database saved with the prior queue schema, preserving a live retry across recovery pages and physical rowid reuse, a successful WAL restart checkpoint between pages, and resuming an interrupted recovery. The SQLite plan checker passed for all 16 partial indexes, along with its six tests, Rust formatting and affected Clippy targets. The latest source stages at most a single page in memory and writes no candidate file. It supports queues that exceeded the former whole-backlog staging limit. Review discussionAt
84bf09170c8783507f46bd7b137b64a50dc8ad53, the complete//crates/tracedecay-global-db:unit_testsuite passed all 504 tests on macOS in 58.01 seconds. All 37//crates/tracedecay:session_suiteobservation projection integration cases passed, including the 10 queue and restart cases. The repository SQLite plan checker passed for all 16 partial indexes, and its six self-tests passed. Exact-head hosted CI.With QPSG enabled on SQLite 3.54.1, a four-row update of a dense 100,000-row retry queue fell from approximately 700,100 VM instructions to 200. The empty read-side probe used the covering deadline index on an analyzed 100,000-row expired queue. The native writer regression expands 32 deferred observations to 256 under a fixed four-row batch. It fails on the earlier implementation (3,160 to 75,456 steps) and passes after the change.
Codex’s process-retained partial discovery position still does not survive daemon restart. Per-source admission amplification, the reporter’s repeated-restart profile, and measured end-to-end CPU and write latency remain open under #4756. This PR is ready for review to enable Linux CI. Keep the existing merge hold pending substantive review and hosted checks. Keep its queue changes separate from held mixed #4776, decision-model drafts and release #4763.