Repository navigation
fix(sessions): stop re-reading the Goal session node after certification - #149765
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. |
Reuse the authoritative entry inside write admission and remove inert identity snapshots. Preserve canonical stored-row certification, receipt atomicity, and session identity. Co-authored-by: Vincent Koc <[email protected]>
f277580 to
c30b768
Compare
|
@clawsweeper re-review Please review current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 2:15 AM ET / 06:15 UTC (Revision 2). ClawSweeper reviewWhat this changesGoal management reuses the session entry already read inside its transaction, removes redundant identity snapshots and publication, and extends tests for preserved identity and completed validation. Merge readiness✅ Ready for maintainer review Keep open: the simplification remains useful on fetched main, and the pinned patch has no actionable correctness findings. The earlier read-budget repair does not remove the remaining identity snapshots, and no merged replacement supersedes this work. Priority: P2 Review scores
Verification
How this fits togetherGoals are durable objectives attached to OpenClaw sessions. Gateway management requests update Goal state and retry receipts through the session store, then notify clients of the committed change. flowchart TD
A[Goal management request] --> B[Current authorization and writer admission]
B --> C[Read exact session and check generation]
C --> D[Replay existing receipt or update Goal]
D --> E[Shared writer certifies stored metadata]
E --> F[Commit Goal and receipt together]
F --> G[Invalidate cache and notify clients]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -21, Tests +8. Total -13 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep Goal-only mutations in the existing transaction owner, using its fresh entry while retaining stored-row certification, atomic receipts, and independent cache and Gateway notifications. Do we have a high-confidence way to reproduce the issue? Not applicable as a remaining functional failure: the earlier merged repair restored the read budget. Current source still demonstrates redundant identity reads; no runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes. Removing an inert identity comparison from the existing Goal owner is narrower than manufacturing replacement snapshots, and the actual certification and notification owners remain intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3257cbbf4a2f. 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.
|
…ion (openclaw#149765) Reuse the authoritative entry inside write admission and remove inert identity snapshots. Preserve canonical stored-row certification, receipt atomicity, and session identity. Co-authored-by: Vincent Koc <[email protected]>
The only failing shard runs goals-operations, which main has since repaired via openclaw#149765; re-trigger to pick up the fixed base. Co-Authored-By: Claude <[email protected]>
Refs #149537 #149722 #149740
What Problem This Solves
Goal management still rereads and decodes the session after the canonical writer has certified its stored metadata, although these operations cannot change session identity.
User Impact
Editing, pausing, blocking, completing, and clearing a Goal avoid two full session reads and repeated decoding of saved prompt data. Goal results, receipts, session identity, lifecycle, and Gateway change notifications retain their behavior. No schema, migration, configuration, dependency, or update behavior changes.
Why This Change Was Made
The Goal operation owner already reads the authoritative entry after write admission and the current-authority check. Pass that entry to the canonical writer and remove both identity snapshots and their inert publication: these management operations preserve the exact session key and generation. The shared writer continues to certify stored metadata and publish cache invalidation; Goal state and its receipt still commit atomically.
Historical attribution identifies #149388 (
bc28af41e10) as the change that added the certification SELECT. That read validates the bytes SQLite actually stored and must remain. #149722 correctly removes the post-write identity reread but leaves the pre-write snapshot; #149740 independently removes both. This maintainer-directed repair completes that same simplification, with credit to Vincent Koc for the approach in #149722.Current main incorporates #149697 (
08584b3d34c), which restored the three-read budget by reusing the admitted entry in the previous-identity snapshot. This PR retains that reuse directly at the writer and removes the remaining post-write reread and inert identity machinery. The final two changed files are byte-identical to the reviewed pre-rebase candidate.Evidence
c698cf3dee3and merge3af348c27a0each passed all 12 Goal operation tests. Current main atdb1d5d2dccbc9acaffc6232401dcd4f77855d51areproduced exactly one failure:expected 4 to be less than or equal to 3.node scripts/run-vitest.mjs src/config/sessions/, finished with 170 passing files and 2 failing files: 2,280 tests passed and 3 failed. The unrelated failures are recorded below and are outside this repair.c30b768d4ed858016b75a05dbf4fa767141a3c8e, all 22 tests across Goal operations, SQLite identity, and canonical validation passed. Fresh independent Codex branch review was scoped-clean through P1.node scripts/check-changed.mjs, formatting, andgit diff --checkpassed.GREENin its supported CI-run mode; the separate cancelled label job is not a required main check.SELECT * FROM session_nodes WHERE session_key = ?;mutateSessionGoal → readSessionEntryRow → readSessionEntryRowScanmutateSessionGoal → readSessionIdentitySnapshot → readExactSessionEntryRowbefore writewriteSessionEntry → certifyCanonicalSessionValidationRowsmutateSessionGoal → readSessionIdentitySnapshot → readExactSessionEntryRowafter writeUnrelated neighboring-suite failures (preserved, not retried or weakened):
session-accessor.sqlite-reclamation-memory.test.ts: “settles borrowed cache cleanup and guarded deletion without blocking the authorizer” —memory plugin unavailable.session-transcript-reconcile.lifecycle.test.ts: “retains the active reconcile handle under cache pressure (explicit close: true)” — 30-second test timeout.database is not open.