Repository navigation
refactor(sessions): await input completion and collapse suggestion writes - #169573
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 real behavior proof before merge. What this changesThis PR consolidates suggestion transactions, moves reaction reads to workers, simplifies committed-input publication, and preserves deprecated synchronous completion callbacks. Example: Alice suggests “Review the deployment” in agent:main:main with an expected session entry.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep this PR open: it contains useful storage consolidation absent from current main, and the earlier synchronous completion compatibility defect is resolved; no definite introduced bug was established. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherGateway and agent requests enter session storage owners, which persist collaboration state and publish committed receipts and membership facts for responses and authorization. flowchart TD
A[Gateway and agent requests] --> B[Session storage owners]
B --> C[Worker admission]
C --> D[Shared database kernels]
D --> E[Agent SQLite database]
E --> F[Committed receipts and membership]
F --> G[Catalog authorization and responses]
Technical reviewBest possible solution: Retain the worker consolidation and released SDK adapter, with catalog authority verified at provider effects and the built CLI failure attributed. Do we have a high-confidence way to reproduce the issue? Current-main source shows suggestion worker commands calling transaction-owning facades and separately checking session identity; no target code was executed during this review. Is this the best way to solve the issue? Reusing shared kernels inside the existing worker transaction is appropriate, and preserving the synchronous callback resolves the earlier concrete compatibility defect. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against af2c00828eb3. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: shipped entry point. SecurityNeeds attention: No concrete bypass was established, but the changed catalog authority source needs final-effect validation. EvidenceSecurity concerns:
What I checked:
Likely related people:
PR surfaceSource +78, Tests +135, Docs +6. Total +219 across 34 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (7 earlier review cycles)
Reviewed October 12, 2026, 3:49 AM ET / 07:49 UTC (Revision 8). |
# Conflicts: # docs/reference/database-schemas/worker-access-inventory.md
…ites (openclaw#169573) Route bundled input completion and reaction reads through the existing worker owner. Remove pending-input publication recaptures, duplicate suggestion reads and nested transaction work while retaining the deprecated released SDK completion adapter. Live warmed workload: 334.6 to 325.9 statements and 103.4 to 100.9 requests; MAIN 0.2 unchanged. Assigned T1 remains 50 with documented native, SDK and final-authority exceptions. Types, lint, source contracts, Madge, SDK boundaries and database ratchets passed. Independently attributed actor-postimage, upstream census and concurrent-delete reporting failures remain documented in the PR. Head-pinned fallback after native preparation stalled.
First-parent upstream fa23864..e099f44 (100 commits, including openclaw#169594 lifecycle/mention bookkeeping in workers, openclaw#169573 input completion, openclaw#169724 fact-only refresh rows, openclaw#169598 target discovery). Conflicts: - session-entry-patch-source.ts: upstream routes host-only commit guards through the worker (`!commitGuard?.nativeSource`); kept our condition that a patch with afterPersistInTransaction (a main-thread closure) stays on the native writer. - compact.types.ts: our "volitional" trigger plus upstream's modelCallUrgency. - session-accessor.ts: upstream dropped the sync updateSessionProfileInvolvement export (no fork caller); recipient authority exports kept. - worker inventory regenerated. Auto-merged files carrying continuation overlay (21) keep it byte-for-byte. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
What Problem This Solves
Core-created user-turn recorders could still complete pending input through a native SQLite mutation. Suggestion commands also entered a second transaction inside their existing worker transaction and read the session identity twice. This change moves bundled completion callers to the awaited owner and removes the redundant suggestion work. The released synchronous SDK adapter remains deprecated until the next SDK major.
Core callers await completion. Host-created recorders preserve the deprecated
completeProcessingadapter, its immediate return and transaction semantics, and emit a deprecation warning namingcompleteProcessingAsync. Plugin-supplied legacy callbacks remain accepted only when no async companion exists. Bundled completion fixtures use the async API. Suggestion worker commands call the shared database kernels directly in their existing transaction; one expected-entry comparison supplies the session identity and sharing authority check.Reaction listing has an awaited worker API. Catalog authorization consumes the projection owner's published membership facts, and transcript annotation leaves its exact-row check to the writer. There are no schema, format, retention, permission, or production Doctor/update changes; the Doctor test changes only await their completion fixtures.
T1 accounting and retained boundaries
The assigned files still contain 50 T1 call expressions. This PR does not claim a static T1 reduction or completion of the entire lane. Bundled completion callers use the worker, but the kernels remain shared with native-incognito or deprecated synchronous SDK adapters. Follow-up after #169363 removes the excluded native-incognito callers; shared files are not relabeled as worker-only prematurely.
Final membership checks before privileged effects remain: the authority owner still permits native SDK writers, so a prepared hint cannot replace those checks. Existing synchronous SessionManager and transcript adapters retain their documented deprecations, runtime warnings, and async replacements.
Removed checks and accepted edges
Measurement
The shared workload ran locally against isolated synthetic state, using the unchanged shared harness plus its established request census. Baseline
7f337b2c5a20033c89304d030045fa0fe0338e13; candidatee7066e0deb77098a675ab4618ee40f8e95f0b8f4. The final merge of main preserved this implementation and accepted main’s generated inventory snapshot; this PR no longer changes the generated inventory. RELAXED TESTING v6 permits one pair. This valid pair is retained. Two attempted additional comparisons are excluded under the existing duration-skew rule: one had 1.69× candidate/baseline warmed duration; its replacement had 1.78× first-turn duration (2.06× boot and 2.80× connect). No result is selected by SQL count. The final SDK compatibility restoration is dormant on these bundled async flows; the later fixture fix changes tests only.Valid pair (mean over ten warmed turns; one valid pair means the median and range coincide):
These workload differences include scheduled background work; they are not all attributable to this patch.
The first-turn slice alone is 1,881 → 1,966, but its unchanged deferred open/admission work moved across startup boundaries:
openadds 67 in that slice and falls by 9 across the combined startup window. Other shifted owners includedatabase.domain.publish, deletion snapshots, and registry inventory. Startup requests are 337 → 341 (+1.19%); the warmed and whole-workload requests fall. The second-session increase (+86) consists mainly of domain publication (+37), subagent persistence (+20), and delivery settlement (+6), which leave the adjacent control/cron window. These are existing background operations, not new commands from this patch. The combined startup statement difference is below TURN NOISE FLOOR; the cold request movement is within the T1 MOVE EXCEPTION, with no warmed increase. All 13 turns, child execution, cron, compaction, and shutdown completed. The baseline's optional mention-dismiss probe returned Inbox unavailable after the warmed turns; the candidate completed it. The baseline runner's final blanket RPC assertion therefore failed, while its workload results and SQL census were complete.Real async suggestion-owner probe, counting the owning worker command (one request and zero MAIN statements in every cell):
Deferred open/admission work emitted two additional statements in the baseline release/reclaim windows and candidate release window; it is excluded from the per-command table and included in raw phase totals.
Evidence
ci:no-fail-fastis enabled for the integrated-head run.agentRunHasVisibleReply/retireOpenClawStateReadConnectionAfterCorruption. Ordinary PR CI excludes the dependencies job. No passing Knip claim is made.3d5ae552ee97fdc7c0c5b9007c78ad3fe157459dpassed every static job and build-artifacts in run 38214326082. The new host recorder regression passed (1017 ms), all 15 pending-input-operation tests passed, and the async completion test confirms no caller-thread SQL. Its changed-file test group completed 136 tests in 30.70 seconds; no local suites were run under v6. The standalone SDK API diff did not complete; the released callback surface and implementation remain, and the SDK/extension boundary is covered by CI.9357a5d8e538f775197c35d86d0087d85bcb014dcompleted CI 38218346987. All production/test type shards, all lint shards, source/export contracts, Madge, SDK/extension boundaries, and worker/T1/dialect ratchets passed. Knip has the separately documented inherited main failures above; no passing standalone Knip claim is made.Final diff: production +242/-164 across 17 files; tests +259/-124 across 15 files; docs +14/-8 across 2 files (515 additions, 296 deletions total).
Follow-ups: remove the extra skills-library preparation membership authorization (the effect check remains); add production catalog revocation/replacement coverage at the existing effect guard; remove excluded native-incognito entrances after #169363, then reclassify genuinely worker-only kernels. Retained SDK/final-authorization paths keep their documented next-major retirement boundary. Memory-actor error serialization also drops the work-start-invalidated code; it safely refuses the write but can misclassify the error, outside this patch.