Repository navigation
improve: keep first-use session categories off the Gateway thread - #150565
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 6:51 AM ET / 10:51 UTC (Revision 8). ClawSweeper reviewWhat this changesMoves session category registration into the existing database worker, awaits completion before group notifications, and adds regression coverage and test routing. Merge readiness✅ Ready for maintainer review Keep open: current main and the latest release still perform registration synchronously. The scoped worker conversion remains useful, and source review found no blocking defect. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway saves session categories and maintains the shared catalog used to organize sessions. Registration adds missing category names to SQLite before notifying clients to refresh that catalog. flowchart TD
A[Session create or patch] --> B[Save session category]
B --> C[Shared database worker]
C --> D{Category exists?}
D -->|Yes| E[Return unchanged]
D -->|No| F[Recheck and append atomically]
F --> G[Publish catalog notification]
C -->|Failure| H[Preserve session and warn]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +26, Tests +165, Docs +9. Total +200 across 14 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep category registration within the existing shared-state worker while preserving atomic append order, durable session outcomes, and post-registration notifications. Do we have a high-confidence way to reproduce the issue? Yes, source inspection establishes that category creation and assignment invoke synchronous SQLite registration on current main; no runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes. Moving the existing operation into the established worker and updating both callers is a narrow solution that preserves the stored representation and recovery behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3c6c393f5136. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
78a434b to
ed95134
Compare
ed95134 to
d917db8
Compare
Reuse the canonical 13-command selector without changing tag order or the delivery executor. This keeps the current-main dispatcher within its existing line cap when category registration and the GitHub pending read are combined. Refs #150565.
Reuse the canonical 13-command selector without changing tag order or the delivery executor. This keeps the current-main dispatcher within its existing line cap when category registration and the GitHub pending read are combined. Refs #150565.
d917db8 to
242cdd5
Compare
|
Merged via squash.
|
…enclaw#150565) * refactor(sessions): register first-use categories off thread Move registration into the existing shared-state worker while preserving existing-category admission avoidance, atomic append ordering, durable session success, and catalog-only patch invalidation. Both post-commit callers await registration before notification. Refs openclaw#144592 and openclaw#150565. * refactor(state): keep session delivery dispatch with its contract Reuse the canonical 13-command selector without changing tag order or the delivery executor. This keeps the current-main dispatcher within its existing line cap when category registration and the GitHub pending read are combined. Refs openclaw#150565.
Related: #144592
What Problem This Solves
Creating a session or assigning a first-use category performs synchronous catalog registration on the Gateway thread.
User Impact
Registration runs off the Gateway thread while creation and patch requests still wait for its result before publishing group notifications. Existing categories avoid writer admission. A catalog failure preserves the saved session and produces a warning; repeating the same category assignment can repair the catalog. No schema, configuration, migration, or retention changes are required.
Why This Change Was Made
The existing shared-state worker receives the captured database target and environment. Its registration owner checks for an existing category before writer admission, then rechecks missing names and appends them atomically. Both post-commit callers await completion. The patch path retains the durable-success warnings and catalog-only invalidation introduced by #151689, including uncertain outcomes.
The unchanged session-delivery command selector now lives with its existing worker contract. All 13 tags retain their order and executor. This keeps the shared dispatcher within its existing size guard when category registration is combined with current main's GitHub pending read.
Evidence
The synchronous registration path failed the native-SQL regression with parent-thread calls; the worker path passes with zero parent-thread SQLite calls. The selector composition passes 61 category, actual create/patch RPC, and session-delivery storage/runtime cases. These cover overlapping registrations, captured state-directory identity, existing-category admission avoidance, a competing writer, committed catalog visibility at notifications, durable create success after a controlled registration rejection, delivery claims, retries, owner replacement, and settlement.
The unchanged publication, sticky-model, and batch-tool checks retain their earlier passing evidence. The final main refresh preserves every production and behavior-test byte from the 61-case run; all eight affected routing checks pass after retaining the current sandbox fixtures and the batch-tool fixture together. Core typechecking, scoped type-aware lint, formatting, import-cycle and line-cap checks pass. The exact combined source reproduced the line-cap failure before the shared selector extraction and passes afterward, including the staged candidate. Isolated review found no actionable P0–P2 findings. Exact-head hosted CI remains required before merge.
Proof uses synthetic isolated SQLite state and actual direct RPC handlers. It does not exercise a live provider, operator Gateway, broader catalog worker migration, or native fault injection.