Repository navigation
perf(gateway): coalesce observed project discovery - #162016
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: blocked before merge. Reviewed October 1, 2026, 12:57 AM ET / 04:57 UTC (Revision 13). ClawSweeper reviewWhat this changesThe branch shares concurrent observed-project discovery through the existing Git worker, preserves fresh metadata on later requests, and updates regression coverage, documentation, and wrapper dependencies. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 3 items remain The optimization remains useful and is absent from current main, but the prior P2 scheduling blocker remains in the pinned head and verified test merge. The documented CI replay does not resolve that code defect. Priority: P2 Review scores
Verification
How this fits togetherGateway project discovery gathers checkouts from visible sessions and managed worktrees, reads their Git identities, and returns project summaries. The changed scheduling shares bulk discovery with the worker serving unrelated checkout metadata. flowchart TD
A[Observed project request] --> B[Visible checkout selection]
B --> C[Shared pending discovery]
C --> D[Single metadata worker]
E[Checkout metadata requests] --> D
D --> F[Host Git processes]
F --> D
D --> G[Project summaries and metadata]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +38, Tests +47, Docs +6, Other +7. Total +98 across 12 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep pending-only coalescing under the existing Git owner while giving bulk discovery bounded scheduling independent of interactive metadata reads. Do we have a high-confidence way to reproduce the issue? Yes, source establishes a deterministic path: hold a Git request within an identity batch, then submit checkout metadata to the same single-worker pool. This read-only review did not execute that scenario. Is this the best way to solve the issue? No, the coalescing mechanism is appropriate, but placing bulk scans on the sole interactive metadata worker introduces avoidable head-of-line blocking. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d76d5af33d22. LabelsLabel changes: No label changes. Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
Forward the existing restoration guard phase through Windows task recovery and settlement. Preserve forward admission, live executor and task identity checks, and restart safety. Exercise the native authority callbacks in the existing cancellation fixture. Incorporates the owner repair from e15966d (#162016) after the catalog PR's original packed CI shard reproduced the same SIGINT failure.
9ac5548 to
086b3a9
Compare
Concurrent observed-project lists each ran their own git discovery per project, so a reconnect burst multiplied git launches by the client count (879 git spawns in one boot minute on Team with 11 reconnecting clients). Share one bounded git discovery pass across concurrent callers and let later requests refresh the facts instead of recomputing them. The projects.list reply contract is unchanged. Testbox fixture (80 repositories, 10 concurrent lists): git launches 1,280 -> 128, wall time 3,196 -> 609 ms, handler-thread CPU 2,136 -> 385 ms.
086b3a9 to
50c649f
Compare
Concurrent observed-project lists each ran their own git discovery per project, so a reconnect burst multiplied git launches by the client count (879 git spawns in one boot minute on Team with 11 reconnecting clients). Share one bounded git discovery pass across concurrent callers and let later requests refresh the facts instead of recomputing them. The projects.list reply contract is unchanged. Testbox fixture (80 repositories, 10 concurrent lists): git launches 1,280 -> 128, wall time 3,196 -> 609 ms, handler-thread CPU 2,136 -> 385 ms.
What Problem This Solves
Concurrent
projects.listrequests withincludeObserved: truerepeat Git discovery for every caller, multiplying process launches and Gateway CPU load.User Impact
Concurrent observed-project reads share one bounded Git pass while preserving access checks, response ordering, and fresh metadata on later reads. Default
projects.list {}already avoids Git and remains unchanged. No configuration or migration is required. The first observed call pays worker startup cost: 624 ms before versus 1,634 ms after in the existing fixture.Why This Change Was Made
The existing Git read owner coalesces matching pending discovery passes, with four concurrent identity probes in its worker. The handler admits its existing newest-first 32-path budget before sorting the coalescing key. Settled identities are discarded so later requests see external Git configuration and worktree changes. The wrapper extraction inventory includes the seven dependencies introduced by the worker import.
Evidence
Measurement
Original synthetic benchmark through the registered RPC handler: 80 real Git repositories and recorded sessions, 32 admitted checkouts, four Git commands per identity. Timing excludes fixture setup; CPU measures the handler thread.
The first observed call pays worker startup cost. The retained real-handler regression failed before the fix with 40 Git launches versus a four-launch single pass. It covers coalescing, fresh origins after an external edit, and omission of a removed checkout. Original measurement: Blacksmith Testbox
tbx_01m3sjv5wxmmdc2zknr047vsym(run). These timings were not remeasured during CI repair.CI failure attribution
Run
36803677410tested head086b3a9663d6merged with newer main. All three reported tooling failures came from main-side changes:3988e4ac66bd.src/auto-reply/reply/get-reply-run-admission.session-file.test.ts, outside this PR. Main fix:bd1138797711. The--invalid-boundary-proofcompiler error is intentional output from a separate negative test.3b8fc7e64cee(test(ci): include infra in shared Windows partitions #162310). This PR introduces no new test file or partition change.The unrelated Doctor type error was fixed on main by
5a7f24abb78f; no Doctor code was edited here.Rebased onto main
55fe1b488910instead of copying upstream fixes.git range-diffreports an identical patch: one lane-owned commit, 12 files, +150/-52. No source or baseline edits were needed for this repair.Validation
Local attribution used the explicit exception for these tooling tests only. The full three-file run on
086b3a9663d6passed 456 tests in 537.78 s. The three previously failing cases passed on pinned main55fe1b488910in 57.94 s (453 unrelated cases skipped).Current remote proof: provider
blacksmith-testbox, profileopenclaw-check, leasetbx_01m3tspwhknh91sqscmjhjfs62(run). A dependency preflight stopped before tests; the authorizedpnpm install --frozen-lockfilefollowed.node scripts/run-vitest.mjs test/scripts/pr-wrappers.test.ts test/scripts/type-suppression-inventory.test.ts test/scripts/test-projects.test.ts: 456 passed, 59.81 s test-runner wall (71.154 s delegated command including the frozen install).node scripts/check-changed.mjs --base origin/main: passed, 23m09.82s delegated command wall including setup/install ontbx_01m3tt96w94hrkm36zsyyv199w(run). Its transport Git metadata was bound to candidate50c649f93538and base55fe1b488910; the synced tracked source matched the candidate and the gate selected exactly the 12 PR files.git diff --checkpassed.Testbox setup issues were separate from product proof: the first lease's base fetch stalled and the lease was stopped; a shallow partial-clone comparison on the second lease crashed Git before checks began. Completing the base object fetch and repeating source verification succeeded. Neither failed setup attempt is counted as passing validation. Both initial validation leases are stopped.
Earlier unchanged implementation proof: 64 focused project/cache/wrapper tests passed on
tbx_01m3td1rv0j511am3eqq6t7je2(run); full changed-file checks passed ontbx_01m3tdevp0bhb0sgmr24zpcvj7(run); build proof passed ontbx_01m3skqfn4k9n4byyztypk876t. The original single-worker cost was 70.01 s forprojects.test.ts(20 tests, regression 1.81 s, including cold worker compilation), and 14.50 s forprojects-observed.test.ts(7 tests).Remaining CI failure and reproduction
CI run 36815845381, head
50c649f93538, completed with one failed test job,checks-node-compact-small-19, and its downstreamopenclaw/ci-gate. The changed-test shard passed. The sole failed case wastest/helpers/openclaw-test-instance.acquisition.test.ts:33, “keeps an absent Gateway unreachable while retaining its port claims,” expectedfreebut observedbusy.The failing assertion runs before Gateway startup or project discovery. The test,
openclaw-test-instance.ts, and the TCP probe, port claims, allocation, and claim-lock owners are byte-identical between this candidate and the CI merge's main parentb41ba09ee303. No lane-owned discovery path executes in the failing flow. The original CI log does not identify the port's occupant, so its specific cause remains unproven.Replayed the exact four-group manifest from that job, preserving group order and the two-worker setting, with
node --import tsx scripts/ci-run-node-test-shard.mtson Blacksmith Testboxtbx_01m3twd70h1q7nyjx8gx1myysk(run): 1,540 passed, eight skipped, zero failed invocations, 2m50.92s delegated wall including frozen install/sync. The previously failing 15-file group passed 395 tests with one skipped; the specific assertion passed in 11 ms. This passing replay is not claimed as a fix. No test weakening, speculative fixture change, workflow rerun, or source repush was used. The replay lease is stopped.The PR-body context check initially rejected renamed template headings; restoring the required headings made its next run pass on the same source head. The original three tooling failures and Doctor type error were repaired by the main commits attributed above.
Limits
This optimizes opt-in observed discovery. Current Control UI callers send
{}and already launch no Git; these measurements do not identify the cause of a default-client reconnect burst or session-projection allocation cost. No live Gateway or native Windows environment was exercised during this repair. Prior benchmark/build results remain prior-head evidence.