Skip to content

perf(agents): archive completed kept subagent runs after 30 days - #188492

Draft
steipete wants to merge 23 commits into
mainfrom
steipete/perf-subagent-keep-run-archive-20261030
Draft

steipete wants to merge 23 commits into
mainfrom
steipete/perf-subagent-keep-run-archive-20261030

Conversation

@steipete

@steipete steipete commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Completed kept subagent runs currently remain resident indefinitely. This change moves settled run-mode records strictly older than 30 days out of the resident registry and hot table while keeping their results, status, aliases and ancestry readable through the existing APIs. It does not delete sessions, transcripts, attachments or worktrees. Session-mode bookkeeping retains its existing five-minute retirement policy.

DO NOT MERGE: exact-head CI and correctness/storage checks pass, but the completed 160-minute controlled Gateway campaign fails the CPU and allocation performance gates: main-thread CPU +32.40%, allocation +37.69%. Matching A/A controls are +10.30% CPU and +0.01% allocation. Retained heap improves; latency and GC remain inconclusive under the control rules. Earlier adverse results remain below.

Identity / gate Current status
Single existing PR #188492; no merge authorized for this lane
Current head 4f5c80371653d74babd77502ac098646e3e21e79; OPEN and ready; latest GitHub read is CONFLICTING after main advanced
Required exact-head CI Run41207959008 SUCCESS, 148 passed / 19 skipped; prior94c failures repaired through test routing
Pinned integration/performance base 40b332d1a8a97ab955a08b17e27554f5fa7b94cd; 23 lane commits
Current review Reviews46 integration,48 guard simplification and49 test routing CLEAN
Current focused checks / storage reuse audit PASS: integration 88 tests, then 32 affected tests after guard cleanup; types/lint/format/ratchets; unchanged storage proof audited
Most recent completed owner measurement 929c693f7250b0deeaa448670df87b4bd0c64e49 on main c504abf10afae7c25c9943744622f106ff6a9b2c
Current-head performance / CI CI GREEN; performance gates ADVERSE; the matched40b/94c comparison uses a candidate production-identical to final4f; older results retain their original identities

Implementation and storage checkpoint

Peter accepted this contract on 2026-10-30, relayed by the performance lead: a new shared-state subagent_run_archives table; consecutive shared schema 36→37; an empty-table migration through normal SQLite/PostgreSQL startup and Doctor; older-version refusal and backup rollback; bounded archival; archive-aware public reads; and exact-generation follow-up restoration. The material database-change checkpoint and worker-access rules were reviewed before implementation. Pinned integration base40b remains shared36/agent39; this lane remains shared37/agent39. No further version bump is introduced by the latest integration.

The existing minute sweeper and registry writer transfer at most 128 rows and approximately 1 MiB of canonical payload per transaction, admitting one oversized row for progress. Unfinished cleanup, delivery, cancellation, requester and collector obligations defer archival. Durable commit receipts precede resident eviction; retries and uncertain acknowledgements use the existing mutation owner. The first 10k-record drain is bounded per pass and restart-safe. Follow-ups restore the exact archived generation before advancing execution. Cancellation promotes only the ancestry anchors required by the current cancellation owner. Explicit deletion removes either storage location.

Historical reads are request-owned and do not repopulate resident registry caches. Indexed identity traversal selects matching rows before decoding archived payloads. The cutover includes aliases and latest generations, tools, active-capacity admission, delivery, follow-ups, restart ancestry and Gateway presentation. Exact pages include physical child links and expanded ancestors. Search collects history only when the existing predicate reaches unresolved historical status/model vocabulary; metadata matches avoid that work. spawnedBy and non-idle owner counts retain broad lineage. New keys, live work or source changes after an await retry existing preparation. Child-only search history never substitutes for a page’s complete relationship view.

The final presentation path reuses immutable resident row sources and tags nonempty archive contexts as transient. Transient reads bypass both lookup and population of retained run-state caches; registry eviction forgets old prepared facts. The redundant publication identity is removed. No additional cache, configuration option or authority owner is introduced. The exact-key repair allows only genuinely broad history to substitute for page relationship preparation.

Two conservative discovery snapshots are intentional: admitted group planning may still count selected settled history after concurrent deletion, and registration discovery may retain a deleted archive-only candidate until its next scope. Fresh FIFO mutation admission omits deleted candidates and cannot resurrect them. Neither snapshot creates execution authority or active-capacity reservations; public historical reads still invalidate on archive revision.

The migration performs no bulk rewrite. A verified pre-migration backup preserves original hot records; an older binary refuses schema 37. Rollback restores that backup with its matching binary, rather than downgrading in place while preserving later writes.

Evidence

All fixtures and Gateways are synthetic and isolated. No Team load, process or state was touched.

Contract Recorded proof and limits
Retention and atomic ownership The original regression fails because a 31-day kept run remains resident. Frozen-base 52fbfb7d989207a4f82544f58b5bb9ee75782fe9 replay fails the resident assertion before archive-only SQL (1 failed, 6 skipped, 43.28 s wrapper); an earlier red at 6ac91adabcc273e76a2d652a5aefc9955b0600f8 is separate. Focused worker proof covers exact day 30, pending obligations, 10k backlog, oversized progress, transaction rollback, committed-but-unacknowledged archival, restart and deletion.
Complete reader/mutation cutover Alias/inverse collisions, latest-generation precedence, exact-generation follow-up, capacity, cancellation and restart are covered. A real Gateway follows an archived generation 2 source to running generation 3. An archived intermediary preserves a live grandchild’s ancestry; history alone never creates recovery work.
Scoped reads and freshness Indexed traversal selects zero unrelated identities versus 256 before repair across four reads. Archived-model search and broad-history work-count regressions are red before their repairs. Six consumer files pass 39 tests; the owning file’s16 cases include changing metadata during preparation, new work behind an archived intermediary, newer hot generations and physical page relationships.
Physical activity under exact-key reads The first fixture premise was invalid because no actual execution claim was held; its failure is not archive proof. The corrected fixture uses real holdSubagentExecution custody and first proves zero registry descendants plus active physical child state. Original 749 condition: valid RED 1 failed/15filtered,42.77 s. Fixed condition: GREEN 1passed/15filtered,60.47 s; full 26 tests and static gates pass.
Ownership and retention The archived-leaf work-count regression is red when a second unchanged read rebuilds its progress resolver; the final cutover passes. Node/forks GC proof releases real archived records and payloads while the resident projection/source stay live. Its first missing-broker setup failure is not a GC verdict. Existing Node routing is preserved; routing 110/110 passes.
Registration integration Fresh mutation reads do not restore deleted hot preimages. Carried cohorts exclude known foreign owners sharing a raw child key while retaining exact-ID wrong-owner rejection and unresolved legacy-owner handling. The unchanged CI watched-registration case passes 999 ms after the repair; five focused files pass 59 tests.
Latest-stable upgrade and rollback Exact published [email protected] synthetic shared 20 stores upgrade through startup and Doctor to 37, preserving payloads and initially empty archives. The released version guard refuses 37; verified backup recovery restores 20. At 3748, startup 1,269.8 ms/Doctor 1,322.0 ms; all 14owned processes exited without signals. This tests the old-version guard, not a full old-Gateway launch or agent 39 restart.
SQLite/PostgreSQL Archival migration/rollback, PostgreSQL 137-table inventory, exact/sanitized backup round trip and all five historical PostgreSQL migration cases pass on their recorded heads. The current 40b storage-path audit passes: upgrade/rollback proof inputs remain unchanged; no schema-version change is observed.
Prior integration/review Review 43 completed 25 passes clean, cleanup 45 clean. Previous integration passed 116 tests (105 spawn production-boundary,11 channel-native), targeted core/agents-sessions/messaging types, lint/format and pinned c504 ratchets; unchanged pnpm tsgo:test:root proof across four partitions was reused. Current 94c adds clean integration review 46 and guard review 48,88 integration tests plus 32 affected replays, and final targeted static gates.

The current integration includes incoming main typing and config-reload/catalog behavior. Registration now starts the upstream typing owner; exact row preparation can rebind a stale catalog once before consumer execution. These changes are included in review46 and in the completed40b/94c runtime comparison reported below. The prior 3748→929c storage audit found all 69generated catalogs, canonical SQL, migration/backup/integrity-worker paths, generator inputs, package and lockfile unchanged; the subsequent 40b audit also confirms the storage/upgrade/rollback inputs remain unchanged. Reviews and checks are attributed to the exact source/patch they captured; no incomplete review is called clean.

Completed canonical Gateway comparison — current production candidate

Already-built base 40b332d1a8a97ab955a08b17e27554f5fa7b94cd → candidate 94c5798d3f95100a536660f00fcf59a29b71da37; final head 4f5c80371653d74babd77502ac098646e3e21e79 differs only in two test-routing entries. Runtime equivalence is verified. Entry SHA256 base 1fbeece8a4e16509ec2f4cf8c14319cc74bd35070d2e756df517965e2ee3f0ea, candidate 13702304304d55738b857fadda5103c1d1f0ba156243dbb3fa80b773e6e610e2.

The canonical campaign completed 16 ten-minute arms / 160.0287 measured minutes: two AB/BA comparisons and two matching A/A pairs in each of untraced timing and sampled allocation modes. Each arm used 10,800 sessions,65WebSocket clients,40 enabled catalog entries (10 active catalog modules plus memory-core;30 lazy),four concurrent native mock-provider turns with tool calls,25-second polling,6-second churn,60-second rounds and warmup,128MiB fixture transcripts,four agents,seed1711,kept-run age100days. Every arm completed40 turns and40 tool calls: 640/640 total, zero RPC errors, all4,300 seeded records conserved. The candidate finished with1,408 archived in three arms and1,280 in its second allocation arm; no count is assumed from cadence. Timing and allocation use separate passes; allocation is sampled JavaScript allocation, not promotion/native allocation.

Gate assessment: CPU and allocation are adverse. Untraced CPU rises 7.3343→9.7109%, +2.3766percentage points/+32.40%; paired changes +10.42%/+54.84%. Matching timing A/A rises+10.30% overall, with +12.44%/+7.77% pairs, so it does not trigger the CPU gate. The first comparison CPU delta does not exceed its matching control; the second has substantial host-load drift, retained explicitly. Allocation rises 19.6330→27.0316MiB/s, +7.3987MiB/s/+37.69%; both pairs rise (+39.42%/+36.03%), versus essentially unchanged allocation A/A (+0.01%). The owner retained-heap benefit does not clear these gates.

Latency remains inconclusive, not an independent adverse verdict: client loop/list and server-handler A/A results themselves trigger noise thresholds; comparison timing tail deltas also change sign. GC remains inconclusive: timing delta −1.73/+536.81ms/min is mixed, and only two A/A pairs per mode were collected, fewer than the four required before GC/promotion/max-pause rejection. No extra latency/GC pair is used to manufacture an acceptance; CPU/allocation already fail independently. Instrumented timing/GC values are context only. Host load and all pauses are retained, including allocation-base2 mean85.86/max116.41. No maintenance window or outlier is excluded.

Independent read-only audit recomputed all16 raw identities, CPU/allocation/GC arithmetic, signed means, client tails/counts, duration-weighted host load, and first-to-last server histogram deltas/bounds; all match. Server histogram samples are1172–1174, client list1188–1204, loop17056–28094. Timing has40scrapes/arm, allocation41 except its second baseline42; the actual last scrape is used. RSS covers the Gateway process including worker threads, not all subprocesses. Main-isolate heap, final scraped native major-GC gauge, explicit post-window settled old space, and the owner benchmark's empty-baseline-subtracted retained heap are distinct measurements.

Captured allocation stack attribution consistently points to archive-backed presentation and historical index preparation. Archive-overlay inclusive deltas are+4.230/+4.693MiB/s and topology self+0.506/+0.739MiB/s; presentation/serialization and IPC also rise. Inclusive paths overlap and must not be added. Endpoint .heapprofile files include some collector-finalization allocation after the sealed summary; these normalized endpoint rates locate work but are not the canonical allocation gate. The current immutable row/source reuse already removes nonswarm row copies. Read-only source review found no small safe deletion that credibly removes the whole regression: request topology preserves latest-generation veto and relationship traversal, and parent child-activity revisions preserve changed-child-fact freshness. An immutable historical-read construction path inside the existing topology owner is a potential next design target, not an implemented or proven fix. No global archived-record cache or weakened freshness contract was added to chase the result.

Separate matching three-minute CPU diagnostics also completed on frozen40b/94c:12native turns/tools each,362/365list RPCs,27,765.202→30,422.393ms recorded main-thread CPU. Measured host load differs materially: base71.79[62.66,79.32],candidate59.94[56.64,62.92]. Inspector sample weights are elapsed intervals, not exact per-function CPU: list/filter/search self+2,896.748ms, archive/index/read self+437.155ms, presentation self+103.145ms, parent child-activity self+14.276ms. Different inclusive families overlap. The canonical --workload-cpu-profile option installs its standard profiling preload; no ad-hoc preload or source patch was used. Candidate ended at384archived records, earlier than the full comparison's1,280–1,408. These diagnostics do not override the untraced gates. Both wrappers and all verified owned children exited0, with no signals; no runtime work remains.

Cleanup confirms no surviving verified lane-owned identities and no signals. macOS reused historical PID numbers during this long campaign; the monitor corrected ownership to current ancestry plus start time before cleanup. No unrelated process was acted on. Canonical temp cleanup returned successfully per arm; exact temp paths were not independently enumerated, so no stronger deletion claim is made. The full comparison, per-arm data and cleanup receipts are preserved under team-stress-comparison-94c5798d3f95/.

16 complete ten-minute arms recorded. Timing and allocation modes are separate; only complete pairs are aggregated. Exact frozen runtime identity and all raw counts are in campaign.json and extra-summary.json.

Mode A/A control Metric Mean base Mean candidate Signed absolute delta Relative to mean base
allocation False mainThreadCpuPercent 10.0056 11.7454 +1.7398 +17.39%
allocation False allocationMiBPerSecond 19.6330 27.0316 +7.3987 +37.69%
allocation False gcSecondsPerMinute 0.8835 0.4709 -0.4126 -46.70%
allocation False eventLoopP99Ms 148.0622 48.0051 -100.0571 -67.58%
allocation False sessionsListP99Ms 569.0495 313.3766 -255.6729 -44.93%
allocation False rssMiB 2613.4375 2499.3168 -114.1207 -4.37%
allocation False heapMiB 566.9349 528.2624 -38.6725 -6.82%
allocation False oldGenerationAfterGcMiB 406.6694 407.2103 +0.5408 +0.13%
allocation False settledOldGenerationMiB 400.1386 395.5275 -4.6110 -1.15%
allocation False serverSessionsListP99EstimateMs 379.1875 248.3375 -130.8500 -34.51%
allocation False serverSessionsListMeanMs 33.3352 29.3657 -3.9695 -11.91%
allocation False hostLoad1mMean 49.3054 24.7526 -24.5528 -49.80%
allocation True mainThreadCpuPercent 9.5845 10.2756 +0.6911 +7.21%
allocation True allocationMiBPerSecond 20.0973 20.0992 +0.0019 +0.01%
allocation True gcSecondsPerMinute 0.5906 0.8116 +0.2210 +37.41%
allocation True eventLoopP99Ms 80.5274 96.2724 +15.7450 +19.55%
allocation True sessionsListP99Ms 296.5515 438.7997 +142.2482 +47.97%
allocation True rssMiB 2456.3506 2540.2242 +83.8736 +3.41%
allocation True heapMiB 530.5717 527.1228 -3.4490 -0.65%
allocation True oldGenerationAfterGcMiB 401.8008 405.6856 +3.8848 +0.97%
allocation True settledOldGenerationMiB 400.0806 403.3627 +3.2822 +0.82%
allocation True serverSessionsListP99EstimateMs 224.0857 313.2833 +89.1976 +39.81%
allocation True serverSessionsListMeanMs 19.7203 27.9449 +8.2246 +41.71%
allocation True hostLoad1mMean 44.9335 60.7478 +15.8143 +35.19%
timing False mainThreadCpuPercent 7.3343 9.7109 +2.3766 +32.40%
timing False gcSecondsPerMinute 0.1789 0.4464 +0.2675 +149.56%
timing False eventLoopP99Ms 32.9974 52.4616 +19.4642 +58.99%
timing False sessionsListP99Ms 83.2509 317.9601 +234.7092 +281.93%
timing False rssMiB 2545.0931 2478.8827 -66.2104 -2.60%
timing False heapMiB 509.7740 527.2570 +17.4830 +3.43%
timing False oldGenerationAfterGcMiB 398.1232 405.7449 +7.6217 +1.91%
timing False settledOldGenerationMiB 397.8562 393.5246 -4.3317 -1.09%
timing False serverSessionsListP99EstimateMs 68.6567 192.4782 +123.8215 +180.35%
timing False serverSessionsListMeanMs 8.9990 26.0142 +17.0152 +189.08%
timing False hostLoad1mMean 15.0246 20.6941 +5.6696 +37.74%
timing True mainThreadCpuPercent 7.0549 7.7814 +0.7265 +10.30%
timing True gcSecondsPerMinute 0.1690 0.1841 +0.0150 +8.89%
timing True eventLoopP99Ms 27.9183 37.0852 +9.1668 +32.83%
timing True sessionsListP99Ms 42.9512 71.4604 +28.5093 +66.38%
timing True rssMiB 2511.2542 2584.3021 +73.0479 +2.91%
timing True heapMiB 517.9011 540.2538 +22.3528 +4.32%
timing True oldGenerationAfterGcMiB 399.5662 402.2085 +2.6423 +0.66%
timing True settledOldGenerationMiB 398.2258 398.3348 +0.1090 +0.03%
timing True serverSessionsListP99EstimateMs 35.8919 57.7167 +21.8248 +60.81%
timing True serverSessionsListMeanMs 7.3377 10.6742 +3.3365 +45.47%
timing True hostLoad1mMean 13.1095 23.9203 +10.8108 +82.47%
Mode A/A control Pair Side Loop p99 ms (n) Client list p99 ms (n) Server list p99 estimate ms (n; bucket) Host load mean [min,max] Hot/archive
timing False 1 base 35.324 (27597) 96.933 (1202) 73.080 (1173;[60.0, 80.0]) 16.30 [8.82,27.33] 4300/0
timing False 1 candidate 27.460 (28004) 58.917 (1202) 59.556 (1173;[50.0, 60.0]) 8.04 [5.94,11.28] 2892/1408
timing True 1 base 29.786 (28094) 55.761 (1192) 43.175 (1173;[40.0, 50.0]) 17.25 [13.23,24.50] 4300/0
timing True 1 candidate 44.696 (27137) 92.637 (1202) 68.467 (1173;[60.0, 80.0]) 30.93 [17.02,43.25] 4300/0
timing False 2 candidate 77.464 (25382) 577.003 (1193) 325.400 (1173;[300.0, 400.0]) 33.35 [16.21,55.96] 2892/1408
timing False 2 base 30.671 (27863) 69.569 (1204) 64.233 (1173;[60.0, 80.0]) 13.75 [9.43,24.72] 4300/0
timing True 2 candidate 29.475 (27930) 50.284 (1202) 46.967 (1173;[40.0, 50.0]) 16.91 [8.68,27.24] 4300/0
timing True 2 base 26.051 (28062) 30.141 (1202) 28.609 (1173;[25.0, 30.0]) 8.97 [7.07,10.41] 4300/0
allocation False 1 base 27.427 (28070) 40.956 (1202) 33.175 (1173;[30.0, 40.0]) 12.75 [8.94,18.97] 4300/0
allocation False 1 candidate 35.389 (27630) 127.304 (1193) 105.675 (1173;[100.0, 125.0]) 16.74 [9.77,28.91] 2892/1408
allocation True 1 base 28.475 (28058) 44.986 (1198) 34.671 (1173;[30.0, 40.0]) 13.20 [8.65,17.58] 4300/0
allocation True 1 candidate 35.127 (27762) 86.402 (1195) 50.900 (1173;[50.0, 60.0]) 25.21 [17.46,40.59] 4300/0
allocation False 2 candidate 60.621 (26498) 499.449 (1201) 391.000 (1172;[300.0, 400.0]) 32.77 [20.75,49.33] 3020/1280
allocation False 2 base 268.698 (17056) 1097.143 (1188) 725.200 (1174;[600.0, 800.0]) 85.86 [56.51,116.41] 4300/0
allocation True 2 candidate 157.417 (21096) 791.197 (1195) 575.667 (1173;[500.0, 600.0]) 96.29 [77.49,112.17] 4300/0
allocation True 2 base 132.579 (23108) 548.117 (1191) 413.500 (1173;[400.0, 500.0]) 76.67 [56.72,96.80] 4300/0
Mode A/A control Pair Side GC kind Count Total ms p95 ms p99 ms Max ms
timing False 1 base minor 494 1258.136 5.995 19.439 88.549
timing False 1 base incremental 32 22.853 0.924 1.201 1.201
timing False 1 base major 32 730.937 35.103 74.751 74.710
timing False 1 candidate minor 659 992.714 2.121 2.765 4.770
timing False 1 candidate incremental 51 35.418 0.924 1.289 2.023
timing False 1 candidate major 51 966.539 29.583 31.055 32.136
timing True 1 base minor 499 897.401 3.309 5.863 10.858
timing True 1 base incremental 33 25.828 1.167 2.169 2.169
timing True 1 base major 33 1022.347 41.983 302.335 302.265
timing True 1 candidate minor 494 1312.616 6.083 19.231 54.754
timing True 1 candidate incremental 32 24.760 0.977 1.841 1.841
timing True 1 candidate major 32 875.612 56.415 119.935 119.880
timing False 2 candidate minor 652 3761.370 17.071 66.303 257.674
timing False 2 candidate incremental 50 42.242 1.221 2.981 2.980
timing False 2 candidate major 50 3131.353 246.271 856.575 856.066
timing False 2 base minor 500 903.908 3.411 5.507 47.312
timing False 2 base incremental 32 21.885 0.891 0.920 0.920
timing False 2 base major 32 640.442 30.447 36.767 36.752
timing True 2 candidate minor 493 822.112 2.811 5.335 9.160
timing True 2 candidate incremental 33 25.345 1.164 1.807 1.807
timing True 2 candidate major 33 621.010 24.751 57.407 57.404
timing True 2 base minor 501 773.605 2.225 2.723 4.872
timing True 2 base incremental 34 22.908 0.865 0.982 0.982
timing True 2 base major 34 638.538 24.799 33.727 33.714
allocation False 1 base minor 519 816.801 2.295 3.921 10.953
allocation False 1 base incremental 31 21.785 0.935 0.982 0.982
allocation False 1 base major 42 1508.741 83.455 97.727 97.716
allocation False 1 candidate minor 638 1583.197 4.859 11.743 214.081
allocation False 1 candidate incremental 48 34.103 1.106 1.551 1.551
allocation False 1 candidate major 59 2180.483 112.831 148.735 164.134
allocation True 1 base minor 523 873.501 2.725 5.107 8.341
allocation True 1 base incremental 33 22.804 0.917 0.949 0.949
allocation True 1 base major 43 1463.323 83.135 198.527 198.509
allocation True 1 candidate minor 519 1161.483 4.915 14.575 25.758
allocation True 1 candidate incremental 33 26.315 1.127 1.530 1.530
allocation True 1 candidate major 44 1925.562 124.351 159.615 159.595
allocation False 2 candidate minor 677 2619.678 9.815 32.207 162.445
allocation False 2 candidate incremental 41 62.255 2.785 23.695 23.693
allocation False 2 candidate major 51 2940.035 160.767 222.207 307.216
allocation False 2 base minor 513 7988.225 56.575 249.599 623.406
allocation False 2 base incremental 21 44.171 3.785 14.503 14.497
allocation False 2 base major 31 7292.524 719.871 1320.959 1320.278
allocation True 2 candidate minor 491 8650.648 83.135 179.327 328.410
allocation True 2 candidate incremental 20 29.881 3.919 6.119 6.117
allocation True 2 candidate major 30 4440.804 336.383 414.975 414.734
allocation True 2 base minor 539 4806.331 34.975 202.751 265.391
allocation True 2 base incremental 30 28.296 1.292 1.481 1.481
allocation True 2 base major 41 4622.817 368.895 740.863 740.462
Mode A/A Pair Side Main CPU % Allocation MiB/s GC s/min RSS MiB Heap MiB Settled old-gen MiB Server mean ms Turns/tools
timing False 1 base 7.4086 n/a 0.2012 2568.696 511.341 398.023 9.877 40/40
timing False 1 candidate 8.1806 n/a 0.1995 2568.524 535.526 393.409 15.227 40/40
timing True 1 base 7.6364 n/a 0.1946 2573.633 522.115 398.735 7.982 40/40
timing True 1 candidate 8.5864 n/a 0.2213 2583.767 532.255 398.099 13.455 40/40
timing False 2 candidate 11.2412 n/a 0.6934 2389.241 518.988 393.640 36.801 40/40
timing False 2 base 7.2601 n/a 0.1566 2521.490 508.207 397.689 8.121 40/40
timing True 2 candidate 6.9764 n/a 0.1468 2584.837 548.253 398.571 7.893 40/40
timing True 2 base 6.4734 n/a 0.1435 2448.876 513.688 397.716 6.693 40/40
allocation False 1 base 7.2593 19.1644 0.2346 2543.668 525.210 397.821 7.666 40/40
allocation False 1 candidate 10.1484 26.7185 0.3796 2520.915 519.201 392.152 19.758 40/40
allocation True 1 base 7.3659 19.5257 0.2360 2461.724 529.925 397.723 7.341 40/40
allocation True 1 candidate 8.9920 19.5341 0.3111 2639.437 515.076 404.101 8.923 40/40
allocation False 2 candidate 13.3424 27.3448 0.5622 2477.719 537.324 398.903 38.974 40/40
allocation False 2 base 12.7519 20.1015 1.5324 2683.207 608.660 402.456 59.004 40/40
allocation True 2 candidate 11.5591 20.6644 1.3121 2441.012 539.170 402.624 46.967 40/40
allocation True 2 base 11.8031 20.6690 0.9453 2450.977 531.219 402.438 32.099 40/40

Interpretation requires the paired signed absolute deltas, matching A/A spread and host load. This generated table makes no adverse verdict. Before rejection on GC/promotion/max-pause, at least four matched A/A pairs in the same instrumentation mode are required. Major tails below50 collections and p99 below1000/p95 below200 samples are context only. No pauses were trimmed or host-load/maintenance windows excluded.

Server p99 is interpolated within Prometheus histogram buckets using first-to-last scrape deltas, not exact raw handler quantiles. Host-load means weight telemetry windows by duration. RSS includes workers; heap is main-isolate; settled old generation is post-GC native heap-space measurement. Raw per-minute metrics remain preserved.

Newest completed owner measurements — production 929c

Registry: c504abf10afae7c25c9943744622f106ff6a9b2c → 929c693f7250b0deeaa448670df87b4bd0c64e49, pinned Node 26.12.1. Each fresh store has 10,000 runs aged 1–100days and 2,000 deterministic exact-ID task/result reads. Two counterbalanced pairs separately for timing and allocation provide 4,000 timing reads and 4,000 allocation reads per side. Both initial CPU deltas had the same sign, so no extra pair ran.

Registry metric Base mean Candidate mean Absolute change Relative
Resident records after reads 10,000 3,000 −7,000 −70.00%
Retained heap after archive 27.140 MiB 9.534 MiB −17.606 MiB −64.87%
Retained heap after reads 30.186 MiB 11.323 MiB −18.863 MiB −62.49%
Main-thread CPU /2,000 reads 1,103.403 ms 1,259.550 ms +156.147 ms +14.15%
Process CPU /2,000 reads 1,974.477 ms 2,297.473 ms +322.995 ms +16.36%
Wall time /2,000 reads 1,946.317 ms 3,319.388 ms +1,373.071 ms +70.55%
Sampled allocation /2,000 reads 361.550 MiB 371.314 MiB +9.764 MiB +2.70%
Raw RSS after archive 654.479 MiB 726.594 MiB +72.115 MiB +11.02%
Raw RSS after reads, including workers 768.768 MiB 865.370 MiB +96.602 MiB +12.57%
Raw main heap after reads 120.839 MiB 104.584 MiB −16.254 MiB −13.45%

This is a retained-main-heap benefit with real measured costs, not an RSS or exact-read CPU win. Main CPU pairs are 924.864→931.159 ms (+0.68%) and 1,281.943→1,587.941 ms (+23.87%); process CPU +2.77%/+26.13%; wall +5.76%/+104.31%. Allocation pairs are 362.655→372.537 MiB (+2.72%) and 360.445→370.092 MiB (+2.68%). After-read RSS pairs rise 106.634 MiB (+14.02%) and 86.570 MiB (+11.14%); after-archive RSS rises 71.178/73.052 MiB (+10.93%/+11.11%). Sampled-pass CPU is separately contextual:1,176.233→1,460.519 ms (+284.286 ms,+24.17%), with pairs+1.19%/+59.62%.

All payload/no-repopulation assertions pass; every candidate moves 7,000 records in 55 batches of at most 128 and retains 3,000after reads. Exact-day 30 stays hot. One-time transfer costs are 84.792/161.676 ms main CPU,5,599.991/6,943.659 ms process CPU; allocation passes sample 64.096/65.705 MiB. These are separate from steady reads. Retained heap is forced-GC main-isolate heap above the same-process empty-owner baseline; the empty baseline varies approximately 5 MiB between some arms. Raw heap/RSS are reported separately. Timing and sampled allocation use fresh separate processes; sampled JS allocation excludes native/external bytes.

Arm Host one-minute load before→after
Timing 1 base / candidate 20.51→20.55 /18.69→17.19
Timing 2 candidate / base 18.51→29.40 /30.37→29.70
Allocation 1 base / candidate 26.15→28.78 /29.64→26.84
Allocation 2 candidate / base 24.58→24.31 /23.48→22.24

All arms, including higher-load windows, remain included. Load is context, not an excuse or exclusion. No final Gateway verdict follows from these owner results.

Archived-leaf repair: 62aeea2bf7a05d20758152ff27b044289e150491 → 929c693f7250b0deeaa448670df87b4bd0c64e49, both with archives on the same upstream base. Each arm performs 2,000 public lists after 48 warmups over 100proven archived leaves in 10,000 sessions: 4,000 timing lists and 4,000 allocation lists per side.

Leaf metric /2,000 lists Base Candidate Change
Main-thread CPU 5,990.702 ms 3,765.651 ms −2,225.051 ms (−37.14%)
Sampled allocation 5,474,348,736 B 3,549,152,652 B −1,925,196,084 B (−35.17%)
Wall time 11,811.639 ms 9,608.084 ms −2,203.555 ms (−18.66%)
Supplemental post-read heap / RSS 272.715 /1,299.566 MiB 271.504 /1,250.883 MiB −1.211 /−48.683 MiB

CPU pairs improve 38.67%/35.48%, allocation 35.51%/34.82%, wall 20.03%/17.20%. Every arm reuses 100row identities, matches payload goldens and conserves 750 resident/1,738 archived runs. No extra pair ran; all arms remain. Main-isolate heap and process RSS snapshots supplement the separate registry proof. Raw identities, counts, loads and hashes are in owner-comparison-929c693f7250/summary.md and archive-transient-owner-comparison-929c693f7250/summary.md under the lane evidence directory.

Previous owner results — retained context, not current-runtime proof

The same registry workload used 4,000 timing/4,000 allocation reads per side at 89;3748 and 17ee each included their one predeclared extra timing pair after mixed signs, totaling 6,000 timing/4,000 allocation reads per side. Every candidate retained 3,000of10,000 runs after reads. Values below preserve the unfavorable results as well as retained-heap gains.

Measured base→candidate Retained heap after archive / after reads (MiB) CPU and wall /2,000 reads Allocation /2,000 reads After-read RSS including workers
8c69e8b71d3be0a8543e3480161e8e01f4fd9e5c→3748c5f4300b166d7367b8fe051ca44efb192f6d 23.989→8.769 (−15.220,−63.45%);26.904→10.500 (−16.404,−60.97%) Main 828.033→751.584 ms (−76.449,−9.23%); process 1,442.627→1,383.021 (−59.606,−4.13%); wall 1,180.433→1,107.699 (−72.733,−6.16%) 363.712→372.475 MiB (+8.763,+2.41%); pairs+1.93%/+2.89% 756.708→847.512 MiB (+90.805,+12.00%)
2bf9cb68e2a81891789055a4183fe60454235b60→17ee5c10114fe6ca7d75e72844be59cd2c9d035d 23.993→8.710 (−15.282,−63.70%);26.920→10.501 (−16.419,−60.99%) Main 1,432.382→1,582.147 ms (+149.766,+10.46%); process 2,579.475→2,877.853 (+298.378,+11.57%); wall 3,060.841→3,818.656 (+757.815,+24.76%) 363.097→370.734 MiB (+7.637,+2.10%); pairs+1.50%/+2.72% 755.457→847.877 MiB (+92.420,+12.23%)
7d5130f74c226ef71ce4858f9e3f95b166447586→89a9dd0606ed06785a3a8deac6ab67192bf532e5 24.782→9.517 (−15.265,−61.60%);27.815→11.318 (−16.497,−59.31%) Main 839.145→813.438 ms (−25.707,−3.06%); process 1,533.701→1,492.507 (−41.194,−2.69%) 361.242→372.098 MiB (+10.856,+3.01%); pairs+3.61%/+2.40% 751.025→854.174 MiB (+103.150,+13.73%)

3748 CPU pairs were−29.15%,+0.27%,+7.49%, not a consistent win; loads 8.93–14.03.17ee CPU pairs were+2.37%,−0.84%,+21.41%; its third pair is retained, with host load base 30.10→30.37 and candidate 33.27→43.30 versus approximately 15.66–16.15 in the first two pairs.89 CPU pairs improved 3.09%/3.04%, but sampled-pass CPU rose 13.33%; raw main heap 121.619→105.295 MiB (−16.325,−13.42%). Its one-time archival costs were 88.688/92.172 ms main CPU,3,126.138/3,489.221 ms process CPU and 66.017/65.549 MiB sampled allocation; loads 10.83–12.93. These are retained costs, not normalized away.

Earlier registry observations: 1bf930c8e40a547f0e2eda87f895b2a7a00e644a→fa8fab07122647857bc6d805240db5b92940f896: after-read retained heap 25.244→10.482 MiB, CPU−15.04%, allocation+1.93%, RSS+99.300 MiB. b39e2d09329cc81b09cf55980a2506623236ea59→f676a2af40fce5144bf21df41886fb127329ddad: heap 25.393→8.851 MiB, CPU−16.15%, allocation+2.19%, RSS+91.141 MiB.

All leaf comparisons below used 4,000 timing and 4,000 allocation lists per side,2,000lists/arm after 48 warmups,100 archived leaves in 10,000 sessions. Both sides already implement archives; they isolate presentation changes.

Leaf repair revisions Main CPU / allocation / wall Supplemental heap/RSS and caveats
fe0eef28994ef419544e3c55d70c2e4d0df9c62a→3748 5,649.130→3,269.535 ms (−2,379.595,−42.12%);5,488,304,600→3,547,441,776 B (−1,940,862,824,−35.36%);11,400.524→8,846.842 ms (−2,553.682,−22.40%) Heap 276.375→271.526 MiB (−4.849,−1.75%); RSS 1,372.751→1,333.819 (−38.932,−2.84%). CPU pairs−42.97%/−41.29%, allocation−35.53%/−35.20%.
041435e1b8a8219d2a176dbddd37aacf033b5207→17ee 8,453.438→6,409.312 ms (−2,044.126,−24.18%);5,479,990,548→3,556,969,948 B (−1,923,020,600,−35.09%);wall 16,228.762→17,218.438 ms (+989.676,+6.10%) Heap 272.581→271.435 MiB (−1.147,−0.42%); RSS 1,283.963→1,255.827 (−28.136,−2.19%). CPU pairs−26.87%/−22.02%, allocation−35.04%/−35.15%; wall mixed−12.43%/+20.76%, retained as context.
4a262dc1857e10430b29981c48987a0db8629675→7a86a101d3f53e940acc63167645a041a98b316d 11,737.695→5,928.428 ms (−49.49%);10,343,191,932→5,481,685,820 B (−47.00%);17,726.501→11,758.176 ms (−33.67%) Identity reuse 0/100→100/100; CPU pairs−49.87%/−49.12%, allocation−46.94%/−47.06%, loads 5.71–8.02. A setup failure preceded measurement; a display-only error after the first durable result resumed without repeating/discarding that arm.

Every leaf arm preserved golden payloads and 750 resident/1,738 archived runs. The old intermediate publication-identity machinery measured at 7a has since been replaced by immutable resident-source reuse; the historical improvement is not claimed as the final whole-Gateway result.

Gateway stress history — all adverse/stopped comparisons retained

The canonical synthetic workload uses 10,800 sessions,65WebSocket clients, concurrent native mock-provider turns/tools, sidebar/list/search churn and 4,300kept runs. The plugin fixture enables 40bundled catalog entries; before workload 11runtime plugins are active, including additional memory-core, and 30catalog entries are lazy. This is not a claim of 40active modules. Required acpx/codex/diagnostics-prometheus/openai plugins are active. Every full timing arm below lasts 10 minutes; complete windows, failed-arm logs, sample counts and host load are retained. No maintenance/pause window is trimmed after results. These are earlier revisions, not final acceptance.

Actual base→candidate Completed evidence, adverse measurements and disposition
7d5130f74c226ef71ce4858f9e3f95b166447586→7a86a101d3f53e940acc63167645a041a98b316d 8 timing arms/80 minutes,2AB/BA comparisons+2A/A pairs. CPU 7.1154→8.9178% (+1.8024 points,+25.33%); paired+32.81%/+18.65%, controls+19.46%/−4.68%, control signed mean+0.5020 points (+7.07%). CPU adverse beyond controls. Handler mean 7.7063→18.4460 ms; histogram p99 estimate 34.5173→81.3056 ms,1,173 samples/arm; A/A handler mean itself+50.94%, so latency is not an independent clean gate. GC+89.87 ms/min versus A/A+98.48: inconclusive; fewer than 4 controls. RSS 2,546.56→2,474.05 MiB (−72.51), heap 519.04→508.48 (−10.55), settled old 401.89→393.10 (−8.79). Comparison host means 6.77→6.68 /16.48→10.91; A/A6.97→34.50 /5.82→6.80. Every arm 40 turns/tools; candidates archived 1,280, leaving 3,020 hot. Retired at declared checkpoint before allocation.
Same 7d base→4a262dc1857e10430b29981c48987a0db8629675 (7695 adds only diagnostics) 8 timing arms/80 minutes,2comparison+2control pairs. CPU 6.5071→9.3887% (+2.8816 points,+44.28%); both pairs>40%. Handler mean 7.0768→18.2311 ms (+11.1543,+157.62%); histogram p99 29.4010→72.6954 ms,1,173 samples/arm. A/A CPU−22.62%/−7.70%, handler means−1.6152/−0.6548 ms. CPU/handler adverse beyond controls. GC+131.54 ms/min unclassified with only 2A/A pairs. RSS+16.9976 MiB; settled old−2.9316 MiB. Candidates archived 1,408of4,300; all arms 40 turns/tools. Declared checkpoint stopped campaign before allocation to repair redundant work; higher-load control retained.
1bf930c8e40a547f0e2eda87f895b2a7a00e644a→fa8fab07122647857bc6d805240db5b92940f896 One complete 10-minute comparison pair before declared CI pause. CPU 6.745→9.644%; handler mean 7.265→19.300 ms, p99estimate30.34→77.30 ms,1,173 samples/arm; GC 0.13541→0.26582 s/min; host 8.28→10.42. RSS 2,518.10→2,473.29 MiB; heap 505.61→522.81 MiB. Both arms 40 turns/tools. No controls: no adverse verdict. Retired after reproduced owner-cohort correctness defect.
af8ab7089f6555497abb30b36a460e890ba3e537→89666efc783019a35695ac73575c6349933a26a7 8 timing arms; declared stop before allocation. CPU 7.625→10.246% (+34.37%), pairs+27.53%/+43.36% versus A/A−7.08%/−5.43%. Handler mean 8.467→22.561 ms versus A/A−0.146 ms; p99estimate50.34→102.79 ms,1,173 samples/arm. CPU/handler adverse, prompting scoped selection. GC 0.17825→0.39210 s/min unclassified with 2 controls. Host 18.22→12.67; all arms 40 turns/tools.
b39e2d09329cc81b09cf55980a2506623236ea59→f676a2af40fce5144bf21df41886fb127329ddad 4 timing arms before declared repair pause. Comparison CPU 7.315→11.272%; p99estimate50.67→184.83 ms. A/A CPU 8.118→7.440%; p99 81.35→36.82 ms. One comparison/control pair: context, no verdict. Archived-only model search regression prompted repair.
52fbfb7d989207a4f82544f58b5bb9ee75782fe9→4df64377f9873ca43b8200ac4ca8d19129d2f83f 8 timing arms plus one complete allocation baseline. CPU 9.173→11.417% (+24.47%), but A/A+33.64%/+1.70%; GC and max pause also tripped controls: inconclusive. Allocation candidate failed native completion and is not a comparison. Separate worker proof found unrelated archive-revision invalidation of a current resident child and led to exact-owned-ID repair; failed-arm logs do not conclusively attribute that arm to archival.

The 3748 paired 30-second setup smoke passed:65 clients/10,800 sessions,4 native-subagent turns+4 tools/results,59 sessions.list calls per arm,0RPCerrors. Candidate moved 128 of 4,300 runs; total conserved. All 17owned processes exited. Its full 16-arm campaign never started because the next actual merge conflict required integration. This smoke is not a10-minute performance comparison. No 929c whole-Gateway result is claimed. The completed 94c campaign is reported separately above.

CI and performance disposition

Exact-head required CI is green for 4f5c80371653d74babd77502ac098646e3e21e79: run41207959008,148successful jobs/19skipped, including all three PostgreSQL shards. Preflight proves tested merge 884acd18038624edd17b8959d74e63529bed82bb against main dbc102dde5301dfccc5ef9d4e997d415912f9c18. The post-campaign PR read confirms the same head, OPEN/ready, but CONFLICTING after main advanced. CI remains green:194successful check runs,59skipped,1neutral(CodeQL),one cancelled older PR-context check superseded by a successful same-head replacement; all three legacy contexts (openclaw/dependency-review, openclaw/security-sensitive-review, openclaw/ci-gate) are SUCCESS. Mergeability is separate from CI. The reviewed/measured candidate is preserved under the adverse performance STOP/REJECT rule; it is not represented as landable or as validated against newer main.

The repaired40tests passed locally through their unchanged assertions and canonical database-worker route; exact CI aggregate and routing-plan proof passed. Individual named CI execution of those tests or the restart/terminal/native E2E files was not independently located and is not inferred from shard names. No CI rerun or dispatch was requested. Do not merge: the completed controlled Gateway comparison fails the CPU and allocation gates.

Current 94c passed 88 integration tests across reload/prepared-read/archive-index and scheduled-turn/restart consumers. The combined source exceeded its line cap; merging two adjacent early-return conditions removed three production lines without weakening either check. Review 48 is clean, and the32affected reload/prepared-read cases pass after that simplification. Final six-file lint/format, core/Gateway-root/messaging type graphs, diff check and pinned 40b test/max-line ratchets pass. The 32 cases are a focused replay, not 32 additional unique contracts. The final test-routing repair also reruns pnpm tsgo:test:root across all four partitions. Captured and committed guard patches match exactly. Storage audit 40b passes with unchanged migration/upgrade/rollback inputs.

Prior94c CI 41206172772 tested merge c77555f26e724bbc27baf14bbe6a67b7da4ec412 against main fab8e58a7f818eaa626664780c1f9038b5555850. Two consumers failed: retained-send15 assertions and memory-flush8 assertions. Original full-file replays on frozen40b and94c matched exactly: retained sends15failed/10passed each, memory flush8failed/7passed each. These prove inherited behavior on40b; exactfab8 was not replayed. Logs and paired source/runtime receipts remain in the lane evidence directory.

The final repair adds those two files to the existing database-worker test inventory. Their real SQLite paths require the canonical host-admission owner missing from raw-thread dispatch. No production guard, assertion, timeout or skip changed. Review49 is clean; all40 original tests,12 registry tests and one plan case pass, along with lint/format, all four pnpm tsgo:test:root partitions and ratchets. Exact4f CI now passes; the old red run remains recorded below. Main40b/candidate94c builds are complete and final4f changes only two routing entries, so the completed full16-arm controlled Gateway comparison uses those builds with the candidate production-identical to final4f. Its complete results are reported above. Prior8b/5663 CI were blocked by actual conflicts. No rerun or dispatch chased green.

Executed CI evidence Outcome and current meaning
3748 run41200856654, actual merge71a922b16c68e1b46f5a092c9a95406298de2cca / main298b86c81fa0efa8eab67fa5eddb94232dd69ef6 Actual restart 2/2 (8.590 s/55.651 s), terminal 1/1, native cancellation 1/1, requester-owner 3/3 and lint-core-2 passed. Two extension jobs failed: memory obsolete immediate-integrity expectation and Signal 120 s timeout. Last available projection was explicitly stale (142 pass,2PG running,18skip,2 fail); no final aggregate is invented. Memory repair preserves deferred admission, verifies real FTS results and matching/missing seal after canonical close; full 7/7 and strict types/lint/ratchets pass. Unchanged Signal 5/5 local replay, timeout case 365 ms, is non-reproduction only, not fixed/inherited/flaky proof.
17ee run41197412805, mergecc6c858249d6f8bce99b7d632dd11206083a1e01 / main7293e892728aef27996d8a15626e006e2d537dcc 145 pass/19skip/3 fail including aggregate. Visitor lint fixed by deleting 13 redundant fixture-host lines; real central owner retains awaited cleanup, visitor 5/5 passes. Restart true 8,444 ms passed, false 180,000 ms timed out; local unchanged 2/2 replay (11.080 s/52.562 s) and later 3748 CI pass do not identify a source fix. Last shutdown log cannot exclude body failure followed by hung cleanup. All 3PG jobs, iOS, Android and selected terminal/native tests passed; Periphery auxiliary eventually passed.
7a run41178349599, merge0a9e3072c90a43a99afa7f9a60f4adfd80414cff / main261e0e2466e1d15bb47784d077bb85eff2874f49 134 pass/11 fail/20skip. Diagnostics accounting defect was ours and repaired without weakening 3 ms assertion; actual ingress resolver ownership repaired SDK fixtures. Main41176844002 independently reproduced meeting/visitor host failures, not every failure. Main restored Doctor capture semantics, so 3fixture accommodations were removed. Restart 2/2, terminal/native and 3PG jobs passed; iOS failed during simulator setup.

Earlier896 CI passed 144 jobs/19 skipped, and 7695's exact CI passed required jobs including restart 2/2 (73.01 s), terminal/native and 3PG jobs. These are prior heads, not current green. The prior 4a restart failure passed its first exact-merge local replay 2/2 (87.89 s); added marker/rejection diagnostics passed 2/2 (78.70 s), without a runtime fix or relaxed assertion. Our earlier missed perf-script argument and registration cohort defect were repaired with focused proof. Unrelated duplicate fixture repairs were dropped when upstream supplied them. All once-fetched failure logs remain available.

Executed with Node26.12.1 from the frozen40b tooling checkout; <base>, <candidate> and <isolated-output> stand for the captured absolute lane paths. Completed performance protocol: canonical tooling at or aftered32fdcd, including later loader fixes, against already-built exact revisions:

node --import ./scripts/tsx.mjs scripts/perf/team-shape-stress.ts --base <base> --candidate <candidate> --output <isolated-output> --minutes 10 --pairs 2 --kept-run-age-days 100 --aa-pairs 2 --mode both

The complete AB/BA comparison and matching A/A timing/allocation passes ran, retaining every completed window. The current report includes main-thread CPU, allocation rate, GC s/min by kind and both maximum pauses, event-loop p99, client sessions.list p99, server-handler latency, RSS/heap, sample counts and per-arm host load. Client list/loop tails alone do not reject; p99 needs 1,000 samples, p95 needs 200; major-GC tails below 50 collections are context. GC/promotion/max-pause rejection needs at least 4 matched controls in the same instrumentation mode. Honor absolute materiality/noise rules, including+50 ms/min GC or+1 ms/op, sub-ms tail context and predeclared extra pairs for mixed signs. No local checks overlap measured windows; never load Team. The adverse CPU/allocation gates and earlier unfavorable outcomes are not waived by owner improvements.

Size and evidence retention

Pinned source comparison40b332d1a8a97ab955a08b17e27554f5fa7b94cd...4f5c80371653d74babd77502ac098646e3e21e79 reports 93 files,+2,960/−717=net+2,243 under the prescribed filter:

git diff --stat <base>...<head> -- ':!*.test.ts' ':!*test-support*' ':!docs/*'

This includes generated catalogs, perf tooling and some test-support/Swift files, not a manually classified production-only count. Growth implements the accepted schema/migration, bounded atomic transfer and complete read/mutation cutover; a sweeper-only change would hide results, ancestry, capacity or recovery facts. Source reuse deletes the extra identity and two net production lines. The test-line ratchet passes at 6,343,781 / 6,368,259 (24,478 lines of headroom); this final diff changes neither the shared ceiling nor per-lane allocation files. There are no new config options or benchmark lint suppressions, and benchmark usage lives in script headers/per-script documentation rather than appended shared README sections.

This body consolidates repeated chronology without discarding measurements. Complete raw reports, hashes and per-arm telemetry remain under .local/buf626/: owner-comparison-{929c693f7250,3748c5f4300b,17ee5c10114f,89a9dd0606ed}, matching archive-transient-owner-comparison-*, archive-leaf-owner-comparison-7a86a101d3f5-v2, and each team-stress-comparison-* checkpoint. Corrected-premise evidence, upgrade receipts, cleanup/PID manifests, review reports and CI logs remain alongside them. The previous full body is preserved as pr-body-3ef6-pending.md (SHA256 21890bb6d74c485b79f801342f5ed5d4ec59625386f83b343a2bb7daff46a2df). Public CI links above provide execution evidence; local artifacts are not public attachments.

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL labels Oct 30, 2026
@steipete
steipete marked this pull request as ready for review October 30, 2026 15:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T13:38:59.824775Z 94c5798 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24dd782fc7

ℹ️ 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".

Comment on lines +312 to +316
const keys = targets.map((_, index) => keyAt(index));
return prepareSessionRowSubagentArchive(keys).then((archive) => {
subagentArchive = archive;
subagentArchiveKeys = keys;
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reuse archive preparation across unchanged session-row reads

For repeated list, describe, or event reads on an already-clean projection, subagentArchive starts unset on each invocation, so this unconditionally issues another archive worker read. The sessions branch of loadSubagentArchivedRunsInDatabase then loads and indexes the entire archive topology and, when any archive exists, the entire hot topology—even for a single unrelated session. Consequently, routine polling becomes proportional to all retained run history instead of the selected page, reintroducing recurring database and allocation costs as history grows. Retain a bounded, owner-invalidated prepared view across clean reads rather than rebuilding it for every request. This violates the clean-projection no-SQL requirement in src/gateway/AGENTS.md.

AGENTS.md reference: src/gateway/AGENTS.md:L50-L50

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full-registry scan is fixed in the archive read owner. Session scopes now walk indexed requester/controller relationships, then include every archived generation of the selected children. The regression preserves returned records while reducing unrelated identities fetched across four reads from 256 to zero; an empty archive also returns before reading hot identities. The store and public-read files pass all 19 tests.

Prepared archive records and topology remain request-owned under the accepted cold-storage contract. The existing bounded derived display-output cache remains in use; retaining a prepared run map across requests would reintroduce archive residency. The Gateway guide now states the cold-history preparation boundary explicitly. Indexed on-demand SQL is the chosen tradeoff, and the required full Gateway comparison with matching controls is still pending; I will report its cost in the PR rather than treating the focused work-count proof as sufficient.

@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 30, 2026
@blacksmith-sh

This comment has been minimized.

@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR archives settled kept subagent runs after 30 days while preserving historical reads and follow-ups.

Example: A kept subagent completed 31 days ago with all delivery and cleanup obligations settled.

  • Before: Its record remains in the hot database table and resident registry indefinitely.
  • After: The sweeper moves its record to archive storage; inspection still returns its result, and a follow-up restores its exact generation.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The approved archive design is useful, but confirmed regressions and incomplete authority, performance, and upgrade evidence prevent a passing review.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Completed kept subagent history continues to grow the Gateway's resident registry even after individual payloads are compacted.
Reason: The maintainer-authored direction provides clear memory-retention value and records approval of the storage and rollback contract; the added options are benchmark-script flags rather than runtime configuration.

Merge readiness

⛔ Blocked before merge - 8 items remain

Keep open: this maintainer-authored performance change addresses retained registry growth, but introduces compatibility, cancellation-ordering, and read-path regressions that need repair before merge.

Priority: P2
Reviewed head: 24dd782fc7d32c5882a910e24ad20c4ace1c6f75

Before merge

  • Add real behavior proof - Authority-chain proof required: demonstrate archived-parent cancellation through the real cancellation owner for an allowed controller, a foreign controller, and a controller/session replaced during preparation, showing rejection before native abort or process cancellation. Supplied evidence describes storage and in-process tests; Gateway performance remains explicitly in progress, and no inspectable latest-stable shipped-entry-point upgrade output is attached. Redact addresses, credentials, phone numbers, and non-public endpoints from supplied traces. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Preserve clean projection reads without repeated archive preparation (P1) - Every withPreparedExactRows invocation initializes subagentArchive from an optional request argument, so ordinary repeated list, describe, and event reads prepare it again even when the projection is clean. The sessions reader then scans and indexes all archive topology and, whenever archives exist, all hot topology. Polling a small unchanged page therefore becomes proportional to retained history and adds SQL to the clean-read path forbidden by src/gateway/AGENTS.md. Reuse bounded owner-invalidated prepared facts and select cold relationships through indexes instead of rebuilding global topology per request.
  • Update native schema support alongside the shared-state bump (P1) - After startup or Doctor migrates shared state to version 37, the native code in OpenClawNativeStateSQLite still rejects anything above 36. PortGuardianRecordStore uses that guard when opening the shared database, so even a native app built from this PR refuses the newly migrated store with a newer-app error. Update the native supported version and fixture together and exercise the native store against migrated state; exact-head CI already reports this version drift.
  • Capture queued cancellation holds before preparing archived ancestry (P1) - The new await runs before killSelectedSubagentRuns enters withSubagentKillScope. Even a fully resident queued collector now yields while prepareSubagentKillRuns discovers archive bridges, allowing the scheduled swarm pump to dispatch it before cancellation acquires its reservation hold. The existing scope deliberately captures resident roots and descendants before its first await, and exact-head cancellation tests now observe dispatch before beforeKill. Perform archive preparation under that existing cancellation custody, preserving holds across the await.
  • Keep private memory-row reads out of the durable archive reader (P2) - withMemorySessionRows handles incognito actor-backed rows, but this call now enters withHistoricalSessionListRuns, which prepares persisted registry facts and issues an archive worker read in production. Reading a private row therefore acquires a durable-database dependency and can fail on shared-state admission even though its actor is readable. This violates the Gateway memory-session contract; use current in-memory or actor-owned child facts for this path and reserve archive reads for durable sessions.
  • Resolve security concern: Verify authority after restoring archived cancellation bridges - Restored historical rows enter native cancellation selection; the added archive tests demonstrate successful cancellation, while the supplied foreign/replacement evidence does not establish rejection on this archived bridge path before abort or process cancellation.
  • Resolve merge risk - The PR owner must prove that archived cancellation ancestry cannot authorize termination from a foreign controller or after controller/session replacement before native abort or process cancellation.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P1] Preserve clean projection reads without repeated archive preparation — src/gateway/session-row-projection-ancestors.ts:307-313
  • [P1] Update native schema support alongside the shared-state bump — src/state/openclaw-schema-versions.ts:45
  • [P1] Capture queued cancellation holds before preparing archived ancestry — src/agents/subagents/registry/subagent-control-kill.ts:472-474
  • [medium] Verify authority after restoring archived cancellation bridges — src/agents/subagents/registry/subagent-control-scope.ts:181

Tests

  • Missing end-to-end proof: Attach completed Gateway performance results, an inspectable latest-stable startup/Doctor upgrade with preserved settings and run data, and archived-ancestry cancellation traces covering allowed, foreign, and replaced controllers before final effects.
Agent review details

How this fits together

The subagent registry owns durable run records and publishes resident facts consumed by agent tools, admission, cancellation, restart recovery, and Gateway session projections.

flowchart TD
  A[Registry sweeper] --> B[Existing registry writer]
  B --> C[Hot run storage]
  B --> D[Archived run storage]
  C --> E[Prepared registry reads]
  D --> E
  E --> F[Tools and Gateway projections]
  F --> B
Loading

Technical review

Best possible solution:

Keep archival in the existing registry writer, preserve cancellation holds and private-memory isolation, align native schema support, and serve unchanged projection reads without repeated archive queries.

Do we have a high-confidence way to reproduce the issue?

Current main explicitly gives settled kept run-mode records an infinite sweep deadline; the introduced native-version mismatch and cancellation ordering are also source-verifiable and supported by exact-head CI annotations.

Is this the best way to solve the issue?

A durable archive behind the existing writer is a coherent solution, but request-scoped global rescans undermine its performance goal and the cutover must preserve native, cancellation, and memory-session contracts.

Full review comments:

  • [P1] Preserve clean projection reads without repeated archive preparation — src/gateway/session-row-projection-ancestors.ts:307-313
    Every withPreparedExactRows invocation initializes subagentArchive from an optional request argument, so ordinary repeated list, describe, and event reads prepare it again even when the projection is clean. The sessions reader then scans and indexes all archive topology and, whenever archives exist, all hot topology. Polling a small unchanged page therefore becomes proportional to retained history and adds SQL to the clean-read path forbidden by src/gateway/AGENTS.md. Reuse bounded owner-invalidated prepared facts and select cold relationships through indexes instead of rebuilding global topology per request.
    Confidence: 0.99
  • [P1] Update native schema support alongside the shared-state bump — src/state/openclaw-schema-versions.ts:45
    After startup or Doctor migrates shared state to version 37, the native code in OpenClawNativeStateSQLite still rejects anything above 36. PortGuardianRecordStore uses that guard when opening the shared database, so even a native app built from this PR refuses the newly migrated store with a newer-app error. Update the native supported version and fixture together and exercise the native store against migrated state; exact-head CI already reports this version drift.
    Confidence: 1
  • [P1] Capture queued cancellation holds before preparing archived ancestry — src/agents/subagents/registry/subagent-control-kill.ts:472-474
    The new await runs before killSelectedSubagentRuns enters withSubagentKillScope. Even a fully resident queued collector now yields while prepareSubagentKillRuns discovers archive bridges, allowing the scheduled swarm pump to dispatch it before cancellation acquires its reservation hold. The existing scope deliberately captures resident roots and descendants before its first await, and exact-head cancellation tests now observe dispatch before beforeKill. Perform archive preparation under that existing cancellation custody, preserving holds across the await.
    Confidence: 0.99
  • [P2] Keep private memory-row reads out of the durable archive reader — src/gateway/session-row-projection-memory.ts:145-147
    withMemorySessionRows handles incognito actor-backed rows, but this call now enters withHistoricalSessionListRuns, which prepares persisted registry facts and issues an archive worker read in production. Reading a private row therefore acquires a durable-database dependency and can fail on shared-state admission even though its actor is readable. This violates the Gateway memory-session contract; use current in-memory or actor-owned child facts for this path and reserve archive reads for durable sessions.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 225af953d1b1.

Merge-risk options

Maintainer options:

  1. Repair the existing owner paths before merging (recommended)
    The PR owner should address the listed defects and demonstrate allowed, foreign-controller, and replaced-controller cancellation through archived ancestry at the final effect.

Provenance checked

  • Settled-run sweep membership changes intended behavior with a stated reason (619555b: The existing work index excludes settled history until cleanup becomes due, avoiding recurring lifecycle work while preserving retention and unfinished obligations.)
  • Session-row preparation changes intended behavior with a stated reason (ae9b009: The prior change carries selected row references through preparation to remove repeated lookup work; this PR explains its request-owned archive design, but reintroduces recurring preparation costs.)
  • Graceful restart resume keeps the original intent (9344233: Shutdown snapshots live owners and resumes root sessions through ordinary input rather than treating persisted recovery records as execution authority.)

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete authorization bypass was established, but restored archive ancestry needs final-effect rejection proof for foreign and replaced controllers.

Evidence

Security concerns:

  • [medium] Verify authority after restoring archived cancellation bridges — src/agents/subagents/registry/subagent-control-scope.ts:181
    Restored historical rows enter native cancellation selection; the added archive tests demonstrate successful cancellation, while the supplied foreign/replacement evidence does not establish rejection on this archived bridge path before abort or process cancellation.
    Confidence: 0.85

What I checked:

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

  • add P2: Bounding retained subagent memory is a useful performance improvement without evidence of an urgent current-main outage.
  • add merge-risk: 🚨 compatibility: Schema 37 currently exceeds the native client's supported version and prevents its shared-state store from opening.
  • add merge-risk: 🚨 session-state: Cancellation preparation now yields before queued-run reservations are held, allowing selected work to dispatch.
  • add merge-risk: 🚨 security-boundary: Archived lineage is restored into cancellation selection without supplied final-effect rejection proof for foreign or replaced controllers on that archive path.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: Bounding retained subagent memory is a useful performance improvement without evidence of an urgent current-main outage.
  • merge-risk: 🚨 compatibility: Schema 37 currently exceeds the native client's supported version and prevents its shared-state store from opening.
  • merge-risk: 🚨 session-state: Cancellation preparation now yields before queued-run reservations are held, allowing selected work to dispatch.
  • merge-risk: 🚨 security-boundary: Archived lineage is restored into cancellation selection without supplied final-effect rejection proof for foreign or replaced controllers on that archive path.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 30, 2026, 12:10 PM ET / 16:10 UTC.

@openclaw-barnacle openclaw-barnacle Bot added the channel: voice-call Channel integration: voice-call label Oct 30, 2026
@steipete
steipete force-pushed the steipete/perf-subagent-keep-run-archive-20261030 branch from 75ff2ab to 0d0da61 Compare October 30, 2026 17:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d0da6104a

ℹ️ 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".

Comment on lines +556 to +560
const archived = decodeSubagentRegistryRows(
readSubagentSessionListRows(
scope.kind === "children" ? { childSessionKeys: scope.sessionKeys } : {},
database,
"subagent_run_archives",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Filter archived run-ID lookups before decoding history

When the scope is ids without exact, this passes an empty filter to readSubagentSessionListRows, projects and decodes every archived record, and only then selects matching IDs through SubagentSessionReadLookup. subagents.wait reaches this branch through prepareSubagentRunsSnapshotForRunIds even when its requested runs are all hot. Consequently, waiting on a single current task now incurs database JSON processing and worker allocations proportional to the entire indefinitely retained archive. Apply the run-ID/alias selection in storage before projecting and decoding historical records, while preserving alias lookup behavior.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the steipete/perf-subagent-keep-run-archive-20261030 branch from 0d0da61 to 067e03b Compare October 30, 2026 17:49
@steipete
steipete marked this pull request as draft October 30, 2026 18:53
@steipete
steipete marked this pull request as ready for review October 30, 2026 19:26
@steipete
steipete force-pushed the steipete/perf-subagent-keep-run-archive-20261030 branch 3 times, most recently from dbe2bcd to 693ecd1 Compare October 30, 2026 23:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89666efc78

ℹ️ 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".

Comment on lines +189 to +193
const archive = await prepareSubagentArchiveSessionListRead({
kind: "sessions",
sessionKeys: [requesterSessionKey],
descendants: true,
liveTopology: getSubagentSessionReadLookup(runs).captureTopology(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit capacity preparation to history connecting pending work

For a long-lived requester with many archived completed children, every ordinary non-collector spawn now reloads and decodes that requester's entire archived descendant closure, even when no pending children exist and the capacity count is zero. Both subagent-spawn-request.ts and acp-spawn.ts call this preparation during admission; the session-scoped archive reader enumerates all matching historical generations and projects their metadata. Previously, capacity counting consumed resident metadata without repeating database history reads. Restrict historical preparation to ancestry needed by currently pending work, including skipping it when no pending work exists, so indefinitely retained history does not impose growing database and allocation costs on every new spawn.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6db7808f0

ℹ️ 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".

Comment on lines +145 to 147
...(await listSubagentSessionListRunsForControllers([query.key])).map(
(run) => run.childSessionKey,
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep incognito child discovery on the memory path

For every existing incognito row, this now calls the asynchronous historical reader, which unconditionally prepares the persisted registry cache and reads the archive through the shared-state worker in production—even when the session has no children. Consequently, describing an actor-backed incognito session now depends on SQLite admission and worker availability instead of consuming its memory-owned facts. Use actor-owned or bounded live child metadata here without entering archive preparation for incognito rows.

AGENTS.md reference: src/gateway/AGENTS.md:L57-L57

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the steipete/perf-subagent-keep-run-archive-20261030 branch from d6db780 to fa8fab0 Compare October 31, 2026 03:03
@steipete
steipete force-pushed the steipete/perf-subagent-keep-run-archive-20261030 branch from fa8fab0 to 89a9dd0 Compare October 31, 2026 04:00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89a9dd0606

ℹ️ 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".

.selectEntries({ key: exactKey }, true)
.map((row) => row.key),
}
: undefined,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope parent-filtered list history to the requested tree

For a paginated sessions.list({ spawnedBy: parent }) request without an exact key, needsBroadArchive() forces this branch, but passing undefined requests { kind: "all" }. The archive worker consequently projects and decodes every retained archived run, including unrelated trees, before applying the parent filter. The indexed session-reader repair does not cover this path because this caller bypasses that scope, so repeated child-list polling still grows with total retained history. Prepare an indexed scope for the requested parent and any additional child identities needed for presentation instead.

AGENTS.md reference: src/gateway/AGENTS.md:L51-L51

Useful? React with 👍 / 👎.

@steipete
steipete marked this pull request as draft October 31, 2026 06:32
Bind synthetic plugin hosts to the ingress owner resolver and retain their
cleanup lifecycle. Account for every synchronous list-preparation phase.
Keep archive results request-owned while reusing prepared progress queries.
Remove the separate publication identity and redundant source copies.
Only complete broad archive reads can replace exact-page relationship
preparation. Preserve live physical-child activity when owner-count selection
uses history scoped to one key and registry descendants move elsewhere.
@steipete
steipete force-pushed the steipete/perf-subagent-keep-run-archive-20261030 branch from 8b8b8ef to 94c5798 Compare October 31, 2026 13:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94c5798d3f

ℹ️ 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".

do {
await projection.prepareSelection({ yieldForCatalog: true });
await projection.prepareMembership();
subagentArchive = await prepareSessionRowSubagentArchive();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip archive preparation on cached plugin-facts reads

When a plugin repeats a session-facts selection with unchanged roster and facts, this still prepares the entire archive before reaching the existing !wanted.size cache-hit return. Calling prepareSessionRowSubagentArchive() without a scope selects { kind: "all" }, so even a no-op cached read now projects and decodes all retained historical runs. This introduces database and allocation costs proportional to indefinitely retained history on every poll. Check the unchanged-cache path before preparing history, and scope archive preparation to the identities actually needing selection or refreshed facts.

AGENTS.md reference: src/gateway/AGENTS.md:L51-L51

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

Parking this as a draft. The retention win is real, but the read-path cost is adverse, so it doesn't meet the landing bar.

Retained heap (10k-record fixture, 7,000 records archived): 27.14 → 9.53 MiB after archival (−64.9%), 30.19 → 11.32 MiB after reads (−62.5%).

Cost, 16 ten-minute stress arms (640 turns/tools, zero RPC errors, all records conserved):

Metric Base Candidate Matching A/A
Main-thread CPU 7.33% 9.71% (+32.4%) +10.3%
Allocation 19.63 MiB/s 27.03 MiB/s (+37.7%) +0.01%
Client sessions.list p99 83 ms 318 ms inconclusive
Server handler mean 9.0 ms 26.0 ms inconclusive

Owner reads alone are +14% CPU and +2.7% allocation. The lane's profiles put the extra work in session filtering and search over archived runs, and in the archive adapter cloning row descriptions and rebuilding presentation on every list.

What a revival would need: archived runs must stay off the sessions.list hot path. For example, a list read that never consults the archive unless the query explicitly asks for archived history, plus presentation built once at archive time. The schema 36→37 step itself is cheap (an empty table, table-scoped backup of subagent_runs, about 117 MB on the largest deployment), so it's not the blocker. The branch also conflicts with current main.

@steipete
steipete marked this pull request as draft October 31, 2026 18:33
steipete added a commit that referenced this pull request Nov 5, 2026
## What Problem This Solves

A repeat captured Doctor still performs two full generation observations around shared-state readability even when no catalog or orphan repair is needed. Its readability helper also opens two empty immediate transactions on that clean path.

The existing schema-repair owner now returns its prepared `needed` fact with `apply`. The prepared schema-repair owner owns its catalog repair transaction and exposes the same prepared apply operation to the generator. The generator consumes the needed fact once. Clean, artifact-free readability can finish without an attributed write phase; retained WAL/journal still use the original initial envelope, and catalog/orphan repair still resumes through capture before writing. The superseded forwarding helper is deleted.

Full Doctor still invokes `apply` unconditionally inside its write transaction, retaining the ownership check after `BEGIN`. Actual repair still checks live authority at effect; original generation baseline, untouched-path final comparison, source custody, cancellation, awaited credentials and closure, and separate state/agent commits remain. No `capture.accept`, `openedSqlitePaths` shortcut, new cache, schema, generation, dependency or finalizer change.

## Acceptance rule (before count runs)

Flow: repeat captured Doctor through committed `scripts/perf/doctor-captured-pass.mts`, starting from the same migrated four-agent/4096-session synthetic fixture at the same absolute path. Baseline must contain landed B1; candidate differs only by the readability owner simplification. Keep the retained-WAL native update flow as a separate compatibility cohort.

Counts first, one matched base/candidate pair: clean no-companion readability removes one before/after generation observation pair (2 generation workers and 2 size workers), its 22 inspection SQL statements, and two empty immediate transactions; measure the remaining SQL/read/request deltas rather than assigning all totals to the deletion. Existing WAL or journal retains the initial envelope. Dirty catalog/orphan repair still enters the original capture before its first write; no skipped path calls capture.accept or marks itself opened. Full Doctor still executes the prepared ownership check unconditionally after BEGIN.

Win: at least the two redundant readability observations removed in the actual repeat flow, total SQL/requests and runtime Gateway MAIN hold or improve, source/refusal/restoration/cleanup behavior unchanged, production net <=0 and test net <=0. Counts for main threads across child processes are labeled separately from runtime Gateway MAIN. No timing result from an instrumented profile is treated as a speedup.

Timing: the campaign timing deadline expired at 2026-11-05T07:08:34Z. This PR uses deterministic worker/SQL/copied-byte counts only; it claims no CPU or wall-time speedup. The retained-WAL native update is a distinct compatibility cohort and is not timed for performance acceptance.

Proof: red/green clean readability transaction/worker counts adapted into existing tests; retain same/different-content outside-write refusal, empty reader transition, malformed catalog plus preserved orphan recovery, synchronous and asynchronous behavior, and full Doctor post-BEGIN authority. Two isolated reviews, PG checklist and approval for exact head, matched native retained-WAL update, exact-head CI including three PG shards and published-driver cell, peer overlap audit.

Expected remaining generation observations after the bounded cut: inventory 3; quick-index 2; readability 0; shared-state/credential opens 6; additive-agent schemas 8; legacy/schema/credential repair 6; total 25. Confirm with the production run; do not infer savings from source alone.

The parameterized migration tests retain direct full-Doctor and readability-first routes for both synchronous SDK and asynchronous Doctor entrypoints. Malformed catalog, preserved orphan payload/BigInt/export, integrity, current version, refusal, and repeat-repair idempotency assertions remain. Production net -8 LOC; tests net -5 LOC.

## Evidence

Current integration head: `e489ad6e51aa7775961d485eda51d7e501e4035a`. Merged current main `f34fb556b7ba6abdeedf102730b9214d61db299d` once to include the auth fake-clock fixture fix from #193451. All six B2 file blobs and B2’s diff against main are identical to the reviewed `e5ede773` patch. Count, native-update and published-driver evidence below therefore carry forward; the new normal pull-request [CI run42024239906](https://github.com/openclaw/openclaw/actions/runs/42024239906) passed, including all three PostgreSQL shards, static checks and the affected Node test groups. Required `openclaw/ci-gate`, dependency-review and security-sensitive-review are successful on this exact head. The prior auth-timer failure did not recur; no rerun was needed. No bypass will be used. Exact-head PostgreSQL review was carried by the coordinator after verifying the unchanged six B2 blobs.

One matched repeat-Doctor pair on Node26.12.1/macOS restored the same pristine four-agent/4096-session synthetic fixture at its original absolute path (1,190files/428,490,104bytes; SHA256 `38f500c594546a577e093b58b3956dc42e3e85ef6d593b6acf15a84c98eadd34`). Both arms passed product/restoration checks and cleaned the fixture.

| Scope | SQL base → candidate | Process-main SQL | Worker SQL | Requests | Copied bytes |
|---|---:|---:|---:|---:|---:|
| Doctor | 118,284 → 117,672 | 117,696 → 117,084 | 588 → 588 | 271 → 271 | 1,066,041,712 → 1,062,633,960 |
| Parent/other | 4,321 → 4,321 | 4,302 → 4,302 | 19 → 19 | 18 → 18 | 427,888,640 → 427,888,640 |
| Whole | 122,605 → 121,993 | 121,998 → 121,386 | 607 → 607 | 289 → 289 | 1,493,930,352 → 1,490,522,600 |

Doctor generation/size27/27→25/25; whole32/32→30/30; process starts184→180. Open/close/execute/task request deltas all0. Process-main is CLI/child thread0, not runtime Gateway MAIN. SQL−612 is the observed pair result; the fixed deletion is22 inspection statements plus two empty transactions, with remaining authority/lease work dependent on elapsed progress. After normalizing elapsed busy_timeout values,34 SQL shapes decrease and none increases. Doctor main copy−3,428,352bytes, WAL prefix+20,600bytes, journal unchanged; total−3,407,752bytes. No timing saving is inferred.

Remaining25 observations: inventory/settlement3, quick-index2, shared-state/credential opens6, additive-agent schemas8, legacy/schema/credential repair6. Readability pair2→0; other categories unchanged. No process/SQL ancestry gaps or PID reuse. The offline comparator initially omitted the four source .ts generation workers per arm; an independent spawn/lifetime audit confirmed them, and accepting only the exact .js/.ts entrypoints fixed comparison without changing raw records or rerunning either product arm. Historical B1 SQL totals are not directly comparable because this baseline includes inherited plugin-preparation work.

The separate retained-WAL native update pair passed exact activation/build identity, deferred-to-completed retirement, real Gateway transport, process stop and zero cleanup errors. Both arms started with identical main/WAL byte counts and identical three Doctor WAL/SHM boundaries.

| Native scope | SQL base → candidate | Requests base → candidate | Generation / size processes base → candidate |
|---|---:|---:|---:|
| Whole flow | 296,063 → 294,567 | 155,714 → 155,716 | 68 / 65 → 64 / 61 |
| Preflight Doctor | 3,608 → 3,580 | 119 → 119 | 0 / 0 → 0 / 0 |
| Installed Doctor | 146,880 → 146,269 | 351 → 351 | 32 / 32 → 30 / 30 |
| Final Doctor | 121,076 → 120,464 | 166 → 166 | 21 / 21 → 19 / 19 |

Direct runtime Gateway MAIN holds: canary 44→44; final Gateway 53→53 (startup/readiness48 + shutdown5). Whole process-main SQL290,019→288,520 is a different metric; workerSQL6,044→6,047. Whole-flow SQL is cadence-dependent, not a fixed per-invocation saving. Native copied bytes are unmeasured, not zero; no CPU/wall speedup or warm-steady claim.

All adverse native movements remain counted: one Doctor lease heartbeat; a shutdown plugin-catalog cache task/read; one canary sandboxRegistry.list schema-version read; and a final startup-integrity completion followed by its database open. Outside-Doctor cache scan0→1 and cache_size2→3 are disclosed. All12 relevant owners are blob-identical base/head. These are timing-dependent background progress differences, cause not proven. The coordinator explicitly accepted +2requests/+3workerSQL and the new cells after source attribution; none is subtracted as noise.

Two raw macOS leaf PIDs were each reused in disjoint process lifetimes. A strict offline split preserves all2,850 process events and62 affected SQL records, every raw hash and total. An isolated independent audit reconciles294,567SQL/155,716requests. Unobserved shell parents leave an ancestry coverage gap; all observed children remain counted (598SQL/0requests each arm, before Doctor).

Validation:132 owner tests passed on the production-equivalent head, including retained artifacts, outside-write refusal, empty readers, credential preparation/close and retirement. The B1 red control performs2 observations versus expected0; B2 passes. Final4 ownership cases, typed lint, format and line-cap pass. Two full isolated Codex reviews plus required production-delta/test corrections are clean. Exact-head PostgreSQL approval is recorded. Local broad check:changed was canceled143 and is not a pass; CI supplies broad gates.

Original proof-head CI run [42003968887](https://github.com/openclaw/openclaw/actions/runs/42003968887) passed all three PostgreSQL shards, types, typed lint, source contracts, ratchets, SDK API diff and the [published-driver/native-systemd cell](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127173500397). The run is not reported green: its original auth timer, deferred-project marker and UI timeout failures remain recorded. The single approved projects retry [127208432932](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127208432932) passed (11:08:56–11:34:54Z). The original marker ENOENT remains disclosed; no source fix or weakened assertion was introduced. The corrected PR body also passed its context/evidence check [127216156959](https://github.com/openclaw/openclaw/actions/runs/42018847897/job/127216156959).

The auth retry reproduced a leftover fake timer at `auth-controller.test.ts:226` and a separate cleanup-authority timeout. After the single Testbox allocation queued and was stopped without executing tests, the coordinator authorized one exact 19-file Node24.22.1/macOS replay per arm, with CI's three workers and isolation configuration unchanged. Both base and candidate reproduce the same timer assertion (base377pass/1fail; candidate382pass/1fail); all other18files pass, and worker cleanup completes. All source archive bytes verified before/after. This establishes matching-signature baseline evidence on macOS, not a Linux result, a fix, or a green suite. The follow-up #193451 attributed this timer to tsx disk-cache initialization captured by the fake clock and prepares it before the clock starts, retaining all assertions. That test-only fix is now included by the main merge; the new normal CI must confirm it on this integration head. The source-identical90s cleanup timeout remains disclosed. No assertion or timeout was weakened.

The UI timeout has no assertion failure and is coordinator-dispositioned as unrelated. Knip's sole `handleUpgradeRequest` export finding is independently reproduced in scheduled main run41994726590/job127135524057, then fixed on main by73145; the prospective merge retains the exact fixed blob. No new static findings are accepted.

Production net−8 LOC; tests net−5 LOC. Benchmark +12 lines adds a freshly created explicit scratch root so arms run at the same absolute path; default path and cleanup are unchanged. No B2 file changes followed final review; the current head additionally contains the unchanged main merge described above.

Overlap refreshed on the integrated head through the shared PR index: #193393 at `f545ae3d` merges cleanly both before and after B2; #192228/#188492/#166475/#149882/#146868 add no conflicts (7/34/18/92/7 inherited paths respectively). #192698 retains 2,751 conflicting paths in both arms and no new conflict relation. The repair-owner block is resegmented inside its already-conflicted file, covered by the coordinator’s explicit standing disposition for that draft. The previous 2,912-path count belonged to the earlier base. No per-PR census was used.

Acceptance marker: `DOCTORGEN-B2-COUNTS-e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`. Measured candidate: `e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`; exact base: `ef81b2545c8cf6f20f1b2723628fc5291d45bde0`. The same existing migrated fixture is restored at one path for each count arm; the native retained-WAL cohort is separately restored at its own fixed path.

Final test-only correction restores the baseline DatabaseSync.exec descriptor capture after typed lint rejected the direct unbound method reference. Four ownership-injection cases pass; an isolated delta review is clean. Production is byte-identical to the PostgreSQL-approved 24a93d8 head. The earlier CI runner also hit a documented 8 GiB fixture disk requirement with only 7.2–7.3 GiB free; this is retained as environment evidence, not claimed as a passing test. The final exact-head CI outcomes and their dispositions are recorded above.


Count setup correction (before the replacement pair): the first baseline ran 39 generation/size processes because moving the byte-identical migrated fixture invalidated its existing absolute-path daemon-runtime-pin receipt, adding six migration envelopes. That attempt is excluded from repeat-Doctor acceptance. Candidate attempts stopped before repair because the temporary artifact observer matched only a single-line repair initializer. B2 emits that initializer over multiple lines; the observer crashed the child during import, and its parent correctly refused the exited process identity. A small direct module import reproduced the observer error. The corrected bounded multiline observer imports both exact repair-owner modules successfully; no product authority behavior changed. The replacement pair restores the unchanged pristine fixture at its original path for both arms. The original 27→25 projection and all acceptance thresholds remain unchanged. The canceled second attempt stopped during preflight and executed no Doctor.

Final landing check: current main includes #193393. Its additive standing-advisories benchmark changes merge cleanly with B2; all five reviewed production/test files remain byte-identical. This is main-owned benchmark integration only; B2 head and its own diff have not changed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
…193360)

## What Problem This Solves

A repeat captured Doctor still performs two full generation observations around shared-state readability even when no catalog or orphan repair is needed. Its readability helper also opens two empty immediate transactions on that clean path.

The existing schema-repair owner now returns its prepared `needed` fact with `apply`. The prepared schema-repair owner owns its catalog repair transaction and exposes the same prepared apply operation to the generator. The generator consumes the needed fact once. Clean, artifact-free readability can finish without an attributed write phase; retained WAL/journal still use the original initial envelope, and catalog/orphan repair still resumes through capture before writing. The superseded forwarding helper is deleted.

Full Doctor still invokes `apply` unconditionally inside its write transaction, retaining the ownership check after `BEGIN`. Actual repair still checks live authority at effect; original generation baseline, untouched-path final comparison, source custody, cancellation, awaited credentials and closure, and separate state/agent commits remain. No `capture.accept`, `openedSqlitePaths` shortcut, new cache, schema, generation, dependency or finalizer change.

## Acceptance rule (before count runs)

Flow: repeat captured Doctor through committed `scripts/perf/doctor-captured-pass.mts`, starting from the same migrated four-agent/4096-session synthetic fixture at the same absolute path. Baseline must contain landed B1; candidate differs only by the readability owner simplification. Keep the retained-WAL native update flow as a separate compatibility cohort.

Counts first, one matched base/candidate pair: clean no-companion readability removes one before/after generation observation pair (2 generation workers and 2 size workers), its 22 inspection SQL statements, and two empty immediate transactions; measure the remaining SQL/read/request deltas rather than assigning all totals to the deletion. Existing WAL or journal retains the initial envelope. Dirty catalog/orphan repair still enters the original capture before its first write; no skipped path calls capture.accept or marks itself opened. Full Doctor still executes the prepared ownership check unconditionally after BEGIN.

Win: at least the two redundant readability observations removed in the actual repeat flow, total SQL/requests and runtime Gateway MAIN hold or improve, source/refusal/restoration/cleanup behavior unchanged, production net <=0 and test net <=0. Counts for main threads across child processes are labeled separately from runtime Gateway MAIN. No timing result from an instrumented profile is treated as a speedup.

Timing: the campaign timing deadline expired at 2026-11-05T07:08:34Z. This PR uses deterministic worker/SQL/copied-byte counts only; it claims no CPU or wall-time speedup. The retained-WAL native update is a distinct compatibility cohort and is not timed for performance acceptance.

Proof: red/green clean readability transaction/worker counts adapted into existing tests; retain same/different-content outside-write refusal, empty reader transition, malformed catalog plus preserved orphan recovery, synchronous and asynchronous behavior, and full Doctor post-BEGIN authority. Two isolated reviews, PG checklist and approval for exact head, matched native retained-WAL update, exact-head CI including three PG shards and published-driver cell, peer overlap audit.

Expected remaining generation observations after the bounded cut: inventory 3; quick-index 2; readability 0; shared-state/credential opens 6; additive-agent schemas 8; legacy/schema/credential repair 6; total 25. Confirm with the production run; do not infer savings from source alone.

The parameterized migration tests retain direct full-Doctor and readability-first routes for both synchronous SDK and asynchronous Doctor entrypoints. Malformed catalog, preserved orphan payload/BigInt/export, integrity, current version, refusal, and repeat-repair idempotency assertions remain. Production net -8 LOC; tests net -5 LOC.

## Evidence

Current integration head: `e489ad6e51aa7775961d485eda51d7e501e4035a`. Merged current main `5166bef057aecf7c139598ad0d1ce3ac53cbd626` once to include the auth fake-clock fixture fix from openclaw#193451. All six B2 file blobs and B2’s diff against main are identical to the reviewed `e5ede773` patch. Count, native-update and published-driver evidence below therefore carry forward; the new normal pull-request [CI run42024239906](https://github.com/openclaw/openclaw/actions/runs/42024239906) passed, including all three PostgreSQL shards, static checks and the affected Node test groups. Required `openclaw/ci-gate`, dependency-review and security-sensitive-review are successful on this exact head. The prior auth-timer failure did not recur; no rerun was needed. No bypass will be used. Exact-head PostgreSQL review was carried by the coordinator after verifying the unchanged six B2 blobs.

One matched repeat-Doctor pair on Node26.12.1/macOS restored the same pristine four-agent/4096-session synthetic fixture at its original absolute path (1,190files/428,490,104bytes; SHA256 `38f500c594546a577e093b58b3956dc42e3e85ef6d593b6acf15a84c98eadd34`). Both arms passed product/restoration checks and cleaned the fixture.

| Scope | SQL base → candidate | Process-main SQL | Worker SQL | Requests | Copied bytes |
|---|---:|---:|---:|---:|---:|
| Doctor | 118,284 → 117,672 | 117,696 → 117,084 | 588 → 588 | 271 → 271 | 1,066,041,712 → 1,062,633,960 |
| Parent/other | 4,321 → 4,321 | 4,302 → 4,302 | 19 → 19 | 18 → 18 | 427,888,640 → 427,888,640 |
| Whole | 122,605 → 121,993 | 121,998 → 121,386 | 607 → 607 | 289 → 289 | 1,493,930,352 → 1,490,522,600 |

Doctor generation/size27/27→25/25; whole32/32→30/30; process starts184→180. Open/close/execute/task request deltas all0. Process-main is CLI/child thread0, not runtime Gateway MAIN. SQL−612 is the observed pair result; the fixed deletion is22 inspection statements plus two empty transactions, with remaining authority/lease work dependent on elapsed progress. After normalizing elapsed busy_timeout values,34 SQL shapes decrease and none increases. Doctor main copy−3,428,352bytes, WAL prefix+20,600bytes, journal unchanged; total−3,407,752bytes. No timing saving is inferred.

Remaining25 observations: inventory/settlement3, quick-index2, shared-state/credential opens6, additive-agent schemas8, legacy/schema/credential repair6. Readability pair2→0; other categories unchanged. No process/SQL ancestry gaps or PID reuse. The offline comparator initially omitted the four source .ts generation workers per arm; an independent spawn/lifetime audit confirmed them, and accepting only the exact .js/.ts entrypoints fixed comparison without changing raw records or rerunning either product arm. Historical B1 SQL totals are not directly comparable because this baseline includes inherited plugin-preparation work.

The separate retained-WAL native update pair passed exact activation/build identity, deferred-to-completed retirement, real Gateway transport, process stop and zero cleanup errors. Both arms started with identical main/WAL byte counts and identical three Doctor WAL/SHM boundaries.

| Native scope | SQL base → candidate | Requests base → candidate | Generation / size processes base → candidate |
|---|---:|---:|---:|
| Whole flow | 296,063 → 294,567 | 155,714 → 155,716 | 68 / 65 → 64 / 61 |
| Preflight Doctor | 3,608 → 3,580 | 119 → 119 | 0 / 0 → 0 / 0 |
| Installed Doctor | 146,880 → 146,269 | 351 → 351 | 32 / 32 → 30 / 30 |
| Final Doctor | 121,076 → 120,464 | 166 → 166 | 21 / 21 → 19 / 19 |

Direct runtime Gateway MAIN holds: canary 44→44; final Gateway 53→53 (startup/readiness48 + shutdown5). Whole process-main SQL290,019→288,520 is a different metric; workerSQL6,044→6,047. Whole-flow SQL is cadence-dependent, not a fixed per-invocation saving. Native copied bytes are unmeasured, not zero; no CPU/wall speedup or warm-steady claim.

All adverse native movements remain counted: one Doctor lease heartbeat; a shutdown plugin-catalog cache task/read; one canary sandboxRegistry.list schema-version read; and a final startup-integrity completion followed by its database open. Outside-Doctor cache scan0→1 and cache_size2→3 are disclosed. All12 relevant owners are blob-identical base/head. These are timing-dependent background progress differences, cause not proven. The coordinator explicitly accepted +2requests/+3workerSQL and the new cells after source attribution; none is subtracted as noise.

Two raw macOS leaf PIDs were each reused in disjoint process lifetimes. A strict offline split preserves all2,850 process events and62 affected SQL records, every raw hash and total. An isolated independent audit reconciles294,567SQL/155,716requests. Unobserved shell parents leave an ancestry coverage gap; all observed children remain counted (598SQL/0requests each arm, before Doctor).

Validation:132 owner tests passed on the production-equivalent head, including retained artifacts, outside-write refusal, empty readers, credential preparation/close and retirement. The B1 red control performs2 observations versus expected0; B2 passes. Final4 ownership cases, typed lint, format and line-cap pass. Two full isolated Codex reviews plus required production-delta/test corrections are clean. Exact-head PostgreSQL approval is recorded. Local broad check:changed was canceled143 and is not a pass; CI supplies broad gates.

Original proof-head CI run [42003968887](https://github.com/openclaw/openclaw/actions/runs/42003968887) passed all three PostgreSQL shards, types, typed lint, source contracts, ratchets, SDK API diff and the [published-driver/native-systemd cell](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127173500397). The run is not reported green: its original auth timer, deferred-project marker and UI timeout failures remain recorded. The single approved projects retry [127208432932](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127208432932) passed (11:08:56–11:34:54Z). The original marker ENOENT remains disclosed; no source fix or weakened assertion was introduced. The corrected PR body also passed its context/evidence check [127216156959](https://github.com/openclaw/openclaw/actions/runs/42018847897/job/127216156959).

The auth retry reproduced a leftover fake timer at `auth-controller.test.ts:226` and a separate cleanup-authority timeout. After the single Testbox allocation queued and was stopped without executing tests, the coordinator authorized one exact 19-file Node24.22.1/macOS replay per arm, with CI's three workers and isolation configuration unchanged. Both base and candidate reproduce the same timer assertion (base377pass/1fail; candidate382pass/1fail); all other18files pass, and worker cleanup completes. All source archive bytes verified before/after. This establishes matching-signature baseline evidence on macOS, not a Linux result, a fix, or a green suite. The follow-up openclaw#193451 attributed this timer to tsx disk-cache initialization captured by the fake clock and prepares it before the clock starts, retaining all assertions. That test-only fix is now included by the main merge; the new normal CI must confirm it on this integration head. The source-identical90s cleanup timeout remains disclosed. No assertion or timeout was weakened.

The UI timeout has no assertion failure and is coordinator-dispositioned as unrelated. Knip's sole `handleUpgradeRequest` export finding is independently reproduced in scheduled main run41994726590/job127135524057, then fixed on main by73145; the prospective merge retains the exact fixed blob. No new static findings are accepted.

Production net−8 LOC; tests net−5 LOC. Benchmark +12 lines adds a freshly created explicit scratch root so arms run at the same absolute path; default path and cleanup are unchanged. No B2 file changes followed final review; the current head additionally contains the unchanged main merge described above.

Overlap refreshed on the integrated head through the shared PR index: openclaw#193393 at `f545ae3d` merges cleanly both before and after B2; openclaw#192228/openclaw#188492/openclaw#166475/openclaw#149882/openclaw#146868 add no conflicts (7/34/18/92/7 inherited paths respectively). openclaw#192698 retains 2,751 conflicting paths in both arms and no new conflict relation. The repair-owner block is resegmented inside its already-conflicted file, covered by the coordinator’s explicit standing disposition for that draft. The previous 2,912-path count belonged to the earlier base. No per-PR census was used.

Acceptance marker: `DOCTORGEN-B2-COUNTS-e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`. Measured candidate: `e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`; exact base: `3a560c82e47ad5d8283886b4a17601a0dc8ddf67`. The same existing migrated fixture is restored at one path for each count arm; the native retained-WAL cohort is separately restored at its own fixed path.

Final test-only correction restores the baseline DatabaseSync.exec descriptor capture after typed lint rejected the direct unbound method reference. Four ownership-injection cases pass; an isolated delta review is clean. Production is byte-identical to the PostgreSQL-approved 24a93d8 head. The earlier CI runner also hit a documented 8 GiB fixture disk requirement with only 7.2–7.3 GiB free; this is retained as environment evidence, not claimed as a passing test. The final exact-head CI outcomes and their dispositions are recorded above.


Count setup correction (before the replacement pair): the first baseline ran 39 generation/size processes because moving the byte-identical migrated fixture invalidated its existing absolute-path daemon-runtime-pin receipt, adding six migration envelopes. That attempt is excluded from repeat-Doctor acceptance. Candidate attempts stopped before repair because the temporary artifact observer matched only a single-line repair initializer. B2 emits that initializer over multiple lines; the observer crashed the child during import, and its parent correctly refused the exited process identity. A small direct module import reproduced the observer error. The corrected bounded multiline observer imports both exact repair-owner modules successfully; no product authority behavior changed. The replacement pair restores the unchanged pristine fixture at its original path for both arms. The original 27→25 projection and all acceptance thresholds remain unchanged. The canceled second attempt stopped during preflight and executed no Doctor.

Final landing check: current main includes openclaw#193393. Its additive standing-advisories benchmark changes merge cleanly with B2; all five reviewed production/test files remain byte-identical. This is main-owned benchmark integration only; B2 head and its own diff have not changed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: voice-call Channel integration: voice-call clawsweeper:intake:feature Preliminary submission classification; full source review pending. docs Improvements or additions to documentation extensions: memory-core Extension: memory-core gateway Gateway runtime scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant