Repository navigation
fix(sessions): avoid pauses decoding unrelated prompts during creation - #139529
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 5, 2026, 8:19 PM ET / September 6, 2026, 00:19 UTC. ClawSweeper reviewWhat this changesSession creation reads complete saved state for target sessions while using lightweight sibling metadata for label checks. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and v2026.9.2 still prepare creation callbacks by loading unrelated saved prompts. No actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherGateway and internal SDK session creation share a SQLite-backed preparation helper. Its snapshot feeds session adoption, label validation, and guarded transcript and session writes. flowchart TD
A[Gateway or SDK creation request] --> B[Resolve session store and target]
B --> C[Read target payload and sibling metadata]
C --> D[Prepare entry and validate label]
D --> E{Preparation accepted}
E -->|Yes| F[Guarded transcript and session writes]
E -->|No| G[Return creation error]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +81, Tests +304. Total +385 across 12 files. 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. Technical reviewBest possible solution: Keep creation preparation in the existing snapshot owner, preserving complete adoption state while avoiding unrelated prompt allocation. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: creating a session loads every full entry before even an ignored-context callback runs. The linked report supplies a quantified reproduction; this review did not execute it. Is this the best way to solve the issue? Yes. Extending the existing reader preserves target payloads and label semantics without adding a competing parser, cache, or persisted representation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 89940df0a1a4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
openclaw#139529) * perf(sessions): preserve target payloads without decoding sibling prompts * test(sessions): satisfy brace lint in creation coverage
Closes #139526
What Problem This Solves
Fixes pauses when creating or adopting sessions in agent stores containing large saved prompts. Creation previously decoded every saved prompt in the store before invoking its preparation callback, including when that callback ignored the store.
Why This Change Was Made
The existing snapshot owner now supports an uncached selective-full read: requested/canonical/folded target candidates retain their complete payloads while sibling rows use the established metadata projection. The same SQL row snapshot supplies target and label facts. Existing participant hydration remains its separate query; no transaction or broader consistency guarantee is introduced.
The internal callback receives its resolved existing entry, distinct exact target entry, and detached label predicate. Gateway adoption keeps its full original payload. Existing canonical-key, malformed-row, owner, participant, transcript/lifecycle and commit-guard behavior remain in place. The default SDK callback continues using the same creator without consuming snapshot context.
User Impact
Creating a session avoids allocating unrelated saved prompt payloads. Adoption preserves saved skill snapshots and system-prompt reports; existing label rejection, incognito scope and guarded initialization behavior remain unchanged.
Evidence
Compiled Gateway proof on source
36beea075b748e33da163d2173f7f760d180b06fcompleted four token-authenticatedsessions.createscenarios: new creation, full-target adoption, duplicate-label rejection, and structural-key normalization. A separate process verified saved target prompt/report hashes, the new session, absence of the rejected row, and all 100 unchanged siblings. Source/build/harness seals remained stable and the Gateway shut down cleanly. The isolated proof environment has been stopped.The combined proof command exited 1 because an additional default-manager SDK probe attempted an internal module path absent from the compiled artifact. That constructor is not exported by the supported compiled SDK barrel; no SDK construction or provider turn ran. The completed Gateway phases are qualified separately, and source-level ignored-context preparation coverage remains separate evidence.
Initial CI found three missing brace pairs in the new tests. Commit
685ae5004823446963b1bc99152d5174da7c2063fixes only those test blocks; targeted lint and independent review passed. All production files remain identical to the compiled proof. Exact-head CI passed; native preparation verified its hosted gates on685ae5004823446963b1bc99152d5174da7c2063. Synthetic accessor/preparation measurements do not establish production end-to-end latency.