Repository navigation
fix(sessions): keep admitted turns attached during retries - #119307
Conversation
Punchcard-Session: coral-workshop-workshop-3f
eb43118 to
84146a5
Compare
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 4:08 PM ET / 20:08 UTC. ClawSweeper reviewWhat this changesThe PR makes retry-time session reconciliation use the transcript recorder’s persisted user message when prompt preparation intentionally has no user-message projection. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. Current main still routes a recorder-confirmed user turn to orphan repair when retry preparation omits its projection; this patch restores the recorder-owned identity without relaxing exact idempotency matching. No blocking correctness finding was found, but this member-authored, maintainer-labeled PR remains for normal maintainer landing review. Priority: P1 Review scores
Verification
How this fits togetherThe embedded agent runner prepares an active session before an attempt reaches the provider. It reconciles the admitted user turn, recorder state, and durable transcript leaf so a retry either retains the canonical turn or repairs a genuinely stale leaf. flowchart LR
A[Admitted user turn] --> B[Transcript recorder]
A --> C[Prompt preparation]
B --> D[Session boundary]
C --> D
E[Durable transcript leaf] --> D
D --> F[Exact idempotency check]
F --> G[Provider attempt]
F --> H[Orphan repair]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +58. Total +61 across 3 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. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the recorder-backed exact-key reconciliation, retain orphan repair for mismatches, and land after the latest ClawSweeper guidance is confirmed addressed. Do we have a high-confidence way to reproduce the issue? Yes—current source defines the retry path: internal prompt preparation omits the projection while the recorder retains the persisted user leaf, and current main then fails the existing identity check. The review was read-only, so no local execution was performed. Is this the best way to solve the issue? Yes—the recorder already owns the authoritative persisted current-turn fact, while the existing exact-key check and mismatch orphan repair remain intact; deriving identity only from the optional prepared projection is the failing alternative. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against aa07d55ec98f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer review completed on exact head I read the latest ClawSweeper comment in full and reviewed the current discussion, repo-native review artifacts, prepared head, exact-head CI, and focused regression coverage. No actionable correctness or security finding remains. The Rank-up move is satisfied: there is no code-changing move for this head. The P1 merge risk is resolved by the patch's owner-boundary invariant: the transcript recorder supplies the authoritative persisted current-turn identity, adoption still requires a non-empty exact idempotency-key match, and mismatches still take orphan repair. The newly landed CLI diagnostics PR does not touch this session boundary. Both ClawSweeper |
|
Merged via squash.
|
Punchcard-Session: crisp-lantern-orchard-nv * origin/main: fix(release): accept legacy empty core artifacts (#119337) fix(qa): carry selected runtime into flow scenarios (#119324) fix(ci): retry interrupted Windows dashboard release checks (#119095) fix(release): filter validation ancestry fetch (#119334) fix(release): accept trusted extended-stable validation evidence (#119264) fix(sessions): preserve recorder-owned user turns (#119307) perf(cli): split plugin registry startup timing (#119318) fix(qa): align release scenario setup and compaction proof (#119188) fix(ci): avoid duplicate Matrix release QA runs (#119171)
…time * origin/main: (75 commits) fix(commands): restore tool inventory for dynamic models (#119306) fix(media): release rejected BytePlus and Runway video downloads under debug capture (#119257) docs: add ChromeOS (Crostini) platform install guide (#107663) test(msteams): serve JWKS from in-process server in auth coverage (#119354) fix(qa): enable OpenAI for stored audio scenario (#119349) test(agents): realpath apply-patch temp dir fixture (#119353) test(slack): drop redundant .js-suffixed system-event mock (#119352) fix(exec): leave safe builtins unrewritten in enforced mode (#119351) fix(sessions): keep gateway responsive while large transcript archives are built (#112424) fix(tui): restore provider auth in installed local mode (#119283) fix(release): accept legacy empty core artifacts (#119337) fix(qa): carry selected runtime into flow scenarios (#119324) fix(ci): retry interrupted Windows dashboard release checks (#119095) fix(release): filter validation ancestry fetch (#119334) fix(release): accept trusted extended-stable validation evidence (#119264) fix(sessions): preserve recorder-owned user turns (#119307) perf(cli): split plugin registry startup timing (#119318) fix(qa): align release scenario setup and compaction proof (#119188) fix(ci): avoid duplicate Matrix release QA runs (#119171) perf(agents): reuse provider policy manifest registry (#119305) ...
Punchcard-Session: coral-workshop-workshop-3f
What Problem This Solves
Fixes an issue where an admitted user turn could be detached from the active
session transcript during an internal retry that intentionally omitted the
prepared user-message projection. A later turn could then fail with
Session transcript parent entry was not persistedinstead of reaching theprovider.
The failure was observed on the exact
mainSHA7a0a4c5f2a3b778deec2eacafbeffc45f24579cf:https://github.com/openclaw/openclaw/actions/runs/30933537375/job/92074656753
Why This Change Was Made
The session boundary now uses the transcript recorder's persisted message as
the authoritative current-turn identity, with the prepared message retained as
the fallback. Reconciliation still requires an exact non-empty idempotency-key
match, so genuinely stale durable leaves continue through orphan repair.
This does not weaken SQLite idempotency or SessionManager parent validation and
does not change config, protocol, schema, or migration surfaces.
User Impact
Persisted user turns remain attached to the canonical transcript across
internal retries, allowing subsequent turns to continue instead of dead-ending
on a detached parent.
The vulnerable source path is present in
v2026.7.2-beta.6andv2026.7.2-beta.7; stablev2026.7.1-1andv2026.7.1-2do not contain it.Evidence
the recorder and durable leaf hold the same admitted turn. It triggered
orphan repair before the fix and now preserves the leaf.
durable leaf with a different idempotency key.
SessionManager idempotency, and user-turn transcript coverage.
core, coreTestschanged-scope gate passes, including tsgo,oxlint, dead exports, plugin boundaries, import cycles, SQLite/storage
guards, and auth guards.
git diff --checkand targetedoxfmt --checkpass.worktrees may not reconcile
node_modules; that repository safety rule wasnot bypassed. Exact-head PR CI, including
check-sqlite-session-flip-proof, is required before merge.Provenance: #116924 introduced durable
leaf reconciliation while still depending on the prepared projection;
#117310 carried that assumption
forward. #117260 correctly rejects
detached keyed-row adoption and exposed the upstream ownership error.
AI-assisted: yes. The implementation, history, and proof were reviewed by the
maintainer.
Punchcard-Session: coral-workshop-workshop-3f