Skip to content

feat(gateway/ui): split session group mutations to avoid concurrent add loss - #112227

Closed
xialonglee wants to merge 1 commit into
openclaw:mainfrom
xialonglee:fix/issue-106362-concurrent-session-groups
Closed

xialonglee wants to merge 1 commit into
openclaw:mainfrom
xialonglee:fix/issue-106362-concurrent-session-groups

Conversation

@xialonglee

@xialonglee xialonglee commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #106362

What Problem This Solves

Fixes an issue where users creating different custom session groups concurrently from two Control UI tabs would silently lose one of the groups. Both tabs sent a full replacement catalog derived from their stale local state, and the later sessions.groups.put deleted everything before re-inserting its own list.

Why This Change Was Made

The fix splits the monolithic sessions.groups.put catalog replacement into three finer-grained Gateway operations so Control UI no longer has to replace the whole catalog for every mutation:

  • sessions.groups.add appends a single new group without touching existing rows (fixes the concurrent-add loss).
  • sessions.groups.reorder updates the position order for the listed groups, and optionally atomically persists the complete sidebar sectionOrder in the same SQLite transaction. This keeps cross-section ordering (work / custom groups / ungrouped) consistent when groups are reordered.
  • sessions.groups.put keeps the historical full-replacement contract for older clients and the client-side fallback for older gateways.

Control UI always dispatches the atomic RPCs (sessions.groups.add / sessions.groups.reorder) and forwards the full sectionOrder on reorders so the server persists it atomically alongside the group positions; a failed atomic write surfaces an error instead of falling back to a locally-constructed full-catalog put (the destructive fallback was removed in the 2026-08-28 revision). Shared Apple clients negotiate supportsGroupAdd when the route lease is captured and only use the legacy read-modify-write putGroups path against genuinely older gateways that do not advertise sessions.groups.add.

Changes since last review cycle

Historical note (2026-09-16): the entries below describe the 2026-08/09 review cycles. Three claims are superseded by later revisions: the Control UI metadata-less put fallback was removed on 2026-08-28 (atomic failures now surface as errors), the new methods are dated since: "2026.9", and the new schemas live in packages/gateway-protocol/src/schema/session-groups.ts. Current behavior is described in "Why This Change Was Made" and the 2026-09-16 revision below.

Rebased onto the latest upstream/main and addressed the remaining ClawSweeper P1 findings from the most recent review:

  • Fall back when Gateway method metadata is absent (P1): ui/src/lib/sessions/session-group-catalog.ts now treats a missing features.methods array (returned by isGatewayMethodAdvertised) as legacy for both sessions.groups.add and sessions.groups.reorder, routing metadata-less older gateways to the supported sessions.groups.put replacement instead of sending an unknown RPC.

  • Restrict Apple fallback to unsupported-method errors (P1): apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel+SessionActions.swift now catches only the recognized old-Gateway INVALID_REQUEST / "unknown method: sessions.groups.add" response before falling back to the legacy read-modify-write putGroups path. Authorization, transport, decoding, and post-dispatch failures now propagate instead of being silently converted into a destructive full-catalog replacement.

  • Wire the new group-add closure into all lease constructors (P1): addGroup is now supplied by the direct iOS (IOSGatewayChatTransport.swift), macOS (MacGatewayChatTransport+SessionActions.swift), and shared-test (ChatViewModelSessionActionTests.swift) OpenClawChatSessionGroupsRouteLease constructors, fixing the Swift compilation failures.

Previous review-cycle items remain in place:

  • Preserve unlisted sidebar sections during partial reorders (P1): normalizeSidebarSectionOrder now normalizes against the complete resulting catalog (listed groups plus unlisted groups) instead of only the caller's input list. This keeps sidebar slots for groups that are not mentioned in a partial sessions.groups.reorder from being silently stripped.
  • Migrate shared Apple client to atomic group creation (P1): ChatViewModel+SessionActions.swift now uses sessions.groups.add first, falling back to the legacy sessions.groups.put only when the gateway does not advertise the new method. The route lease, request builder, transport protocol, and unit tests were updated to support addGroup.
  • Append and correctly version new Gateway methods (P1): sessions.groups.add and sessions.groups.reorder are appended at the end of the sessions-groups family in src/gateway/methods/core-descriptors.ts with since: "2026.8", matching the next release train. The Android generated protocol enum (GatewayProtocol.kt) was regenerated and is consistent with the new method list.
  • Discard nonexistent names before assigning reorder positions (P2): reorderSessionGroups filters the input names against the existing catalog before assigning positions, so unknown names do not consume slots or leave gaps.
  • Normalize unlisted group positions during partial reorders: unlisted groups are compacted to unique contiguous positions after the listed groups, preserving their prior relative order.
  • Persist complete sidebar section order during sessions.groups.reorder: SessionsGroupsReorderParamsSchema accepts an optional sectionOrder, and reorderSessionGroups writes it to sidebar_sections inside the same transaction that updates group positions. The Control UI reorder path forwards its full next section order through groupsReorder.
  • Restored full-replacement semantics for sessions.groups.put: existing callers can still remove groups by submitting a catalog without them.
  • Fixed Gateway protocol barrel boundary violations: new schemas live in packages/gateway-protocol/src/schema/sessions.ts and are compiled in validator-registry.ts.
  • Updated regression coverage: tests assert (a) omitted groups are removed by sessions.groups.put, (b) concurrent adds survive through the atomic sessions.groups.add path, (c) sessions.groups.reorder persists the provided sectionOrder, (d) partial reorders preserve unlisted group sections, (e) nonexistent reorder names are discarded, (f) metadata-less gateways fall back to sessions.groups.put for both add and reorder, and (g) Apple createSessionGroup only falls back on the unsupported-method error.

User Impact

  • Creating a custom session group in one Control UI tab no longer wipes out a group created in another tab at the same time.
  • Reordering custom groups in the sidebar preserves the cross-section order (work / custom groups / ungrouped) atomically, so other tabs and reconnects see the same layout.
  • Partial reorders now produce deterministic persistent ordering — unlisted groups keep their relative order and all positions are unique and contiguous.
  • Shared Apple clients also use the atomic add path when connected to a current gateway, and only fall back to the legacy replacement for genuinely unsupported older gateways.
  • Existing callers that rely on sessions.groups.put replacing the catalog keep working unchanged.
  • Control UI ships 1:1 with its Gateway and requires the new atomic methods; it no longer carries a client-side put fallback (removed 2026-08-28 because a silent destructive retry was worse than a visible error). Existing sessions.groups.put callers (scripts, older Apple clients) keep working unchanged: the Gateway retains the full-replacement operation, and Apple clients only fall back to it against gateways that do not advertise sessions.groups.add.

Evidence

Unit tests

  • src/gateway/session-groups.test.ts — 15 tests pass (replacement semantics + concurrent-add preservation + section order persistence + normalized partial reorder + consecutive partial reorder regression + nonexistent-name discard)
  • src/gateway/method-scopes.test.ts — 148 tests pass (new method scopes verified)
  • src/gateway/methods/core-descriptors.since.test.ts — 1 test pass (sessions.groups.add, sessions.groups.reorder dated 2026.8)
  • src/gateway/server-methods-list.test.ts — 23 tests pass (new handlers registered)
  • ui/src/lib/sessions/index.test.ts — 33 tests pass, including new metadata-less fallback cases for groupsAdd and groupsReorder
  • ui/src/components/app-sidebar.test.ts — 245 tests pass (section reordering and custom group reordering cases)
  • ui/src/pages/sessions/sessions-page.test.ts — 28 tests pass
  • apps/shared/OpenClawKit/Tests/OpenClawKitTests/ChatViewModelSessionActionTests.swift — updated/added tests for atomic add path, unsupported-method fallback, and propagation of non-unsupported errors

Lint / format

  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <changed-files> — 0 warnings, 0 errors
  • pnpm format:check -- <changed-files> — all matched files use correct format

Baselines

  • pnpm plugin-sdk:api:gen + pnpm plugin-sdk:api:check — plugin SDK API baseline refreshed and verified.
  • pnpm native:i18n:baseline + pnpm native:i18n:verify — native app i18n inventory refreshed and verified.

Real Gateway behavior proof

Verified against a freshly built Gateway with two authenticated operator clients (simulating two Control UI tabs). The proof exercises the changed RPCs end-to-end through WebSocket requests:

$ node_modules/.bin/tsx .tmp/proof-gateway-concurrency.mts
Gateway started at ws://127.0.0.1:45327 (port 45327)
Two authenticated clients connected.
Tab A sessions.groups.add('Client-A'): { ok: true, groups: [ { name: 'Client-A', position: 0 } ] }
Tab B sessions.groups.add('Client-B'): {
  ok: true,
  groups: [
    { name: 'Client-A', position: 0 },
    { name: 'Client-B', position: 1 }
  ]
}
Catalog after concurrent adds: [ 'Client-A', 'Client-B' ]
Catalog after reorder: [ 'Client-B', 'Client-A' ]
Section order after reorder: [ 'work', 'category:Client-B', 'ungrouped', 'category:Client-A' ]
Section order observed by second client: [ 'work', 'category:Client-B', 'ungrouped', 'category:Client-A' ]
Catalog after partial reorder: [ 'Client-C', 'Client-B', 'Client-A' ]
Section order after partial reorder: [
  'work',
  'category:Client-C',
  'category:Client-B',
  'category:Client-A',
  'ungrouped'
]
Section order observed by second client after partial reorder: [
  'work',
  'category:Client-C',
  'category:Client-B',
  'category:Client-A',
  'ungrouped'
]
Catalog after legacy put: [ 'Client-A' ]
Section order after legacy put: [ 'category:Client-A', 'work', 'ungrouped' ]

✓ PASS: authenticated Gateway concurrent-add/reorder/put proof succeeded.

This shows:

  • Concurrent sessions.groups.add calls from two tabs preserve both groups.
  • sessions.groups.reorder changes the group order and atomically persists the complete sidebar section order.
  • A second client observes the same section order, confirming the state is stored server-side.
  • Partial reorders keep unlisted group sections in the persisted sidebar order.
  • sessions.groups.put remains a full catalog replacement: submitting ["Client-A"] removes the other groups.

CI proof: exact-head before/after

A secretless GitHub Actions workflow on the proof branch fix/issue-106362-concurrent-session-groups-proof builds the Gateway at the exact PR head and base commits, starts a real local Gateway with token auth for each, and drives two loopback CLI clients through the changed RPCs.

Key markers from the CI artifact (proof.log):

[proof] scene=concurrent_add mode=before groups=["Client-B"] status=pass
[proof] scene=concurrent_add mode=after groups=["Client-A","Client-B"] status=pass

This confirms:

  • Before fix: two concurrent sessions.groups.put calls result in only the last write surviving (Client-B).
  • After fix: two concurrent sessions.groups.add calls preserve both groups (Client-A and Client-B).

Gateway authorization

  • sessions.groups.add and sessions.groups.reorder registered in src/gateway/methods/core-descriptors.ts with scope: "operator.write" and since: "2026.9".
  • Scope resolution verified in src/gateway/method-scopes.test.ts.
  • Methods registered in src/gateway/server-methods/sessions-groups.ts lazy handler list.
  • Added to plugin runtime global session mutation set in src/plugins/registry-runtime-session-ownership.ts.
  • Handler validates params, emits sessions.changed, and returns typed errors; no authorization bypass introduced.

UI before/after screenshots (two-tab concurrent group creation)

Captured 2026-09-16 at head 28522c11067 with the Control UI E2E harness (vitest.ui-e2e.config.ts, headless Chromium, mock Gateway, OPENCLAW_CAPTURE_UI_PROOF=1). All content is synthetic (groups Alpha/Beta, fixture sessions); screenshots were inspected and contain no private data. Assets are served from the fork's proof-112227-ui-screenshots branch so they render inline here and in the PR.

Before — legacy replacement semantics (negative control): the mock Gateway's sessions.groups.add handler was temporarily switched to emulate the pre-fix read-modify-write replacement (each submission replaces the whole catalog with its own stale singleton list, mirroring what sessions.groups.put did with a stale snapshot). Both tabs submit from the same empty catalog; the later write wipes the earlier group.

Tab 1 (created Alpha) Tab 2 (created Beta)
before tab1 before tab2
  • Tab 2 lost Alpha entirely — only BETA remains in its sidebar (the user-facing bug from Control UI: concurrent custom-group creation silently loses one group #106362).
  • Tab 1 still renders ALPHA only through its own session row; the shared catalog entry is gone (BETA — the other tab's group — leads the catalog order). Assertions for this negative control: tab 1 sections [Alpha, Beta], tab 2 sections [Beta] only.

After — atomic sessions.groups.add at this head (no code change between the two runs except the mock's add handler):

Tab 1 sees both groups Tab 2 sees both groups
after tab1 after tab2

Both tabs concurrently created a group from the same pre-mutation (empty) catalog — both ALPHA and BETA sections are visible in both tabs, and the test asserts exactly one sessions.groups.add RPC per tab.

Existing-state upgrade/reopen preservation proof

Real Gateway, isolated state dir. Phase 1 seeds a pre-PR user state through the legacy RPC surface only (sessions.groups.put catalog + section order, sessions.groups.update defaults, sessions.create with group categories for memberships). Phase 2 performs a full Gateway restart and verifies the existing catalog, sidebar section order, group defaults, and session memberships survive untouched. Phase 3 applies the new add + partial reorder on top, and Phase 4 restarts again to prove the ordering contract persists without touching defaults or memberships:

Gateway started at ws://127.0.0.1:64000
Seeded existing state via legacy RPCs: 2 groups, 1 default, 2 member sessions.
✓ Reopen: group catalog: ["Legacy-A@0","Legacy-B@1"]
✓ Reopen: sidebar section order: ["work","category:Legacy-A","category:Legacy-B","ungrouped"]
✓ Reopen: Legacy-A defaults preserved: {"name":"Legacy-A","worktree":true}
✓ Reopen: session memberships: ["member-one=Legacy-A","member-two=Legacy-B"]
✓ After mutations: partial reorder places listed first, unlisted compacted: ["New-C@0","Legacy-A@1","Legacy-B@2"]
✓ After mutations: section order: ["work","category:New-C","category:Legacy-A","category:Legacy-B","ungrouped"]
✓ Final reopen: catalog persisted: ["New-C@0","Legacy-A@1","Legacy-B@2"]
✓ Final reopen: section order persisted: ["work","category:New-C","category:Legacy-A","category:Legacy-B","ungrouped"]
✓ Final reopen: Legacy-A defaults untouched by add/reorder: {"name":"Legacy-A","worktree":true}
✓ Final reopen: memberships untouched by add/reorder: ["member-one=Legacy-A","member-two=Legacy-B"]
✓ PASS: existing-state upgrade/reopen preservation proof succeeded.

This also serves as the data-model compatibility evidence for the stored catalog/sidebar state: state written by the legacy operations is read back unchanged after reopen, and the new mutations introduce no DDL — they update existing rows in the same SQLite tables.

Revision (2026-08-28)

Addressed the latest ClawSweeper P1 findings and CI failures:

  1. Removed destructive fallback in Control UI sessions.groups.add / reorder (ui/src/lib/sessions/session-group-catalog.ts)

    • add and reorder no longer fall back to a locally-constructed full-catalog sessions.groups.put when the Gateway call fails. If the atomic operation cannot complete, the error is surfaced instead of silently overwriting another tab's groups.
    • reorder now calls publishPathFreeMutation(..., readSidebarSectionOrder(result)) so the complete sidebar section order is persisted atomically in the same request.
  2. Redacted error strings in custom-group UI (ui/src/pages/sessions/custom-groups.ts)

    • Restored formatUiError(error) for the caught error branch instead of String(error), so raw internal messages are not exposed to the operator.
  3. Split session-group schema and method-scope coverage

    • Moved group-related schemas from packages/gateway-protocol/src/schema/sessions.ts to a new packages/gateway-protocol/src/schema/session-groups.ts and updated barrel/fragment imports.
    • Split session-group scope tests out of src/gateway/method-scopes.test.ts into src/gateway/method-scopes.session-groups.test.ts to keep the file size within policy.
  4. Updated E2E tests to use atomic group creation

    • All Control UI E2E tests that create a group now assert sessions.groups.add in their mock Gateway handlers, matching the production code path.
    • sessions.groups.put is still advertised in featureMethods where the UI checks menu permissions, because the permission model keys off the advertised method list.
    • A new E2E test, ui/src/e2e/session-management.concurrent-groups.e2e.test.ts, opens two Control UI tabs, creates group Alpha in tab 1 and group Beta in tab 2, and asserts both groups are visible in both tabs via shareSessionGroupsAcrossTabs localStorage synchronization.

Validation (after revision)

  • pnpm tsgo:core:test — pass
  • pnpm tsgo:ui — pass
  • Focused unit tests (session-groups, method-scopes.session-groups, ui/src/lib/sessions) — 203 + 70 pass
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-management.*.e2e.test.ts — 71 pass
  • pnpm format:check — pass
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <changed-files> — 0 warnings, 0 errors

Two-tab concurrent group proof

$ OPENCLAW_CAPTURE_UI_PROOF=1 node scripts/run-vitest.mjs run \
    --config test/vitest/vitest.ui-e2e.config.ts \
    --configLoader runner \
    ui/src/e2e/session-management.concurrent-groups.e2e.test.ts

✓ session-management.concurrent-groups.e2e.test.ts (3 tests) 7120ms
  ✓ concurrent custom group creation > tab 1 creates Alpha
  ✓ concurrent custom group creation > tab 2 creates Beta
  ✓ concurrent custom group creation > both tabs see Alpha and Beta

Captured screenshots:

  • .artifacts/control-ui-e2e/thread-management/concurrent-groups-tab1-both.png
  • .artifacts/control-ui-e2e/thread-management/concurrent-groups-tab2-both.png

Exact head after revision: 8f075f36856

Revision (2026-09-07): rebase onto current upstream/main

Rebased onto upstream/main (3b7bc9cb9de, ~6.4k commits) and resolved all conflicts. The feature is still needed: #106362 remains open, ClawSweeper's 2026-09-06 review confirms the empty-group concurrent-add loss is still reproducible on current main and v2026.9.2, and upstream #133005 only rejects sessions.groups.put drops of non-empty groups — two tabs concurrently creating empty groups still lose one. No upstream implementation of atomic group mutations exists.

Conflict resolutions and upstream adaptations:

  • putSessionGroups upstream now takes an options object ({ cfg, names, sectionOrder, env, assertCurrent, assertTargetCurrent }) and rejects dropping non-empty groups; the reorder regression tests were updated to the new signature.
  • Upstream moved PLUGIN_GATEWAY_GLOBAL_SESSION_MUTATION_METHODS to src/plugins/registry-runtime-session-ownership.ts; sessions.groups.add / sessions.groups.reorder are registered in the global session mutation set there.
  • Group schemas stay in the new packages/gateway-protocol/src/schema/session-groups.ts module (upstream's copy of the group schemas in schema/sessions.ts was dropped as duplicate).
  • createSessionCapability moved out of the ui/src/lib/sessions/index.ts barrel into ui/src/lib/sessions/create-session-capability.ts, and the new atomic-group RPC tests moved into ui/src/lib/sessions/index.session-groups.test.ts, keeping both files within the max-lines budget (699→701 and 995→1057 were over; now 32/670 and 995/70).
  • Advertised-method fixtures (server-methods-list.test-fixtures.ts, core-descriptors.since.test.ts) updated for the two new methods alongside upstream's sessions.goal.* additions.
  • Apple transports: kept the PR's makeSessionGroupsRouteLease wiring (iOS) reconciled with upstream's transport changes; Swift cannot be compiled on this Linux host — macOS CI owns that lane.

Validation (after rebase)

  • Gateway: session-groups.test.ts, method-scopes.session-groups.test.ts, core-descriptors.since.test.ts, server-methods/sessions-groups.test.ts, server-methods-list.test.ts — all pass.
  • UI unit: index.test.ts, index.session-groups.test.ts (new), app-sidebar.test.ts, sessions-page.test.ts — 405 pass.
  • UI e2e (mock Gateway): session-management.concurrent-groups, session-management.groups, session-management.new-group, session-management.sidebar, chat-continue-in-terminal — all pass.
  • Two-tab concurrent proof re-captured: concurrent-groups-tab1-both.png shows both ALPHA (created in tab 1) and BETA (created in tab 2) groups in tab 1's sidebar.
  • tsgo core + ui + gateway test shards — pass; run-oxlint.mjs — 0 warnings, 0 errors; oxfmt — clean; check:import-cycles — clean; plugin-sdk:surface:check — pass.

Behavior is unchanged from the previously approved proof (proof: sufficient); this revision is a rebase adaptation, so the earlier authenticated-Gateway concurrency traces and CI before/after proof remain valid.

Exact head after rebase: 17a267e874c

Revision (2026-09-16): rebase onto latest upstream/main

Rebased onto upstream/main (33c15b86fea) and resolved all conflicts; the 10 prior commits are squashed into one. The feature is still needed: upstream/main has no sessions.groups.add/sessions.groups.reorder (verified by tree search), #106362 remains open, and the merged #133005 guard only rejects sessions.groups.put drops of non-empty groups — two tabs concurrently creating empty groups still lose one.

Conflict resolutions and upstream adaptations:

  • Protocol schema registration: upstream deleted the protocol-schema-fragment-*.ts files in favor of derived registration (protocol-schema-selection.ts over schema-modules.ts). The group schemas stay in the PR-owned packages/gateway-protocol/src/schema/session-groups.ts, now wired through schema-modules.ts (66→67 modules; check-protocol-registry.mts count updated).
  • Control UI capability factory: upstream kept createSessionCapability inline in ui/src/lib/sessions/index.ts (with a reworked event pipeline), so the PR's create-session-capability.ts extraction was dropped and the groupsAdd/groupsReorder wiring plus the payload-envelope SAFETY annotation were applied directly to upstream's inline factory.
  • Test harness: ui/src/test-helpers/app-sidebar.ts took upstream's archiveState/archiveProvenance machinery and re-added the PR's groupsAdd/groupsReorder mocks with the typed result style.
  • Generated artifacts regenerated (never hand-edited): GatewayModels.swift (+28), GatewayProtocol.kt (+2), OpenClawProtocolConstants.kt, and the workboard control-ui bundle hash in extensions/workboard/openclaw.plugin.json (3655fa4e…).
  • Assertion-safety baseline refreshed: upstream's quicksilver entries ratcheted to 0 and were dropped; the PR's SAFETY annotation removed the ui/src/lib/sessions/index.ts entry.
  • Apple transport negotiation (supportsGroupAdd via gatewayAdvertisesMethod) reconciled with upstream's transport changes; Swift cannot be compiled on this Linux host — macOS CI owns that lane.

Validation (after this rebase)

  • Gateway: session-groups.test.ts (32), method-scopes.session-groups.test.ts + core-descriptors.since.test.ts + server-methods/sessions-groups.test.ts + server-methods-list.test.ts (53), method-scopes.test.ts — all pass.
  • UI: app-sidebar.test.ts + index.test.ts (468), sessions-page.groups/sessions-page/chat-pane/custom-groups (41), index.session-groups.test.ts (new) — all pass.
  • Protocol: protocol-registry:check, protocol:check:swift, protocol:check:kotlin, check-protocol-since — all pass; assertion-safety ratchet — pass.
  • Lint/typecheck: run-oxlint.mjs (0 errors; 2 pre-existing max-lines warnings also present on upstream/main), oxfmt --check clean, tsgo core + gateway test shards + UI + scripts — all pass.
  • UI before/after screenshots captured at this head and embedded above (two-tab concurrent creation; negative control emulates the legacy replacement loss). Assets branch: xialonglee/openclaw@proof-112227-ui-screenshots.
  • Existing-state upgrade/reopen preservation proof (legacy RPC seed → restart → verify; add/partial-reorder → restart → verify) — 10/10 checks, output above.
  • Real-Gateway WebSocket proof re-run post-rebase against the merged tree (fresh script, two authenticated operator clients, isolated state dir):
Gateway started at ws://127.0.0.1:63000
Two authenticated clients connected.
Tab A sessions.groups.add('Client-A'): {"ok":true,"groups":[{"name":"Client-A","position":0}],"sectionOrder":[]}
Tab B sessions.groups.add('Client-B'): {"ok":true,"groups":[{"name":"Client-A","position":0},{"name":"Client-B","position":1}],"sectionOrder":[]}
✓ Catalog after concurrent adds: ["Client-A","Client-B"]
✓ Catalog after reorder: ["Client-B","Client-A"]
✓ Section order after reorder: ["work","category:Client-B","ungrouped","category:Client-A"]
✓ Section order observed by second client: ["work","category:Client-B","ungrouped","category:Client-A"]
✓ Catalog after partial reorder: ["Client-C","Client-B","Client-A"]
✓ Section order after partial reorder: ["work","category:Client-C","category:Client-B","category:Client-A","ungrouped"]
✓ Section order observed by second client after partial reorder: ["work","category:Client-C","category:Client-B","category:Client-A","ungrouped"]
✓ Catalog after legacy put: ["Client-A"]
✓ Section order after legacy put: ["category:Client-A","work","ungrouped"]

✓ PASS: authenticated Gateway concurrent-add/reorder/put proof succeeded.

Exact head after rebase: 28522c11067

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: M size: L app: android App: android and removed size: M labels Jul 21, 2026
@xialonglee
xialonglee force-pushed the fix/issue-106362-concurrent-session-groups branch from f221356 to 6805ab0 Compare July 25, 2026 12:16
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 25, 2026
@clawsweeper

clawsweeper Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 24, 2026, 3:53 AM ET / 07:53 UTC (Revision 36).

ClawSweeper review

What this changes

The branch adds atomic session-group creation and reordering to the Gateway, moves the Control UI and Apple clients onto group-add support, and retains catalog replacement for older native gateways.

Regression provenance

Possible regression — probable (reproduction; failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 6 items remain

Keep this PR open. The linked concurrent-creation bug remains on current main, and the PR provides strong after-fix Gateway evidence. A public Swift initializer break, unresolved partial-reorder contract, and current merge conflicts block landing.

Priority: P1
Reviewed head: 28522c110676397bd917efe4fd9ebbc896af7e5d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong real Gateway and UI evidence supports the core fix, while a public Swift API break and unresolved integration and ordering contracts limit merge readiness.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR records authenticated two-client Gateway requests at the pinned head: both concurrent adds persist, a second client reads the reordered catalog, and legacy-seeded catalog, defaults, and memberships survive restart before and after new mutations. Its UI evidence also shows both groups in two tabs. Existing-state compatibility is supported for this reviewed head; the conflicted current-main integration will need fresh proof after reconciliation.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR records authenticated two-client Gateway requests at the pinned head: both concurrent adds persist, a second client reads the reordered catalog, and legacy-seeded catalog, defaults, and memberships survive restart before and after new mutations. Its UI evidence also shows both groups in two tabs. Existing-state compatibility is supported for this reviewed head; the conflicted current-main integration will need fresh proof after reconciliation.
Evidence reviewed 8 items Current-main necessity: Current main has no sessions.groups.add or sessions.groups.reorder implementation; its Control UI still builds a full replacement from the known groups.
Introduced Gateway behavior: The branch adds a group through the existing registration owner and adds a transactional reorder that persists listed groups first and compacts unlisted groups afterward.
Swift source compatibility: The previously public route-lease initializer takes a new required addGroup argument. Existing callers using its former signature would fail to compile; the new supportsGroupAdd argument alone has a default.
Findings 1 actionable finding [P1] Preserve the existing public route-lease initializer
Security None None.

How this fits together

The Gateway owns the shared session-group catalog and sidebar order in SQLite. Web and native clients send group mutations to it, then receive the resulting catalog and change notifications.

flowchart LR
  A[Web and Apple clients] --> B[Gateway group requests]
  B --> C{Add or reorder?}
  C --> D[Session group catalog]
  D --> E[SQLite state]
  E --> F[Updated catalog and change event]
Loading

Decision needed

Question Recommendation
Should the public partial-reorder RPC intentionally place listed groups ahead of all unlisted groups, or preserve unlisted groups' existing slots? Accept listed-first order: Keep the implementation and document that omitted groups follow listed groups in their prior relative order.

Why: Both are plausible persistent ordering contracts; the implementation and protocol comment currently disagree, and prior review requested explicit acceptance.

Before merge

  • Preserve the existing public route-lease initializer (P1) - Adding a required addGroup closure changes the public Swift initializer, so existing callers using its four-closure signature no longer compile. Keep that signature available, with unsupported add behavior when capability negotiation is false. I missed this source-compatibility issue in the earlier review of the same head.
  • Resolve merge risk (P1) - The new public partial-reorder RPC persists listed groups ahead of unlisted groups, while its protocol comment promises that unlisted groups keep their positions; maintainer acceptance of the intended contract remains unrecorded.
  • Resolve merge risk (P1) - The pinned head conflicts with the current base, whose Gateway group writes now use an asynchronous state-worker owner. Reconciliation and renewed proof are needed before its merged behavior is known.
  • Resolve merge risk (P1) - The PR body embeds before/after UI images, but the required inspected screenshots have not been verified as rendering in the originating chat.
  • Complete next step (P2) - Preserve the public Swift initializer, obtain the reorder-contract decision, reconcile the branch with current main, and verify originating-chat screenshot delivery before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P1] Preserve the existing public route-lease initializer — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatTransport.swift:528
Agent review details

Security

None.

PR surface

Source +202, Tests +462, Other +160. Total +824 across 49 files.

View PR surface stats
Area Files Added Removed Net
Source 15 295 93 +202
Tests 23 525 63 +462
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 11 177 17 +160
Total 49 997 173 +824

Review metrics

Metric Value Why it matters
New Gateway methods 2 public RPCs added Creation and reordering gain separate protocol contracts that need an explicit ordering decision.
Native API compatibility 1 public initializer changed The added required closure breaks existing source callers of the route-lease initializer.

Stored data model

Persistent data-model change detected: unknown-data-model-change: packages/gateway-protocol/src/schema/session-groups.ts, unknown-data-model-change: packages/gateway-protocol/src/schema/sessions.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #106362
Summary: This PR is the open candidate fix for the reported concurrent empty-group loss; the merged non-empty-drop guard and the separate agent-isolation draft address adjacent behavior.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Repair and reconcile (recommended)
    Preserve the old Swift initializer, settle the reorder contract, and rebase the mutations onto current Gateway state ownership before merge.
  2. Pause for the current owner
    Hold the PR if the catalog-owner reconciliation or public ordering contract cannot be established safely.

Technical review

Best possible solution:

Keep atomic creation at the Gateway owner, preserve the existing Swift initializer for callers, choose and document one partial-reorder contract, then reconcile the branch with the current state-worker path and complete screenshot delivery.

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

Yes. The linked report gives a two-tab, stale-catalog reproduction, current main still uses full replacement, and the PR supplies a before/after Gateway trace.

Is this the best way to solve the issue?

Yes for atomic group creation at the Gateway boundary. The partial-reorder persistence rule needs one approved contract, and the Swift API should retain its existing initializer.

Full review comments:

  • [P1] Preserve the existing public route-lease initializer — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatTransport.swift:528
    Adding a required addGroup closure changes the public Swift initializer, so existing callers using its four-closure signature no longer compile. Keep that signature available, with unsupported add behavior when capability negotiation is false. I missed this source-compatibility issue in the earlier review of the same head.
    Confidence: 0.94
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 session-state: The PR writes group positions and sidebar order, while current main has since moved catalog mutation to a state worker and the head currently conflicts.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR records authenticated two-client Gateway requests at the pinned head: both concurrent adds persist, a second client reads the reordered catalog, and legacy-seeded catalog, defaults, and memberships survive restart before and after new mutations. Its UI evidence also shows both groups in two tabs. Existing-state compatibility is supported for this reviewed head; the conflicted current-main integration will need fresh proof after reconciliation.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P1: The linked two-tab workflow can still silently lose an empty custom group on current main.
  • merge-risk: 🚨 compatibility: The patch changes a public Swift initializer and introduces a persistent reorder contract whose stated behavior disagrees with its implementation.
  • merge-risk: 🚨 session-state: The PR writes group positions and sidebar order, while current main has since moved catalog mutation to a state worker and the head currently conflicts.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR records authenticated two-client Gateway requests at the pinned head: both concurrent adds persist, a second client reads the reordered catalog, and legacy-seeded catalog, defaults, and memberships survive restart before and after new mutations. Its UI evidence also shows both groups in two tabs. Existing-state compatibility is supported for this reviewed head; the conflicted current-main integration will need fresh proof after reconciliation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR records authenticated two-client Gateway requests at the pinned head: both concurrent adds persist, a second client reads the reordered catalog, and legacy-seeded catalog, defaults, and memberships survive restart before and after new mutations. Its UI evidence also shows both groups in two tabs. Existing-state compatibility is supported for this reviewed head; the conflicted current-main integration will need fresh proof after reconciliation.

Evidence

What I checked:

  • Current-main necessity: Current main has no sessions.groups.add or sessions.groups.reorder implementation; its Control UI still builds a full replacement from the known groups. (ui/src/components/session-organizer-catalog.ts:35, ffb17b275480)
  • Introduced Gateway behavior: The branch adds a group through the existing registration owner and adds a transactional reorder that persists listed groups first and compacts unlisted groups afterward. (src/gateway/session-groups.ts:318, 28522c110676)
  • Swift source compatibility: The previously public route-lease initializer takes a new required addGroup argument. Existing callers using its former signature would fail to compile; the new supportsGroupAdd argument alone has a default. (apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatTransport.swift:528, 28522c110676)
  • Existing-state and live behavior proof: The PR body records two authenticated Gateway clients retaining both added groups, a second client observing persisted order, and a legacy-state seed and restart preserving catalog, defaults, and memberships. The same body embeds before/after UI images. These are contributor-supplied traces at the reviewed head; the originating-chat screenshot delivery is not verified in the available discussion. (28522c110676)
  • Partial-reorder contract: The new protocol comment says unlisted groups keep their current position, while the introduced implementation places every listed group before every unlisted group. The previous completed review requested explicit acceptance of this persistence contract; no maintainer acceptance appears in the available discussion. (packages/gateway-protocol/src/schema/session-groups.ts:50, 28522c110676)
  • Current-main divergence: Current main now uses asynchronous session-group catalog mutations through its state worker. GitHub reports this PR's pinned head as dirty against its base, and no pinned test-merge result is available; the branch must be reconciled before merge behavior can be judged. (src/gateway/session-groups.ts:106, ffb17b275480)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RoboClaw: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Restore source compatibility for the public route-lease initializer.
  • Record the intended partial-reorder contract and reconcile the branch with current Gateway state ownership.
  • Verify inspected before/after screenshots render in the originating chat as well as the PR.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (35 earlier review cycles; latest 8 shown)
  • reviewed September 5, 2026, 4:01 AM ET / 08:01 UTC sha unknown :: blocked before merge. :: [P1] Negotiate native add support before dispatching the request | [P1] Reuse the existing atomic group-registration owner | [P2] Keep successful additions within the reorder contract | [P2] Register and publicly export both new request schemas | [P2] Force stale submissions in the concurrent-group regression
  • reviewed 2026-09-07T15:53:24.120Z sha 17a267e874cd29048b31991aeac03f3248da2b02 :: blocked before merge. :: [P1] Negotiate native add support before dispatching the request | [P1] Reuse the existing atomic group-registration owner | [P1] Preserve supported catalog sizes across mutation schemas | [P2] Register and publicly export both new request schemas | [P2] Force stale submissions in the concurrent-group regression
  • reviewed 2026-09-08T02:31:20.409Z sha a9b5c5d00c7430bba1a9f778c6f68bb5ae865fda :: blocked before merge. :: [P2] Align the release-train assertions with the new descriptors | [P2] Hold both mutation requests before either catalog update completes
  • reviewed 2026-09-08T03:33:10.825Z sha 0c28f6609df15388927cbbb7f0521b0188608f45 :: blocked before merge. :: none
  • reviewed 2026-09-08T04:12:53.303Z sha b3aa273c93ccb2b2316a4f398985ef2e5623782b :: blocked before merge. :: none
  • reviewed 2026-09-08T07:28:40.320Z sha b3aa273c93ccb2b2316a4f398985ef2e5623782b :: blocked before merge. :: none
  • reviewed 2026-09-16T10:11:49.169Z sha 28522c1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-16T11:35:24.179Z sha 28522c1 :: blocked before merge. :: none

@xialonglee
xialonglee force-pushed the fix/issue-106362-concurrent-session-groups branch from 6805ab0 to 4bc9063 Compare July 25, 2026 13:33
@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 25, 2026
@xialonglee
xialonglee force-pushed the fix/issue-106362-concurrent-session-groups branch from 4bc9063 to f09f327 Compare July 26, 2026 14:48
@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 26, 2026

MixxyAI commented Jul 30, 2026

Copy link
Copy Markdown

One separate collaboration question, since your real multi-Agent Gateway testing is unusually relevant here: I’m preparing a controlled test of the NodeRooms release-source/1.3.0 OpenClaw plugin source. It is read-only and pinned to SHA-256 3846f8f8a1c5d051064efc629da3e4cf768c0b10f3386436506aa3db8cdc5913; no public writes, Passport/capability/lease actions, raw logs, or secrets. The main thing I’d like to validate is per-Agent identity and credential isolation on a shared Gateway. If you’re interested, I can provide the short exact protocol and we can compare only redacted PASS/FAIL evidence.

@xialonglee
xialonglee force-pushed the fix/issue-106362-concurrent-session-groups branch from faeab83 to 77f6a99 Compare July 30, 2026 11:59
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 30, 2026
@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased onto upstream/main, addressed the four latest findings, and refreshed the real Gateway proof:

  • P1: unlisted sidebar sections are now preserved during partial reorders by normalizing sectionOrder against the complete resulting catalog.
  • P1: shared Apple client uses atomic sessions.groups.add with legacy sessions.groups.put fallback.
  • P1: sessions.groups.add and sessions.groups.reorder are appended in core-descriptors.ts with since: "2026.8".
  • P2: reorderSessionGroups discards nonexistent names before assigning positions.

Real behavior proof (two authenticated tabs) passes end-to-end, including concurrent adds, full reorder + section order, partial reorder preserving unlisted group sections, and legacy put semantics. All targeted tests and lint/format checks are green.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the three remaining P1 findings from the latest review:

  1. Metadata-less Gateway fallback — session-group-catalog.ts now treats absent features.methods as legacy for both sessions.groups.add and sessions.groups.reorder, with regression tests in ui/src/lib/sessions/index.test.ts.
  2. Apple fallback restricted — ChatViewModel+SessionActions.swift only falls back to the legacy putGroups replacement on the recognized old-Gateway INVALID_REQUEST / "unknown method: sessions.groups.add" response; other errors propagate.
  3. Lease constructor wiring — addGroup is now supplied by the iOS, macOS, and shared-test OpenClawChatSessionGroupsRouteLease constructors.

Also regenerated the plugin-sdk API baseline and native-app i18n inventory. Swift build/toolchain verification will need CI (no local Swift toolchain). Focused TS tests and lint/format pass locally.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased onto upstream/main and resolved conflicts. Addressed the remaining P1 finding:

  • sessions.groups.add now returns the persisted { ok, groups, sectionOrder } result.
  • Sidebar section order persistence uses the upstream config_machine_state path (updateSidebarSectionOrder) instead of the removed sidebar_sections table.
  • Updated UI tests to use the new input-dialog helper and removed the duplicate multi-select new-group case that was still using the old window.prompt mock.
  • Regenerated auto-generated files (apps/.i18n/native-source.json, apps/android/.../GatewayProtocol.kt) via the project scripts.

Verified: app-sidebar.test.ts (300), sessions-groups.test.ts (7), session-groups.test.ts (204 across gateway shards), and sessions-page.test.ts (34) all pass; oxlint and oxfmt are clean on changed files.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The latest revision addresses the remaining P1 findings from your review:

  1. Destructive fallback removed in Control UI add/reorder — ui/src/lib/sessions/session-group-catalog.ts no longer falls back to a full-catalog sessions.groups.put when sessions.groups.add or sessions.groups.reorder fails. Failures now surface as errors instead of overwriting another tab's groups.
  2. Redacted error strings — ui/src/pages/sessions/custom-groups.ts restored formatUiError(error) instead of String(error).
  3. Schema/test splits — group schemas moved to packages/gateway-protocol/src/schema/session-groups.ts; session-group method scopes split into src/gateway/method-scopes.session-groups.test.ts.

Also updated all E2E group-creation assertions to use sessions.groups.add (while keeping sessions.groups.put in featureMethods for menu-permission checks) and added a two-tab concurrent-group E2E test with captured screenshots.

Validation run

$ pnpm tsgo:core:test          # pass
$ pnpm tsgo:ui                 # pass
$ node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-management.*.e2e.test.ts
# 71 pass
$ pnpm format:check            # pass
$ node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <changed-files>
# 0 warnings, 0 errors

Two-tab concurrent-group proof

$ OPENCLAW_CAPTURE_UI_PROOF=1 node scripts/run-vitest.mjs run \
    --config test/vitest/vitest.ui-e2e.config.ts \
    --configLoader runner \
    ui/src/e2e/session-management.concurrent-groups.e2e.test.ts

✓ session-management.concurrent-groups.e2e.test.ts (3 tests) 7120ms
  ✓ concurrent custom group creation > tab 1 creates Alpha
  ✓ concurrent custom group creation > tab 2 creates Beta
  ✓ concurrent custom group creation > both tabs see Alpha and Beta

Screenshots captured locally:

  • .artifacts/control-ui-e2e/thread-management/concurrent-groups-tab1-both.png
  • .artifacts/control-ui-e2e/thread-management/concurrent-groups-tab2-both.png

Exact head: 8f075f36856

@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed all five findings and the CI failures on the reviewed head:

  • Negotiate native add support before dispatch (P1): the session groups route lease now carries supportsGroupAdd, negotiated when the lease is captured. Unsupported routes take the legacy read-modify-write put up front; authorization and transport failures stay out of the fallback.
  • Reuse the atomic registration owner (P1): sessions.groups.add now routes through ensureSessionGroupRegistered; the duplicated insertion flow is removed.
  • Preserve supported catalog sizes (P1): removed the newly imposed 200-name / 232-section limits so put/add/reorder keep the merge-base accepted domain.
  • Register and export both request schemas (P2): both schemas are in the lifecycle registry and public-schema.ts; protocol artifacts regenerated; new methods carry since: 2026.9.
  • Force stale submissions (P2): the concurrent-groups e2e now opens both dialogs before either submits, so both callers hold the same pre-mutation catalog and the old replacement behavior demonstrably loses a name.

CI repairs on top: protocol registry module count, assertion-safety baseline shrink, gateway-root shard limit, sessions/chat-pane test fixtures, group-identity e2e deferred method, Swift test throws signature and swiftlint brace wrap, and the e2e mock's sessionStorage access under denied/sandboxed contexts.

Local validation: pnpm protocol:check (with base SHA), gateway and UI unit tests, the bundled vitest suite, and the affected e2e suites all pass.

Note: the checks-node-compact-large-11 failure (src/agents/worktrees/git.test.ts, "Maximum call stack size exceeded") reproduces locally on this head and is untouched by this PR; the output-formatting path it exercises was refactored on main after this CI run was dispatched, so the fresh-head run should settle it.

@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased onto the latest upstream/main and addressed both remaining findings:

  • Release-train assertions (P2): sessions.groups.add/sessions.groups.reorder moved from TRAIN_2026_8_METHODS to explicit 2026.9 assertions, matching the production descriptors (since: "2026.9").
  • Deterministic stale-catalog barrier (P2): the concurrent-groups e2e now defers both sessions.groups.add responses in the mock Gateway, waits for both stale requests to arrive, then releases them together. Both submissions are now dispatched against the same pre-mutation (empty) catalog regardless of render timing.
  • Merge conflicts: resolved by keeping the sessions barrel split and porting main's cached-roster lifecycle (cacheLifecycle persist/synchronize/dispose, bootRecord initial state, whenCachedRosterSettled) into create-session-capability.ts; diff-verified identical to main's implementation apart from the barrel exports and this PR's group RPC wiring.

Negative control: with the mock's add handler temporarily emulating the stale read-modify-write replacement (each stale write replacing the catalog), the e2e fails because category:Alpha disappears from tab 2 — the regression fails on lost data, not on RPC selection. Restored afterward.

Validation:

  • core-descriptors.since.test.ts — pass
  • session-management.concurrent-groups.e2e.test.ts — pass (barrier flow)
  • session-management.groups.e2e.test.ts (12) — pass
  • ui/src/lib/sessions/index.test.ts + index.session-groups.test.ts (35) — pass
  • src/gateway/session-groups.test.ts + method-scopes.session-groups.test.ts (40) — pass
  • oxlint 0/0, oxfmt clean, tsgo gateway-other / ui-e2e / ui lanes — pass

Exact head: 0c28f6609df

@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

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

Labels

app: android App: android app: ios App: ios app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. plugin: workboard proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL stale Marked as stale due to inactivity status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Control UI: concurrent custom-group creation silently loses one group

3 participants