Repository navigation
perf(sessions): backfill historical transcript facts after readiness - #194519
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: blocked before merge. What this changesThis PR gradually fills missing historical transcript facts through background SQLite transactions after Gateway readiness. Example: An existing SQLite session has 34,153 active events with missing facts.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep this PR open: it delivers the planned historical backfill, but introduces a concrete Kysely guard failure that needs a focused repair. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherGateway startup hands admitted databases to idle maintenance, which sends bounded backfill commands through the existing database worker and stores derived facts consumed by transcript hydration. flowchart LR
A[Gateway readiness and recovery] --> B[Idle maintenance scheduler]
B --> C[Background writer admission]
C --> D[Database worker]
D --> E[Canonical transcript rows]
D --> F[Derived transcript facts]
F --> G[Transcript hydration]
E --> G
Technical reviewBest possible solution: Retain the existing scheduler and worker design, replace the raw identifier reference with a typed Kysely reference, and complete the recorded integration validation. Do we have a high-confidence way to reproduce the issue? Source confirms that existing historical facts can remain missing, and the supplied synthetic owner measurements demonstrate the resulting hydration cost; no target code was executed during this review. Is this the best way to solve the issue? The design addresses historical coverage at the existing maintenance and writer owners, preserves canonical payloads and fallback behavior, and needs no additional manager or persisted cursor. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4f132c9f661b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +444, Tests +322, Docs +88, Other +666. Total +1520 across 23 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 7, 2026, 1:50 AM ET / 06:50 UTC. |
97b2aee to
b2ba6a8
Compare
|
ClawSweeper status: applying reviewed decision. I am applying the reviewed decision for this pull request: perf(sessions): backfill historical transcript facts after readiness This is item 1/1 in the current shard. Shard 1/1. This transient lease prevents a newer review from overlapping label, comment, or close mutations. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05086c6c7e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| backfill = createSessionTranscriptFactsBackfill({ | ||
| database, | ||
| assertCurrent, |
There was a problem hiding this comment.
Use in-memory authority checks for recurring backfill batches
During a historical backfill, this passes the startup database guard into every worker operation. That guard calls assertExistingDatabaseIdentity() (server-startup-session-migration.ts:94–97), which performs statSync() on the Gateway main thread; the worker client also invokes the guard during admission. Consequently, the new recurring pass repeatedly performs blocking filesystem I/O while serving live traffic, outside the worker's transaction budget. Use the retained owner's in-memory admission/generation checks here and preserve physical replacement detection at the worker admission boundary. This also violates the scoped Gateway rule that authority revalidation use the owner's in-memory revision rather than disk.
AGENTS.md reference: src/gateway/AGENTS.md:L12-L12
Useful? React with 👍 / 👎.
Fill existing schema-41 active-event facts through paced background worker transactions after recovery. Reuse writer derivation and foreground admission; resume from facts without new stored shape. Historical sessions regain cheaper non-resident hydration once covered. SQLite only; PostgreSQL retains its current fallback. Regression coverage requires 322 net test/support lines for historical coverage, invalidation interleavings, cold restoration, post-ready scheduling, and drain; allocate exactly those lines. Requires Peter approval before merge or deployment.
Keep the writer-derived facts query unchanged while using the owning Kysely expression builder for the active-row eligibility reference. This satisfies the raw-identifier guard without another allowance.
Start normal database backfill from the existing post-ready task without waiting for global idleness. Keep restart recovery and drain gates, use background writer admission, cap duty cycle and back off on lock contention. Prioritize recently active paths and retain one worker client for each pass. Regression proof covers progress during live work, post-ready registration during background work, recent-path ordering and worker-client reuse. No schema or stored-shape changes.
fe435de to
6a55bbd
Compare
…penclaw#194519) * perf(sessions): backfill historical transcript facts after readiness Fill existing schema-41 active-event facts through paced background worker transactions after recovery. Reuse writer derivation and foreground admission; resume from facts without new stored shape. Historical sessions regain cheaper non-resident hydration once covered. SQLite only; PostgreSQL retains its current fallback. Regression coverage requires 322 net test/support lines for historical coverage, invalidation interleavings, cold restoration, post-ready scheduling, and drain; allocate exactly those lines. Requires Peter approval before merge or deployment. * perf(sessions): use the typed backfill query reference Keep the writer-derived facts query unchanged while using the owning Kysely expression builder for the active-row eligibility reference. This satisfies the raw-identifier guard without another allowance. * perf(sessions): pace facts backfill during foreground work Start normal database backfill from the existing post-ready task without waiting for global idleness. Keep restart recovery and drain gates, use background writer admission, cap duty cycle and back off on lock contention. Prioritize recently active paths and retain one worker client for each pass. Regression proof covers progress during live work, post-ready registration during background work, recent-path ordering and worker-client reuse. No schema or stored-shape changes. * perf(sessions): wait for restart input admission before backfill * perf(sessions): qualify paced backfill under foreground load * perf(sessions): preserve recent facts in hydration baseline * perf(sessions): align backfill test allocation with ratchet * perf(sessions): share facts backfill registration across startup paths * perf(sessions): remove obsolete startup test schedulers * perf(sessions): match backfill probe durability to worker * perf(sessions): pace facts backfill by admitted execution * perf(sessions): preserve snapshots during facts backfill * perf(sessions): measure compacted cron facts hydration * perf(sessions): preserve cron proof types
* fix(perf): invoke cron-model probe compiler through xcrun Resolve the Knip unlisted binary clang finding from #194519. xcrun is already modeled by the repository. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> * Publish openclaw/faint-krill Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 66f51bf9-966c-89ba-b447-89c4f8268fbb --------- Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
…98694) * fix(perf): invoke cron-model probe compiler through xcrun Resolve the Knip unlisted binary clang finding from openclaw#194519. xcrun is already modeled by the repository. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> * Publish openclaw/faint-krill Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 66f51bf9-966c-89ba-b447-89c4f8268fbb --------- Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
Approved by Peter (2026-11-07, question tool): "Approve + merge". Ships in the next Team build after landing.
Refreshed onto
51c2f42a8e029f667829c753d7098af911dd7f70. New cron-model measurements and refreshed validation are identified first under Evidence. All other runtime measurements below remain historical evidence fromfe435de371195768a35f26bfe9f4875c8482ef50or their explicitly named earlier head. The previously reported multi-second shutdown tail remains unresolved; this refresh does not claim to resolve it. The TS session merges after validation.What Problem This Solves
Schema 41 (#193682) accelerates transcript hydration through active-event facts, but ordinary appends populate only a recent window. Long sessions written before the upgrade retain uncovered historical rows and miss the full benefit. This adds the separately requested paced backfill within the existing database worker and post-ready maintenance owners.
User Impact
Backfill starts after the existing startup-methods barrier and restart recovery, never inside database opening, migration or readiness. It processes recently updated sessions first (seven days), largest paths first within that group, then older paths by size. Each session stays selected until covered or skipped. Live runs and unrelated Background/root work do not require global idleness; background writer admission waits outside the foreground FIFO until existing work drains. The supplied Team observations found full idleness in only 0.97% of samples (median 14 active items). That factor no longer multiplies completion time: after recovery, eligibility depends on foreground writer admission and pacing, not active-run count. Measured busy-workload rates remain conditional; continuous foreground writes can still delay background admission.
One Gateway-lifetime callback deduplicates canonical physical database paths across normal and deferred startup. Each pass retains one V2 client and closes it on completion, failure or shutdown abort. Progress reports include filled/skipped rows, visited/remaining sessions, payload bytes, maximum batch time and contention pauses. Restart derives coverage from the existing facts primary key; there is no durable cursor or sidecar.
Transactions use the writers' existing derivation helpers and recheck current active-row identity/payload together. They skip cold, rebuilding, ineligible, changed and malformed rows; missing remains unknown, while
{}remains a known non-candidate. The identity query finishes before inserts, retaining at most 512 small identities. Payload work targets 10 ms, at most 16 rows and 128 KiB before yielding. An indivisible payload read or commit can exceed those soft limits.Cadence charges the larger of native transaction duration and complete admitted publication execution, including preparation and reply delivery but excluding foreground FIFO wait. The next delay is at least 250 ms and twenty times that cost; lock-contention backoff reaches five seconds. A foreground arrival can still wait behind one admitted publication. These are pacing controls, not a hard transaction or shutdown deadline.
The backfill uses the existing empty derived-cache write scope: equivalent facts preserve semantic actor/replica tokens, while native mutation witnesses and database-wide write tracking remain intact. Ordinary transcript mutations still invalidate. There is no schema, index, stored-shape, configuration or retention change. This background pass is SQLite-only; PostgreSQL retains ordinary writer population and reader fallback pending a separately measured locking protocol.
Why This Change Was Made
Existing readers substitute these facts for the same payload-derived byte counts and dependency navigation. Filling them therefore removes repeated historical payload work without changing hydration results. The implementation reuses existing scheduling, admission, transaction and invalidation contracts rather than introducing another maintenance manager.
Qualification found two consequential boundaries. Native batch timing omitted admitted preparation/reply cost, so pacing now charges the complete publication. Facts-only inserts also unnecessarily invalidated semantic session state. Merely declaring an empty scope was insufficient while a native identity iterator remained open: the observer correctly treated nested writes conservatively. Finishing that bounded query before inserts preserves the intended derived-cache contract without weakening any observer or reader. This changes batch work and requires fresh final-head measurements.
Runtime production growth is +532 lines (+536/−4), necessary for the requested maintenance operation, lifecycle integration and observability. The requested broader non-test/non-doc filter is +2,774 lines (+2,825/−51), including reproducible performance tooling; the exact regression allocation is 558 lines.
Evidence
2026-11-13 refresh — current-head proof.
Rebase replayed the existing twelve lane commits cleanly. Main is now agent schema 42 (the opt-in tool-usage table); active-facts storage and semantics are unchanged, and the backfill has no schema-41 equality assumption. Auditing every active-row mutation owner found no new writer: append callsites now add mention membership and tool-usage side effects, and cold restore changed its execution custody, but all preserve the same facts derivation/invalidation owner. Existing append/rewrite/branch/delete and cold/archive/restore interleaving tests cover those transitions.
The backfill kernel, pacing wrapper, worker-store addition and startup-session scheduler are byte-identical to the approved head. Background FIFO admission and post-ready/RestartRecovery gates remain compatible with main's lifecycle changes. No selection, schema, stored-shape, or pacing change was needed; the conditional direct-owner contention rerun was therefore not triggered. Earlier foreground/Gateway/shutdown numbers are retained below, not presented as remeasured.
Refreshed cron-model facts evidence
Production source was rebased onto
51c2f42a8e029f667829c753d7098af911dd7f70before these runs (refreshed production head091dc56a38a55e19f62a70b2a55f8bb8ed392f8c; final head129b947470a5fc282eb9bca554c5257613625bb1adds only the proof tools). The backfill kernel and pacing were unchanged. Node 26.12.1; source/probe hashes, each raw sample, process receipts and host loads are retained beside this report. The finalinspectmode was added after comparative measurement. A subsequent script-only typing fix uses a static import for the cohort unique symbol and binds the first result before comparison callbacks; neither changes the measured workload or production code.These fixtures use real
persistSessionTranscriptTurnwrites andSessionManager.appendCompactionAsync, then copy the closed synthetic database on SF1 and delete facts outside the last 512 active rows. They contain alternating ordinary user messages and excluded assistant dashboard posts in historical rows, with an ordinary final tail. This is a declared synthetic composition, not an inference about Team’s excluded-row fraction. There are no unresolved pending automation results, custom/reset/branch-summary events, malformed rows, cold archives or off-path branches.Tail counts include one compaction summary: FRV has 725 retained messages plus summary; ShellBench has 180 plus summary. The header is additional. The production default cron limits are 1,024,000 bytes and 10,000 events, so the open deliberately returns less than the whole tail.
The measured entry point is
SessionManager[sessionManagerOpenTranscriptCohort]with callercron-model, the production limits and an empty-ID/message-presence cohort. This matches the owned-reader branch ofattempt-session-prepare, without an initial user-turn entry lookup. It dispatches the realreadSessionTranscriptHydrationRequestworker andreadSessionTranscriptBoundedActiveContextCoreowner. The alternateSessionManager.openAsyncsmoke produced exactly equal entry hashes, model-message hashes, VFS bytes and facts counts in all three states.Five fresh-native-reader opens per state ran in ABC/CBA order, serially. Closing the DB owner between opens also includes worker preparation in CPU/wall. All first samples are retained; no OS cache eviction is claimed. Exact-target VFS xRead bytes are logical SQLite I/O, not physical disk reads; repeated reads count. The opt-in probe forces xFetch misses so mmap cannot bypass counters. Atomic counters capture worker reads. Physical process counter deltas are separate and include code/supporting activity.
Before means 512 natural-window facts. After means completed production backfill. Natural means all facts left by real writers. Every returned entry and final model message is hash-identical across states. All first before/after reads had 77,824 extra VFS bytes (19 spans) versus subsequent reads; these are retained. The FRV natural control is exactly equal to backfilled steady I/O; ShellBench natural differs by 28,672 B (seven spans), consistent with different fact-table page packing rather than missing semantics.
FRV VFS reduction is 90.69%; ShellBench 82.50%. CPU/wall include worker preparation and other fresh-open work; those components were not independently timed. The byte reduction is the decisive result, not a claim of equivalent production latency reduction.
Residual reads and selection
The completed reads do not collapse to only the post-compaction tail: FRV still reads 19.00 MB versus a 9.17 MB complete tail; ShellBench 6.78 MB versus 1.79 MB. They do eliminate the historical payload fallback. This is already the natural-writer result, not rows missed by the backfill.
Inspection repeats the real cohort open and asserts its entry and model hashes against all recorded samples. It finds:
session-accessor.sqlite-active-context.tsstill builds the dependency CTE over excluded active rows (23,685 / 6,886), irrespective of compaction boundaries. With facts present, the CASE reads companion navigation and byte counts; its correlated transcript payload subqueries are not evaluated. Ordinary eligible identities are excluded from that candidate set. All generated excluded posts are non-pending, so there are zero materialized dependency payloads. The reader separately loads the selected header/latest summary/newest messages, gets logical parents and retention ranges from identities, and probes custom/reset cache-TTL metadata (none in these fixtures). Off-path and cold-storage reads do not occur.This source-backed row attribution distinguishes selected payloads from history-sized metadata scans. The
dbstatvalues are storage footprints, not an exact allocation of the 19.00/6.78 MB VFS reads to individual statements or objects. No per-object I/O trace was claimed. No backfill selection change or new stored shape is needed for this case; further shrinking the metadata scan belongs to the bounded reader.Ordinary-history control and Team implication
A separate real-writer 2,001-row, three-compaction control with no excluded history returns 104 hydrated events / 103 manager entries / 26 model messages. Its VFS median is exactly 1,384,702 B and 365 spans before, after and natural. This explains the earlier neutral cron result: ordinary indexed history is already filtered before dependency payload reads. Missing facts matter for excluded history, not every old compacted transcript.
These are bytes/open × 30, in decimal GB. The synthetic FRV baseline is below the reported 11–16 GB/h on Team; this does not prove Team’s exact excluded-row mix, fragmentation, context budget, pending-result retention or physical I/O rate. If Team’s excess reads arise from this same missing-fact dependency fallback, covering those rows should remove that payload traffic. The remaining metadata and selected-context reads persist. Unresolved pending automation results intentionally retain their payloads and were not modeled here.
Entry loads were FRV 23.86–27.05, ShellBench 19.24–24.65, ordinary control 28.96–38.12; no measured post-open load exceeded 40. A later non-timing FRV inventory attempt refused load 48.48 before opening and is preserved; a fresh inventory retry passed and joined. All comparative and inventory workers joined. Cleanup completed: 36 exact synthetic DB/WAL/SHM files removed (5,077,254,144 logical bytes; physical reclaim not measured). All JSON/Markdown reports, probes, scripts, raw logs and process receipts remain.
cron-cleanup-receipt.jsonverifies every target absent.Refreshed validation: 146 focused tests passed with one pre-existing skipped test across the worker/admission, native and real-worker facts/interleaving, cold restoration, scheduler/startup and restart-recovery files. Strict agents-sessions, state-logging, gateway-server and gateway-root test graphs passed, as did all four strict root partitions (
pnpm tsgo:test:root) and the fixed-protocol export guard. The first refreshed CI found a proof-script typing error in its separatetsconfig.scripts.jsongraph: dynamic destructuring widened a unique symbol, and the result array was captured before inference. Both were fixed without casts or behavior changes; that exact scripts graph now passes locally, along with the repeated four root partitions. Changed-file formatting and script lint passed. Scoped production lint has only size-limit observations: startup-finish 701 lines (main 688 plus the approved integration) and worker manifest 706 (main already 703 plus the approved registration), against 700. The repository's existing GitHub policy makes these size rules advisory; no lint config, suppression, baseline or environment was changed. Main CI43540256697for the rebased base is green; these are local size observations, not an invented inherited failed-CI claim. No production code changed after the clean rebase.Local Codex P0–P2 reviews of the proof tools and subsequent typing fix returned no accepted findings. An independent evidence review reconciled all 45 main/control opens and cleanup. Exact requested branch command
python3 ~/.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --engine codexcompleted clean on129b947470a5fc282eb9bca554c5257613625bb1(helper default P0 scope), with no provider/model overrides or inherited AUTOREVIEW_/CODEX_ overrides. The final new proof tools also passed the local P0–P2 review. Exact-head CI 43545292660 completed successfully on129b947470a5fc282eb9bca554c5257613625bb1(53 successful jobs, 25 skipped), includingcheck-test-typesand all PostgreSQL conformance jobs. The TS session owns merging; this lane has not merged the PR.Cleanup verified 36 task-owned DB/WAL/SHM files absent, 5,077,254,144 logical bytes removed (physical reclaim not measured). All 17 fixture/probe commands settled; the one inventory load refusal is retained separately. Reports, raw samples, source/probe hashes and receipts remain under
.local/buf706/revision6/. No Team access, writes, load, deployment or database copies were used for this refresh.Historical qualification below. These are the retained November 7 measurements, not new runs on the refreshed head.
November 7 source and validation. The previous handoff used head
fe435de371195768a35f26bfe9f4875c8482ef50. Fresh Codex P0–P2 review and the exact requested branch review are scoped-clean. Five backfill cases pass on the final head, with strict session types and changed lint/format. The 28 projection/replica consumer cases passed before the final cursor correction; that correction does not execute in those cases, so this is reused earlier-head consumer evidence. Earlier admitted-timing validation passed 38 focused cases, relevant strict state/session configurations and all four strict root typecheck shards. Exact-head CI 42391976242 completed successfully on this exact head. That November 7 CI gate passed; the older cancelled PR-context run was superseded by a successful same-head run. At that handoff, the separate harness PR had a documented inherited test-line-ratchet failure; no CI was rerun to chase green.Regressions cover historical coverage, restart, writer interleavings, cold transitions, malformed data, readiness/recovery ordering, live-work progress and shared-physical-store deduplication. The original post-ready regression fails on the schema-41 base. Timing regressions distinguish 1,000 ms of FIFO wait from 100 ms of admitted work and preserve publication success/original failure if observation throws. Final native and real-V2 regressions prove facts growth with an unchanged semantic token and advancing database revision; an actual transcript rewrite still invalidates. The token regression fails on the preceding implementation.
November 7 Gateway qualification. Baseline is
4f132c9f661b714cb2786da748294cd30dfd972f. Separate tooling uses the canonical harness plus #194563,bf33a13ead512afb903ca191dfece9b6accd2bef, for bounded retryable startup-sidecar refusal handling; that repair is not part of this branch. All proof is synthetic and isolated on SF1. Entry load must be ≤40; pauses/outliers are retained.fe435de3resultThe native fixture has 10M active rows, 40,236 sessions, fragmented overflow chains, four 20k–49k paths and a 21.75 GB file. Only selected paths are filled. Final runs use production NORMAL synchronization and disabled automatic checkpoints, with a fresh process at the predeclared restart. Native modeled cadence is distinct from the real host's admitted-publication cadence. Materialized-but-unconsumed identity rows count toward measured CPU/I/O even when excluded from
rowsVisited. No hydration warmup ran; OS cache state was uncontrolled, so this is not a paired comparison with the earlier warmed native campaign. All 6,208 sampled loads were ≤40. Native holds over 50 ms were 55.916, 86.480 and 148.116 ms; the largest used 10.686 ms CPU and 10.764 ms kernel time, with the remaining elapsed time unattributed. Mean batch CPU was 7.763 ms and mean modeled delay 253.328 ms (max 2,962.315 ms). Process physical writes include diagnostics; checkpoint snapshots are not cumulative blocked-attempt counts. WAL was zero after both native closes. Only this selected path was filled, not all 10M rows. Scaling this native shape to 6.27M missing rows implies about 117.5 CPU minutes, 224.94 GB logical reads and 9.43 GB logical writes. These are conditional estimates, not Team physical I/O measurements. Tiny paced transactions and repeated identity/current-row checks cost substantially more CPU and page writes than the earlier coarse 512-row proposal; that prototype is not an equivalent production algorithm.Queue-p99 target ≤15 ms passes on the signed three-pair mean; individual append queue p99 values were 7/15/8 ms and read values 7/16/7 ms. The 16 ms read arm remains included. Initial request baselines differed by >6×, triggering exactly one predeclared extra pair. All three request-tail differences were positive: append +22.314/+29.709/+1.768 ms; read +17.070/+38.595/+4.672 ms. The observed mean request increases (+68.4%/+91.2%) exceed numeric adverse thresholds, with noisy A/A controls limiting causal precision. This is not a neutral result. The queue target passed, so no slower pacing curve was triggered and runtime pacing stayed unchanged.
Delay medians were 250 ms. Arm BA added three more facts during drain, excluded from its measured rate. All arms started with 512 facts and remained unfinished. The backfill's domain reservation explicitly blocked all six maximum-queue observations; maximum batch publication occupancy was 258/110/258 ms, distinct from native transaction timing. Cadence includes that occupancy, but does not bound an individual foreground wait. Seven sparse 49k reads per arm were context-only: median 171.270/180.245/171.503→179.177/195.630/176.388 ms, with initial/max reads up to 22.481 s retained. The 600-row foreground append tails are not long-session append tails. All fourteen children joined and their copies were deleted.
Final whole-Gateway result. All eight ≥10-minute arms completed: timing AB/BA and separate allocation AB/BA, with 320 primary turns/tool calls/results and 80 distinct completed native children total. Every arm retained all four long transcript paths and completed 40 primary turns/tools plus 10 native children. Candidate backfill progressed strictly inside every measured interval and remained unfinished at shutdown.
Timing CPU was 8.256→8.133% with opposite pair signs; this is not a verified CPU win. GC was 0.214587→0.179349 s/min. Append queue p95 was 32.5→27.5 ms; p99 rose 235→280.5 ms but is context at 660 samples/arm. Endpoint RSS/main heap rose 77.018/39.098 MiB; old-generation growth rose 26.059 MiB and settled old generation rose 3.335 MiB. These are distinct observations, not interchangeable memory statistics.
Allocation was 29.861974→31.171270 and 30.554461→30.199522 MiB/s: mean 30.208217→30.685396 MiB/s (+1.58%), with opposite signs, so inconclusive. Host imbalance limits causal interpretation of apparent timing improvements. The final allocation baseline had two sampled minutes over load 40 (maximum 42.06), after passing its premeasurement gate at 11.20; they remain included under the predeclared entry-gate/no-mid-window-filtering protocol. Traced latency/GC is context only. No predeclared extra GC/pause A/A condition triggered; per-kind totals, counts and both maxima are retained below.
Strict timing fills of 20,250/26,636 over actual 600.013/600.007-second intervals imply 121,497/159,814 rows/hour, mean 140,656/hour. At that compact, bursty Gateway rate: 20.68 minutes for a 49k path's 48,488 missing rows, 7.11 hours for 1M, and 44.58 hours for 6.27M. These are conditional estimates, not measured Team physical-I/O throughput or continuous 99%-busy occupancy. The direct-actor proof's 49,983/hour (58.21 min / 20.01 h / 125.44 h) and fragmented-native proof's 105,735/hour are different workload models, not a confidence interval. Allocation arms do not qualify throughput estimates.
Primary measurements
Server and foreground latency
Server handler tails are first-to-last measured Prometheus histogram deltas, not exact event samples. Upper bucket bounds and sample counts are retained. Append reservation samples require enqueue and completion inside the measurement. Per-arm counts determine eligibility: p95 requires at least200 samples and p99 requires at least1,000. A p99 sample shortfall does not dismiss a qualified p95 cost. The isolated continuous owner probe and this concurrent whole-Gateway workload use the same outer reservation metric, but their budgets and observed distributions are not interchangeable. Reservation execution includes broader owner work/hydration and is not native BEGIN-through-COMMIT hold.
GC samples and maxima
Major pause tails are context below 50 collections. Minor p95 can gate above 200 collections; minor p99 is context below 1,000. Total paired GC rises below 50 ms/min remain context. All pauses and maintenance intervals are retained. GC p95/p99 are approximate RecordableHistogram quantiles: canonical team-shape-stress-telemetry.ts:47–70 rounds each duration to integer microseconds before recording it, then uses histogram.percentile. Raw maxima and totals retain the original PerformanceEntry duration. Histogram quantization can therefore place an approximate p99 slightly above the raw maximum; no exact-sample ordering is claimed.
Work and eligibility
Native child receipts come from each measured round’s canonical child completion and parent yield/result/continuation checks. Native/admitted maxima are cumulative only through the available progress reports; a missing admitted field in older logs is unknown, not zero. Candidate fill is the conservative difference between cumulative progress reports both strictly inside the measured window; boundary snapshot deltas are recorded separately in appendix.json. Each live path appended during every qualified arm. Canonical activity scrapes occur during cohort polling, so they do not establish 97% continuous occupancy. The continuous foreground owner proof remains the primary queue-budget experiment.
Paired deltas
Values below use canonical paired means and retain A/A controls separately. Missing pairs stay incomplete. Client list/loop tails alone do not reject a change. Background CPU/allocation and latency costs are real work costs even when a control makes a specific gate inconclusive.
Memory statistics
All values below are MiB. RSS and main live heap are the telemetry sample at measurement stop, not peaks or time averages. Worker heap is the aggregate at the last non-forced-GC resource sample. Growth is last minus initial old-generation telemetry heap spaces; native after-GC is the last scraped major-GC epilogue; settled old generation follows explicit GC outside timing. Paired means average these per-arm observations, not their sample streams.
Reused baseline A/A controls
These four arms are reused from
../stress-v1, with baseline4f running under both labels. They are historical controls, not contemporaneous final-candidate observations. The unchanged fixture, measured canonical workload, duration, warmup, instrumentation mode and load gates permit the predeclared reuse. No old candidate A/B results are pooled with the final comparison. Allocation-mode GC and latency are traced context, not substitutes for untraced timing controls.Every kind and both sides’ raw maxima are retained below. p95/p99 are approximate histogram quantiles; raw maxima retain PerformanceEntry durations. Major tails are context below50 collections; append p99 is context below1,000 samples.
Memory statistic definitions: RSS and main live heap are the telemetry sample at measurement stop, not peaks or time averages. Worker heap is the aggregate at the last non-forced-GC resource sample. Old-generation growth is last minus initial telemetry heap-space bytes. Native after-GC old generation is the last scraped native major-GC epilogue. Settled old generation is measured after explicit GC outside the timed interval. These distinct observations are not interchangeable.
Each control arm completed40 primary turns/tools and10 native children. Full progress, ownership, cleanup and source receipts remain in the original campaign;
reused-controls.jsonpreserves the selected raw numeric rows and source path.The Gateway template has 10,800 sessions, 40 plugins, 65 WebSocket clients, four concurrent primary turns, native subagents, mock tool calls and sidebar/list/search churn. Each ten-minute arm has ten measured rounds at 60-second intervals: 40 primary turns/tool calls and 10 native children. This is bursty mixed load, not proof of continuous 99% live-run occupancy. Its four actual live paths contain 34,153/20,000/49,000/40,000 events. The compact 210 MiB database models contention/cardinality, not cold 70 GB storage. All final-head measurement campaigns are complete. No historical path finished backfill during a Gateway arm; the separate owner proof establishes the eventual hydration benefit. Shutdown remains inconclusive, not proven unchanged.
Reusable component proof, measured before the final correction. Reader semantics, client lifecycle and discovery selection are unchanged; these are not final-head end-to-end measurements.
Hydration A/A CPU was 175.692→176.514 ms (four controls); timed physical reads were zero, so this is fresh-reader/nonresident proof, not OS-cold storage. Client process CPU rose 5.68% with large A/A variability (−1.30% to −14.28%); allocation is the demonstrated client benefit. Discovery reads index-state/cold metadata, not historical payloads. Prior native resume traversed 15,360 covered identities without payload reads/writes; a completed 49k rescan still cost 24.125 s paced. Final resume and completed-path rescan costs are reported in the native table above.
Prior adverse results retained; not final-head claims. At
f8cdb81, Gateway append queue p95 was 29→299 and 29→282 ms (660 samples/arm; A/A 32→32). Main CPU was 7.497→8.858%, allocation 29.1655→30.4661 MiB/s, GC 0.179148→0.227509 s/min, loop p99 28.172→32.686 ms and client-list p99 29.804→47.390 ms. Server-handler p99 was 27.445→37.515 ms, n=1,173/arm. Loads were 4.04–30.32. This supported foreground cost cannot be dismissed by the p99 sample limit. The 48.36 ms/min GC rise is below the material floor; adverse pause conclusions require additional matched controls. List/loop tails alone do not reject the change.At admitted-pacing head
138650d4, forced-nonresident foreground AB/BA met the ≤15 ms queue-p99 target (append 7/5 ms, read 7/7 ms) but raised request p99 by +3.949 ms append and +5.340 ms read, with four comparatively tight A/A controls. The 76,436 rows/hour conditional rate implied 38.46 min / 13.08 h / 82.03 h for 49k / 1M / 6.27M rows; it is neither a final rate nor a Team forecast. Rare queue maxima were 121/120 ms append and 98/104 ms read. Final materialization/residency changes prevent reusing those costs as final acceptance evidence.Final-head untraced short shutdown N5. Same external-volume fixture, with backfill unfinished at SIGTERM. Pairs 1–3 are from the initial final-head campaign; pairs 4–5 are fresh complete pairs from recovery. Pair 4 replaces the whole load-refused pair; its earlier slow candidate remains separately reported below.
Means are 240.4→293.2 ms (+52.8 ms, +22.0%); medians 141→165 ms and maxima 641→853 ms. All five pairs exited gracefully and joined. Candidate rows filled per bracket were 1,056/1,298/1,217/1,110/1,408, with 139,115–139,494 historical rows still missing at SIGTERM; all four long paths appended in every arm. Entry/signal loads were 5.05–10.38. The +52.8 ms paired-mean change has mixed signs and does not establish unchanged shutdown or a causal regression. Four identical-base A/A pairs were 174/140, 121/127, 128/622 and 138/131 ms: means 140.25→255.00 (+114.75 ms), medians 133→135.5, maxima 174→622; original loads/timestamps remain separate.
The original fourth candidate took 6,276 ms, including 5,378 ms in plugin-service cleanup. Its following baseline was refused at load 50.14, making that whole pair invalid; the slow candidate remains a standalone observation. The baseline's 902 ms cleanup is not a measurement. A fresh whole pair replaced it, without erasing or re-pairing that tail.
Five symmetric diagnostic pairs on exact base/final head were 165/159, 130/637, 122/640, 184/285 and 134/129 ms (means 147→370, +223 ms; maxima 184→640). All expected spans completed without drops. Facts-client closes were approximately 7 ms, and native closes approximately 18–57 ms; these spans overlap and are not additive. Two candidate runs had unexplained 531/533 ms gaps between native close and first plugin service. A later untraced baseline also had a roughly half-second delay. Normal logs omit individual steps below one second. No diagnostic run reproduced the multi-second plugin-service stall, so its cause is unresolved and no causal fix is claimed. Instrumented runs are not pooled with untraced qualification. All diagnostic and shutdown children joined and private temporary state was removed.
Earlier dedicated shutdown pairs included a 9.4-second candidate tail: base/candidate means 1,115.8/2,978.4 ms. Four quieter A/A pairs and a 533→256 ms diagnostic pair did not explain it; plugin-service cleanup was the aggregate location, not a proven backfill cause. Later
138650d4N5 pairs were 656/174, 662/653, 646/127, 124/125 and 639/713 ms (means 545.4/358.4 ms), all graceful/joined, without a plugin-services stage over one second. Those results predate the final correction and do not establish unchanged final shutdown or a causal fix for the old outliers.No Team writes, load, deployment or database copies occurred. All final Gateway children joined and private temporary state returned to zero. The five 21.75 GB native fixture databases and ten sidecars have been deleted (108.736 GB logical size, with APFS sharing; physical reclaim not measured). Cleanup also removed 470 arm fixture directories, six template fixture directories and eight task-owned runtime build archives (35.063 GB logical files; physical reclaim not measured). All targets are verified absent. Reports, raw evidence and ten allocation profiles remain; shared dependencies and UI attribution evidence were preserved. Peter approved this PR on 2026-11-07; the unresolved shutdown observation remains an explicit gap retained for the TS session's merge review.