Repository navigation
fix(gateway): preserve concurrent empty session group creation - #186896
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. What this changesAdds a write-scoped sessions.groups.create RPC that appends groups through the existing atomic catalog owner. Example: Two clients independently create First and Second from a catalog containing Existing.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 2 items remain This PR provides a useful atomic creation boundary with no actionable code findings; API-only scope and current-head security approval remain maintainer decisions. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherAuthenticated Gateway requests pass through method-scope admission and parameter validation to the shared catalog worker, which commits SQLite changes and publishes path-free catalog notifications. flowchart LR
A[API clients] --> B[Gateway scope admission]
B --> C[Create RPC handler]
C --> D[Existing catalog owner]
D --> E[SQLite transaction]
E --> D
D --> F[Response and catalog notification]
Technical reviewBest possible solution: Expose atomic registration through this RPC and adopt it in bundled creation callers while preserving intentional catalog replacement. Do we have a high-confidence way to reproduce the issue? Current-main callers submit cached full-catalog replacements that can remove another client's empty group, matching the canonical report and supplied historical live reproduction. Is this the best way to solve the issue? Delegating to the existing atomic registration owner is the smallest server-side repair; completing the linked UI problem also requires caller adoption. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5c46b0b49382. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +55, Tests +197, Docs +1, Other +4. Total +257 across 19 files. Added test files: 2. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label 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 HistoryReview history (2 earlier review cycles)
Reviewed November 2, 2026, 2:53 PM ET / 19:53 UTC (Revision 3). |
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Expose atomic sessions.groups.create through the existing catalog registration owner, with write authority and catalog-only notifications. Co-authored-by: Copilot App <[email protected]>
Keep the real error classes used by handler instanceof checks and remove the now-obsolete closed-mock baseline exemption. Co-authored-by: bkudiess <[email protected]>
Regenerate canonical validators after integrating current protocol schemas. Allocate exactly 197 net regression-test lines for concurrency, authority, validation, method advertisement and portable declarations; preserve the shared scalar.
0a2bb47 to
43d3636
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…law#186896) * fix(gateway): preserve concurrent empty session group creation Expose atomic sessions.groups.create through the existing catalog registration owner, with write authority and catalog-only notifications. Co-authored-by: Copilot App <[email protected]> * test(gateway): preserve real exports in session group mocks Keep the real error classes used by handler instanceof checks and remove the now-obsolete closed-mock baseline exemption. Co-authored-by: bkudiess <[email protected]> * fix(protocol): regenerate session group creation validators after rebase Regenerate canonical validators after integrating current protocol schemas. Allocate exactly 197 net regression-test lines for concurrency, authority, validation, method advertisement and portable declarations; preserve the shared scalar. --------- Co-authored-by: bkudiess <[email protected]> Co-authored-by: Copilot App <[email protected]> Co-authored-by: roboclaw-bot <[email protected]> Co-authored-by: Dallin Romney <[email protected]>
Related: #106362 (API foundation only; bundled UI adoption is not included).
What Problem This Solves
Fixes: creating an empty session group from a cached catalog can remove an empty group another client just created.
User Impact
User impact: API clients that adopt
sessions.groups.createcan create empty groups without replacing another client's groups or changing saved defaults and sidebar order.This is an additive Gateway API, not a change to existing
sessions.groups.putreplacement semantics. Clients must detectsessions.groups.createin the advertised methods and call it to benefit; existing clients are not automatically migrated. The operation requiresoperator.writeor admin, notoperator.sessions.write. No database migration or production Gateway changes are included.Maintainer decision before merge: accept this as an API-only foundation, or include bundled group-creation adoption. The existing Control UI race is not fixed by this PR alone.
Why This Change Was Made
Expose
sessions.groups.create({ name })through the existing atomic catalog registration owner. Names are bounded, nonblank, trimmed, and idempotent; the response is{ ok: true, groups, sectionOrder? }. The existing worker admission rechecks current request authority before committing, and successful requests publish the normal catalog-onlysessions.changednotification. Refresh-then-put cannot eliminate the original race.Regenerating protocol validators on Windows exposed backslashes in declaration import specifiers; normalize them in the generator rather than hand-editing generated output. The large generated predicate diff is automatic helper-index renumbering.
Simplification retained one storage owner and introduced no new state, cache, migration, compatibility fallback, or caller-side replacement path.
Excluding generated output, the production/tooling growth is the new public RPC boundary. Its test coverage exercises distinct validation, concurrency, notification, and live-authority regressions. The CI mock repair preserves real module exports and removes one obsolete closed-mock exemption.
Evidence
Conflict and CI-budget repair — 2026-11-02
Candidate 43d3636, rebased onto b8ed94f. Resolved conflicts by retaining main's appended method descriptors, moving the schema export into the current
public-schema-sessions.tsowner, and regenerating the canonical protocol predicates. The runtime handler and regression semantics are unchanged. Independent inspection of the authored range-diff found no actionable conflict-resolution issue.Passed on the exact final source: canonical validator generation/parity, protocol registry and since guards, test-line and mock-export guards; 43 tests across five files (85.59s wrapper wall time); Gateway-method-test and scripts typechecks; targeted lint/format; Gateway protocol package/declarations build and public-mutability contract; normal commit hook and whitespace checks. Compiler preparation dominates the 74.01s Gateway shard; the declaration and protocol-validation shards took 1.37s and 3.08s respectively. Hosted CI timing remains pending for this revision.
Proof used a fresh secretless AWS Crabbox
m7a.xlargewith 4 CPUs / 15,614 MiB RAM, Node 24.22.1 and pnpm 12.15.0. Generation run:run_dbfff24c5d39b978577778a7a84f56c5; remaining checks continued through the lease's SSH transport after correcting the proof setup to track the two new test files. The first budget invocation counted only 30 lines because those files were untracked; the corrected final check passed at 6,408,379 counted lines with a 6,411,381 ceiling. No source assertions or guard thresholds were weakened. Final full-index patch SHA-256 against the pinned base matched remotely and locally:4f1e0c19b7f0cb47b9af2e6be00f1458cb782c4edd9b2ca91e388415aa6ed367.The unique
config/test-lines-allocations/session-groups-create-186896.txtgrants exactly +197 net regression-test lines, justified by distinct concurrent-creation/preservation, current-authority revocation, input validation, method advertisement and portable-declaration contracts. The shared baseline scalar is unchanged; inherited debt is not forgiven. This fixes the earlier PR-attributable budget failure under the current allocation policy.The earlier live Gateway, restart and released-state upgrade evidence below remains bound to its tested revision; it is not represented as a fresh live execution on this rebase. The fresh exact-head ClawSweeper review completed with no code findings, diamond-lobster proof and platinum-hermit patch quality. Overall gold is capped solely by the unresolved API-only scope and current-head maintainer security decisions. Hosted CI is still running; no failed code jobs were observed at this update. The failing
openclaw/ci-gatestatus currently states that a maintainer must approve this revision. This preparation supplies neither owner decision nor security approval and does not claim merge readiness.Earlier CI repair — head 0a2bb47d720a300193ec511d34b97fa1111ac818
Fixed the actual mock-exports CI failure in the previous run. The group-handler test now spreads the real module through importOriginal and uses the real error classes exercised by the handlers’ instanceof checks. The exact obsolete closed-mock exception was removed from the baseline; no new exception, suppression, or weakened assertion was added.
Red/green proof: the guard reproduced the original failure on c9f1389fd5e606bb9bac310e6324c11df9454bef, then passed on the exact two-file patch committed as this head. 15 tests across the changed handler suite and the real create-dispatcher suite passed, together with the Gateway-method test typecheck, targeted formatting/lint, and whitespace checks. Independent helper-isolated P0–P2 review of this repair returned scoped-clean, no actionable findings, exit 0.
Executed in fresh secretless AWS Crabbox run run_d55f62fd71cba33cb15c9f42dc96c23f. The validated patch SHA-256 was 3507018b8472243d5f86f6568f87059d9e7fa627697e0d77ce2d75fe0902ee01 before and after remote validation. Only the test and its obsolete baseline entry changed from c9f1389fd5e6; the runtime implementation used by the live concurrency, restart, and released-state upgrade evidence below is unchanged. Those captures remain explicitly bound to their original tested head, not presented as a new execution on this commit.
Fresh hosted CI has completed with the result below. Current-revision security approval and the API-only scope decision remain maintainer-owned; this repair grants neither approval.
Earlier hosted CI result — head 0a2bb47d720a300193ec511d34b97fa1111ac818
CI run 40739732190 completed on this head. The original mock-exports failure is fixed and passed in CI. All affected Gateway test/type/lint lanes passed. The run has two remaining failures, neither waived here:
Bounded reproduction of the UI failure: one fresh secretless AWS run, run_8b527044ac31279367b31f1a7e10392b, tested the exact failed synthetic merge d75df1cfa7dfabb8ce82f08f93c209ad2d20cb1f. It replayed the same 22-file selection through the repository E2E wrapper and cold sequencer with four workers, matching the CI source, Node 24.22.1, pnpm 12.15.0, and selection flags. All 100 tests across 22 files passed, including the exact annotations test (10.94s), without changing source or assertions. The allocated AWS m7a.xlarge exposed four CPUs / 15,614 MiB RAM; the selected test invocation took 158.84s. This was an isolated reproduction, not a rerun of the hosted check, and does not establish a root cause or repair. The original hosted failure remains unresolved. No retries, timeout increases, or speculative UI changes were committed. The test lease was released.
The API-only scope decision and current-head maintainer security approval also remain open. This is an open, reviewable PR, not a claim of green required checks or merge readiness.
Earlier runtime validation — 2026-10-28 (unchanged runtime implementation)
Tested unchanged head c9f1389fd5e606bb9bac310e6324c11df9454bef (tree 2ab9157b6e2ab19ee9e20f0a06bc092c1444c6b2). Environment: Linux x86_64, Node 24.22.1, pnpm 12.15.0, fresh secretless AWS Crabbox m7a.xlarge (4 CPUs / 15,614 MiB RAM). Isolated synthetic state, real loopback Gateway, signed paired-device WebSocket clients; no operator state or provider credentials.
Reproduction and observed fix:
Validation passed: 47 selected tests across seven files (22 unrelated catalog cases not selected); core, Gateway-method-test, root-tooling-test and scripts typechecks; generated-validator parity, protocol registry and since guards; runtime build; Gateway protocol package/declarations build and public-mutability checks; formatting for all 17 changed files; bounded core/tooling lint; changed-doc MDX; whitespace and clean-source checks.
Independent review: exact-head helper-isolated P0–P2 review across three diff partitions, with intact implementation/authority-owner context: no actionable findings, scoped-clean, exit 0. Regeneration parity was verified separately by the executed generator check.
Inspectable proof: live observations · complete reproduction script · validation results and run identities · reproduction instructions and qualifications. These artifact links expire after seven days; the core observations above remain in the PR.
The first manual probe used an incorrect whole-defaults-collection expectation; it was corrected to preserve existing entries while requiring the new groups’ expected name-only entries. The final probe passed in fresh synthetic state; no product code changed.
Released-state upgrade proof — 2026-10-28
Passed: official npm 2026.10.8, build dc2523e, to candidate c9f1389fd5e606bb9bac310e6324c11df9454bef. These builds share a version label, so the probe verifies and records distinct build commits.
The real released Gateway produced two groups, saved working-directory/default flags and sidebar order, and issued the paired-device credential. After stopping it, the candidate used the same state directory without resetting or reseeding it. The original device credential reconnected successfully; all baseline groups, defaults and order matched before any candidate write. Three concurrent distinct/duplicate create requests then preserved the original records and added exactly two groups. A further cold restart preserved the complete post-upgrade result.
Upgrade observations · complete upgrade probe · setup, build identities and qualifications. Fresh secretless AWS run run_e998754f6a47a6ee14afa9ddfc074d0f, exit 0; all owned Gateways and the lease were stopped. Links expire after seven days.
Remaining scope: no client/UI migration, fresh Windows rerun, full-suite claim, or model inference. The former draft CI was skipped; broad hosted CI completed with the two failures documented above. The security-sensitive review gate separately requires current-revision maintainer approval, and the API-only staging decision above remains open. Neither approval is supplied by this preparation.
Author’s original Windows validation and pre-fix evidence (retained)
The following records the original preparation before the fresh live validation above.
Pre-fix, the new production-dispatcher regression failed because the create method was absent, and the advertisement regression found no handler. The existing storage-owner overlap regression was already green, confirming that the missing boundary was the additive RPC.
The focused regressions exercise the real request dispatcher with isolated synthetic SQLite state: concurrent distinct and duplicate additions, preservation of existing defaults/order, catalog events, scope admission, and revocation at transaction/commit admission. No real Gateway or network server was started.
Independent review: one read-only Copilot reviewer covered all 17 changed files, including untracked tests and the complete generated artifact, at P0-P2; no actionable findings. Review snapshot:
b46d011db972a982bf8b8b94331505473dd07851plus the original local candidate, subsequently committed as0272cf522c4. The rebased authored patch is unchanged bygit range-diff; only generated predicates were regenerated to preserve upstream changes. Reviewer model identity is unverified; this was not a helper-isolated review.Exact validation commands and results
Final candidate:
c9f1389fd5e606bb9bac310e6324c11df9454bef, based onfd0403b40c980de2ab8fe8d20b3d49f06a488596.Passed: 47 tests across seven files, with 22 unrelated catalog cases deliberately not selected. Exact command:
Windows ARM64 wrapper wall time: 879.75 seconds, mostly worker compilation. The seven new production-dispatcher tests took 9.66 seconds; the changed owner-overlap case took 1.87 seconds, protocol validator file 0.15 seconds, and declaration-portability test 0.05 seconds. Real worker admission and commit/reconciliation are necessary for the concurrency and revocation claims.
node scripts\run-tsgo.mjs -p tsconfig.core.json --incrementalnode scripts\run-tsgo.mjs -p test\tsconfig\tsconfig.core.test.gateway-methods.json --incrementalcorepack pnpm gateway:validators:gencorepack pnpm gateway:validators:checkcorepack pnpm protocol-registry:checknode --import $tsx scripts\check-protocol-since.mtsnode --import $tsx scripts\check-docs-mdx.mts docs\gateway\protocol\rpc-session-control.mdgit diff --check fd0403b40c980de2ab8fe8d20b3d49f06a488596..HEADnode scripts\run-tsgo.mjs -p test\tsconfig\tsconfig.test.root.tooling.json --incrementalnode scripts\run-tsgo.mjs -p tsconfig.scripts.json --incrementalcorepack pnpm --filter @openclaw/gateway-protocol buildcorepack pnpm protocol:gennode scripts\prepare-native-protocol.mjsnode scripts\prepare-native-protocol.mjs --check$tsxabove was the file URI of the repository's existing loader, resolved on Windows as:Formatting passed for all 17 final-candidate files:
Bounded type-aware lint used the supported core and script configurations:
Both final-candidate lint commands passed.
Before the fix, this command failed at the production request boundary as expected:
The earlier broad catalog test attempt was stopped after stalling in unrelated rename/member work; no full catalog-suite pass is claimed. The initial broad-root lint attempt timed out preparing unrelated plugin declarations; the supported bounded core and scripts lint configurations passed instead. Live Gateway, UI, and full-suite validation were not run. CI timing is not available before draft publication.