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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
cbd73d7 to
2b12ea9
Compare
|
Codex review: needs changes before merge. What this changesThis PR recovers up to four independent publication worktrees concurrently while preserving request order within each worktree. Example: Four worktrees each have an unfinished publication and GitHub observations take 500 ms per call.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the bounded recovery concurrency is useful and preserves existing execution owners, but its added tests exceed the test-line ceiling and fail required CI. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherGateway background maintenance reads pending publication receipts, passes each worktree's ordered requests through the existing publication executor, and records durable outcomes for session reporting. flowchart TD
A[Background maintenance] --> B[Pending publication receipts]
B --> C[Queues grouped by worktree]
C --> D[Four concurrent queues]
D --> E[Existing custody and authority checks]
E --> F[Git and GitHub operations]
F --> G[Durable receipts and session results]
Technical reviewBest possible solution: Retain the existing-owner concurrency change and consolidate at least eight counted test lines while preserving the ordering and restart assertions. Do we have a high-confidence way to reproduce the issue? Current-main source serializes independent recovery requests, and the PR records a base-failing production-coordinator regression; this review ran no target code. Is this the best way to solve the issue? Grouping the existing ordered rows by worktree and reusing the established concurrency helper is a small complete solution that preserves custody, backoff, and settlement owners. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ceffe42d4008. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +14, Tests +149, Docs +2, Other +335. Total +500 across 8 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 27, 2026, 8:12 AM ET / 12:12 UTC. |
1628ee4 to
3fe8690
Compare
Recover up to four independent local worktrees while preserving each worktree publication queue, execution custody, and shutdown settlement. Completed receipts still require no GitHub confirmation. Extend the synthetic restart workload and prove ordering through the production coordinator.
0863162 to
7645d23
Compare
|
Landing at the pinned head
|
…he first frame (#185886) #185558 rendered cached chats before the Gateway connects; cached session-link title decoration (SessionLinkTitler.resolveReference) then sent sessions.resolve before connect. The Gateway rejected it (INVALID_REQUEST) and closed the socket with 1008 "invalid handshake: first request must be connect", so warm reloads reconnected: on the real-Gateway proof rig, 10/11 dashboard warm reloads sent two connect frames and hello moved 494 -> 1,615 ms (bisected to 2b7647f; parent 0/11). The gateway client now owns the invariant that connect is the first frame on every socket: requests issued before hello admission are held with their abort signals/timeouts and released in order after hello for the current socket generation; connect itself bypasses the hold; requests on a socket that already closed still fail with the typed not-connected outcome. Cached session links no longer interrupt a reconnect. Package README documents the contract. Regressions: handshake-queue unit tests (held requests are not sent before connect and resolve after hello; reentrant hello requests stay behind earlier held work) and a real-Gateway warm-connect e2e asserting exactly one connect and no 1008 close per warm reload. Test fixtures that issued requests before hello now complete the handshake first. All test suites green on the exact head; the test-lines ratchet is over its ceiling on main already (+473) and this PR adds +587 lines of regression coverage — the ceiling is being set to the exact observed total separately (#185853). Release-note context: Control UI reloads no longer drop and reopen their first Gateway connection when cached session links are present.
…openclaw#185853) * perf(gateway): recover independent publication worktrees concurrently Recover up to four independent local worktrees while preserving each worktree publication queue, execution custody, and shutdown settlement. Completed receipts still require no GitHub confirmation. Extend the synthetic restart workload and prove ordering through the production coordinator. * fix(perf): return explicitly from Git-only publication fixture * test(gateway): match publication fixture dispatch identity * test(gateway): consolidate recovery proof without raising test ceiling
…he first frame (openclaw#185886) openclaw#185558 rendered cached chats before the Gateway connects; cached session-link title decoration (SessionLinkTitler.resolveReference) then sent sessions.resolve before connect. The Gateway rejected it (INVALID_REQUEST) and closed the socket with 1008 "invalid handshake: first request must be connect", so warm reloads reconnected: on the real-Gateway proof rig, 10/11 dashboard warm reloads sent two connect frames and hello moved 494 -> 1,615 ms (bisected to 7dc64a0; parent 0/11). The gateway client now owns the invariant that connect is the first frame on every socket: requests issued before hello admission are held with their abort signals/timeouts and released in order after hello for the current socket generation; connect itself bypasses the hold; requests on a socket that already closed still fail with the typed not-connected outcome. Cached session links no longer interrupt a reconnect. Package README documents the contract. Regressions: handshake-queue unit tests (held requests are not sent before connect and resolve after hello; reentrant hello requests stay behind earlier held work) and a real-Gateway warm-connect e2e asserting exactly one connect and no 1008 close per warm reload. Test fixtures that issued requests before hello now complete the handshake first. All test suites green on the exact head; the test-lines ratchet is over its ceiling on main already (+473) and this PR adds +587 lines of regression coverage — the ceiling is being set to the exact observed total separately (openclaw#185853). Release-note context: Control UI reloads no longer drop and reopen their first Gateway connection when cached session links are present.
What Problem This Solves
A slow GitHub response while recovering one local worktree delays recovery for every other worktree. Recovery already runs outside Gateway readiness (#180128); its remaining serial queue unnecessarily delays independent publication results.
User Impact
Up to four independent worktrees can recover concurrently after restart. Each worktree keeps request order, and an unconfirmed result stops later recovery for that worktree. Existing requester authority, execution custody, workspace exclusion, cooldown, and shutdown settlement remain in their owners. Completed receipts continue to require no GitHub reconfirmation. No configuration, schema, stored format, or update migration changes.
Why This Change Was Made
Group the existing ordered pending rows by worktree and run those queues through the existing bounded concurrency helper. This replaces the blocked-worktree set rather than adding a competing execution owner. Runtime delta: +14 lines; growth implements the requested concurrency bound while preserving per-worktree FIFO and async-context isolation. The requested non-test/non-doc count including benchmark tooling is +349 lines (433 added, 84 removed): +335 belongs to the reusable delayed-GitHub fixture, owner measurement, and narrowly scoped fixture-writer guard.
Extend the existing startup and owner benchmark scripts instead of changing the shared performance README. The startup fixture uses synthetic durable publication history, private GitHub command/fetch mocks, and 500 ms delay per API call; it never publishes to GitHub.
Evidence
Acceptance: reduce independent-worktree recovery wall time with identical remote read counts and durable outcomes, preserve per-worktree ordering and shutdown settlement, and report CPU/allocation costs rather than presume they improve. Recovery phase duration is not time to client admission.
Five base and five candidate isolated Gateway boots use 10,000 sessions, eight agents, 44 plugins, config recovery history, and four unconfirmed publications. Both revisions perform three gh reads per request (repository metadata, recorded commit, matching PRs), plus one shared account lookup. All ten boots publish four receipts, retain 10,000 sessions, and preserve the normalized configuration and 44 identical plugin fixtures. Maximum concurrent GitHub reads increases from one to four.
Recovery phase wall time falls 70.3% (base range 10,561–15,377 ms; candidate 3,440–4,447 ms). Total mocked API wait remains about 6.55 seconds per sweep; concurrency overlaps it. Other phase wall time includes real local Git commands, state preparation/settlement, and host scheduling and was not separately attributed.
Tradeoffs/limits: Gateway peak RSS rises 102.9 MiB (+5.7%), with ranges 1,649–1,869 versus 1,866–1,989 MiB. The arms ran in batches rather than interleaved; mean starting host load fell 70.2 → 48.0, so readiness, CPU, and RSS differences are context, not causal claims. The CPU snapshot excludes subprocesses that exited before sampling. Readiness already preceded completed recovery on the base. Two failed setup pilots were excluded after correcting fixture CommonJS scope/collector setup and duplicate labels; neither was counted as a product result.
Measured source revisions: base
5341ef203bcb7e3d6cb904183c93b836a8f997a1, candidateaacd500fbd9fbf52cb9ba9de51e747abdd19a51f; the branch is subsequently rebased for current-main CI. The publication runtime is byte-identical to the measured candidate. The benchmark retains #185732's new admission probes and uses its host-load fields instead of adding a second representation.Owner scheduling/read benchmark, two counterbalanced pairs, 2,000 sweeps per arm per pair, eight requests per sweep; timing and allocation runs separate:
The consistent allocation increase is 38.49 KiB per sweep, or 4.81 KiB per request (+19.5%), from concurrent scheduling in nonempty recovery passes; the existing empty/settled early return is unchanged. CPU fell in both pairs, but substantial host-load variation limits attribution; recovery latency is the intended benefit. Delayed owner probes confirm maximum concurrency 1 → 4 and unchanged pending state; their cold elapsed times include worker preparation and are not used as clean network-latency measurements.
Regression: hold the first worktree's real production-coordinator GitHub response and require the other worktree to progress while the first worktree's next request stays blocked. It fails on main (
expected ['first'] to include 'independent') and passes with the fix. After settlement, restarting recovery makes zero gh calls for confirmed receipts.Validation: reconciliation/boundaries 40/40; runtime 23/23 (23 optional PostgreSQL variants skipped). New regression takes 5.4 s; reconciliation/boundaries wrapper 197.9 s, runtime wrapper 138.3 s on this loaded host. Focused startup benchmark tests 47/47 after rebase and fixture-writer guard tests 100/100 passed, as did changed-file formatting and lint. The rebase preserves the concurrent recovery implementation and integrates the upstream benchmark changes; no measured runtime code changed. Independent subagent review (autoreview route unavailable) found no actionable P0–P2 findings; the configured route was refused for an operator-provider mismatch, and no configuration was changed. Candidate Gateway proof passed as above. Initial PR CI found an excess
profileIdfield in the new test fixture; it was removed to match the dispatch identity contract. The affected gateway-methods test typecheck and all seven reconciliation tests pass after the correction, and independent review remains clean. The next CI run passed every behavioral, type, lint, build, and security job; only the total test-line ceiling failed. The ceiling increase was rejected and has been removed; the rebased PR leaves main's 6,282,728 ceiling unchanged. No Testbox lease or production Gateway load was used. The startup-only scope follows the lane's fast-path proof instruction rather than a ten-minute mixed-traffic campaign.Prior rebase validation: all five focused files passed (210 tests, with 23 optional PostgreSQL variants skipped). The current test consolidation preserves independent-worktree progress, same-worktree FIFO, durable settlement of all three receipts, and zero-call replay. It reuses the existing request fixture and combines CLI option validation without dropping cases, reducing net test growth from 149 to 136 lines. The affected startup and reconciliation files pass all 53 tests (46 startup cases and seven reconciliation cases); independent review found no actionable findings. Production runtime code is unchanged.
This PR does not change the test-lines ceiling and adds 136 net test lines.
Commands: