Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR replaces repeated child-controller scans with a registry-owned index refreshed by executor and scheduler ownership changes. Example: Present agent:main:subagent:child while agent:main:parent controls its current execution.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open as the maintainer-directed experiment explicitly marked “do not merge”; source review found no definite introduced bug. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe process-local subagent registry combines recorded run identities with executor and scheduler ownership; Gateway row presentation and session-send admission consume its controller answer. flowchart TD
A[Registry row mutations] --> D[Child controller index]
B[Executor ownership changes] --> D
C[Scheduler reservation changes] --> D
D --> E[Gateway session presentation]
D --> F[Session send admission]
F --> G[Guarded agent dispatch]
Technical reviewBest possible solution: Retain the registry-owned index only after the declared performance gates pass and final-effect checks establish unchanged communication authority. Do we have a high-confidence way to reproduce the issue? Current main visibly scans matching child runs on each controller read; the reported allocation magnitude has not been independently reproduced. Is this the best way to solve the issue? The change uses the existing registry owner, removes the replaced scan, and accounts for independent executor and scheduler releases, but measurements must establish that moving work to mutations is worthwhile. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c96f35d5d60c. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: none. SecurityNeeds attention: No reachable authorization bypass was identified, but retained controller facts require final-effect validation. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +130, Tests +193, Other +188. Total +511 across 10 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 25, 2026, 6:05 PM ET / 22:05 UTC. |
fb03bfd to
5779767
Compare
Maintain the newest matching live controller in the registry and refresh it when executor or scheduler ownership changes. Remove row-time run scans while preserving generation ordering, partial session identities, foreign control, and durable parent navigation. Release-note context: reduce session-list and Control UI row-presentation allocation without changing controller or parent relationships.
Share the existing execution ownership checks through a state-bound adapter, retain the controller scan negative control, and prepare runtime config before benchmark projection startup.
Match the Team harness 100-row list request while retaining the full 10,800-row fixture and all-row owner workload. This keeps setup within the existing exact-row preparation budget.
5779767 to
cd980c4
Compare
What Problem This Solves
Experiment stopped: the required whole-list CPU consistency gate failed. This PR is being closed without merging. The candidate improved CPU in only 5/11 list pairs, with median paired delta +0.052167 ms. The distributions overlap; this is an inconclusive primary, not evidence of a CPU regression. The isolated owner improvement and list-allocation reduction do not waive the failed primary.
A settled campaign profile attributed approximately 10 MB per 30 seconds (about 1.9% of sampled allocation) to controller resolution during row presentation. The original cold-load campaign observed 14 visual states over roughly 15 seconds on a signed-in reload of a dashboard deep link. This server-only experiment makes no first-paint or visual-layout claim.
Why This Change Was Made
The registry maintains the newest eligible controller in four exact/wildcard session-incarnation classes, preserving generation ordering and partial-identity matching. Executor and scheduler-reservation owners notify it synchronously by run ID, including global lifecycle rotation and scheduler-slot aliases. Releasing a context or reservation therefore updates the answer without requiring a raw registry-record write. Presentation and communication consume the maintained answer; the old per-call controller scan is removed.
Execution ownership checks share one implementation bound to registry state. The existing owner-tuple WeakMap remains, because unchanged reads already reuse its arrays. No new configuration, protocol, durable record, or schema.
User Impact
This experiment remains unmerged. The candidate preserved controller/parent relationships in the regression and consumer tests, and substantially reduced the isolated owner's work, but it did not establish the required consistent whole-list CPU benefit.
Evidence
Baseline:
82109fa2997472654265c262f6229f81e75b1a94. Candidate:cd980c412e9e66fce5b7aae14df9a8e8af1fcb61.One quiet AWS c7a.4xlarge, lease
cbx_f210537852bd, with 16 AMD EPYC vCPUs and 31,378 MiB RAM; initial load 0.77. Both revisions independently installed and fully built; no rebase or head change after builds. All 11 interleaved AB/BA pairs ran for each workload/mode on this same lease. It is now released.Fixed seeded state: 10,800 sessions, including 4,300 unarchived subagent rows and 4,300 registry records. The isolated owner pass resolves all 10,800 rows; the production-list workload requests a complete 100-row page matching the canonical Team harness. Both retain the fixed ratio of 100 registry/context updates per three resolution passes. Whole-workload allocation includes write maintenance; list-resolution CPU is recorded separately from update CPU and total thread CPU. Allocation is sampled with collected objects included. No local timings are results.
The predeclared gate required each of four primaries to improve in at least 9/11 pairs with a negative median paired delta.
The owner CPU median fell 77.98%, and its sampled family allocation fell 99.87%. Whole-list workload allocation fell 1.64% by median, passed in 9/11 pairs, and had a median paired reduction of 92,330 bytes. Whole-list CPU's unpaired medians fell 3.54%, but the matched signs and median paired delta failed the declared gate. No retries or alternative workload were used to chase that result.
Per-pair primary deltas
Candidate minus baseline, pair order 1–11; negative favors the candidate. Odd pairs are AB, even pairs BA.
Owner CPU / 10,800-row pass (ms):
Owner-family sampled allocation / pass (bytes):
Whole list-resolution CPU / 100-row page (ms):
Whole list-workload sampled allocation / pass (bytes):
Allocation attribution and call census
Across the three measured census lists, both arms made 300 snapshot calls, 524 owner resolutions, and 528 controller resolutions: 100 presented rows, approximately 74.67 child-link owner witnesses, and 1.33 additional uncached row/controller calls per list. The original iterator lookup ran 528 times; the candidate ran it zero times. Controller/owner results and workload checksums matched.
Source allocation sites in the old path include the matching closure, child-owner query object, parsed-key objects/substrings and composite owner key, plus a Map-values iterator or empty-array fallback. Eligible candidates also resolve authority and identity results, including a legacy refusal string where applicable. The optional two-item parent-membership array is only created when a parent argument is supplied, not for ordinary presentation. Owner tuples/cache records allocate on WeakMap misses, not unchanged hits.
The candidate performs fixed identity-class lookups with pre-normalized controller facts. Sampling/JIT can combine source sites into caller frames; these are allocation-site attributions rather than an exact object-type census. In the representative baseline owner profile, the controller frame had 3,616,292 sampled self bytes/pass and child-agent resolution 1,955,108 self bytes/pass. The candidate profile had no sampled controller frame; the remaining owner-family allocation was approximately 8 KB/pass. Matching/normalization work remains at registry updates.
Secondary observations: write CPU increased by a median paired 2.205 microseconds/update in the owner workload and 1.992 microseconds/update in the list workload. List retained heap increased by a median paired 228,040 bytes with non-overlapping IQRs; this source-mode measurement is reported as a cost, without attributing all retained growth to the index. Owner-workload GC fell from 0.159363 to 0.065707 ms/pass; list GC medians were 0.183508 and 0.166959 ms/pass. These observations do not rescue the failed primary.
Validation and gaps
The new controller file took 48.62 s and the changed communication file 59.27 s, each with
pnpm test <file> --maxWorkers=1. Both baseline and candidate full builds passed.All primary and secondary microbenchmark tables and all paired deltas are retained in the local evidence report. The exact-head CI workflow run was
40248293690; its broad jobs were skipped because the PR stayed draft. No CI failure was rerun to chase green.Setup disclosure: an initial benchmark request for all 10,800 cold rows exceeded the existing 8,192-pending-row preparation budget. Before any comparisons, the benchmark was corrected to the canonical 100-row page; full-size setup then passed on both arms. Production limits were unchanged. AWS initially substituted a t3.small after an On-Demand quota refusal; that lease was rejected and released before validation/measurement. The supported Spot request then provided the actual c7a.4xlarge used for the whole comparison. No Team state or private captures were copied or uploaded.
Runtime size and files
Production runtime delta: +155 LOC. Required non-test/non-doc stat: 535 insertions, 187 deletions, +348 net (includes +193 benchmark LOC). Growth preserves partial-incarnation matching and independently withdrawn executor/reservation ownership. The old bucket-index definition moved beside the new controller index, and the controller scan it replaces was deleted.
Touched runtime:
subagent-registry-memory{,-index}.ts,subagent-run-{execution-owner,liveness}.ts,swarm-scheduler.ts,session-utils-core.ts, and infraagent-run-{registry,registry-state,capacity-wait}.ts. Tests:session-child-controller.test.tsandsessions-send-communication.test.ts. Benchmark:scripts/perf/session-child-owner-measure.ts. No UI files or visual changes.All four lane leases are released:
cbx_09ca062dde28,cbx_850c44eb9d2b, rejectedcbx_b1499834633c, and comparisoncbx_f210537852bd. No Gateway was started. The lane stops here under the failed-primary rule; no landing recommendation is made.Complete microbenchmark table and all paired deltas
Per-pair deltas (candidate − baseline):
owner / timing / resolutionCpuMsPerList: -7.418125, -7.264550, -7.861404, -7.741875, -8.163433, -8.038704, -8.184808, -7.915233, -7.356587, -7.166900, -8.298383
owner / timing / threadCpuMs: -1787.686000, -1755.384000, -1919.713000, -1908.225000, -1956.919000, -1917.867000, -1961.291000, -1912.764000, -1798.831000, -1726.993000, -1993.636000
owner / timing / updateCpuMsPerUpdate: +0.001650, +0.002205, -0.001709, -0.003364, +0.003031, +0.004595, +0.003640, +0.002973, -0.001478, +0.002978, +0.002108
owner / timing / gcMsPerList: -0.096222, -0.095281, -0.122463, -0.084139, -0.091924, -0.089439, -0.094411, -0.096355, -0.088791, -0.095493, -0.071029
owner / timing / retainedHeapAfter: -1520.000000, -1192.000000, +236872.000000, +84184.000000, +80816.000000, +46624.000000, +3832.000000, -40560.000000, +78056.000000, -31872.000000, -46088.000000
owner / timing / ownerCpuMsPerList: -7.443988, -7.135008, -7.812667, -7.764192, -8.119742, -7.967962, -8.008742, -7.891696, -7.305242, -7.186913, -8.221375
owner / allocation / allocatedBytesPerList: -6426565.433333, -6365499.966667, -6385796.900000, -6396420.700000, -6358162.800000, -6312786.000000, -6379878.633333, -6434287.233333, -6467297.500000, -6352896.900000, -6340660.333333
owner / allocation / childOwnerAllocatedBytesPerList: -6457557.500000, -6423110.933333, -6430327.500000, -6451404.033333, -6402477.600000, -6366440.233333, -6452789.233333, -6464854.633333, -6452785.433333, -6388705.200000, -6425972.266667
list / timing / resolutionCpuMsPerList: +0.278333, -1.714083, +1.338861, +0.304611, -0.833139, +0.556167, -1.167750, -0.642278, +0.052167, +0.327472, -0.515222
list / timing / threadCpuMs: +10.278000, -54.033000, +51.454000, +7.253000, -30.690000, +25.404000, -36.248000, -23.902000, +4.314000, +10.517000, -16.462000
list / timing / updateCpuMsPerUpdate: +0.001700, +0.004752, -0.000359, +0.001992, +0.001463, +0.002938, +0.004832, -0.000619, +0.005365, +0.004706, -0.001618
list / timing / gcMsPerList: +0.031640, -0.021544, +0.017825, -0.003447, -0.026358, +0.001921, -0.019668, -0.001811, -0.007492, -0.008730, -0.026369
list / timing / retainedHeapAfter: +74144.000000, +212224.000000, +1062848.000000, +113224.000000, +228040.000000, +228424.000000, +210664.000000, -279376.000000, +321600.000000, +297640.000000, +238160.000000
list / allocation / allocatedBytesPerList: -137044.888889, -102786.888889, +5393.333333, -76470.000000, +93367.555556, -105941.111111, -92329.777778, -137064.666667, -165011.777778, -31314.444444, -27046.444444
list / allocation / childOwnerAllocatedBytesPerList: -102035.111111, -110220.444444, -106585.111111, -119327.555556, -117507.111111, -84713.555556, -114744.222222, -117514.222222, -104758.000000, -113873.111111, -99295.333333