Skip to content

fix: invalid Rewind requests interrupt retained sandbox sessions - #190219

Merged
roboclaw-bot merged 2 commits into
mainfrom
openclaw/rewind-sandbox-review-followup
Nov 1, 2026
Merged

roboclaw-bot merged 2 commits into
mainfrom
openclaw/rewind-sandbox-review-followup

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #190181

What Problem This Solves

Fixes: an invalid Rewind or branch-switch selection can retire a usable managed sandbox, and a real workspace conflict hides its recovery instruction behind an ineffective retry message.

User Impact

Invalid selections leave the retained runtime and workspace edits untouched. Workspace conflicts explicitly ask users to resolve the conflict before retrying, without exposing internal paths or error text. No schema, configuration, permission, or migration changes.

Why This Change Was Made

The worker, native, and memory adapters preflight through the planner's shared semantic selection before workspace retirement. The final transaction still validates the selection and ownership; preflight is not a reservation. It creates no transcript plan, UUID, or editor payload. A fixed typed workspace-conflict error carries only safe recovery guidance through the handler.

The handoff proof now follows an actual handler-generated persisted receipt through owner resolution and the workspace writer, including refusal at the adoption COMMIT boundary and replay after reopening SQLite. Existing pending-reset and next-cut recovery remain covered.

Evidence

  • Red on base a3751eaf96: a missing-message Rewind issued runtime removal before rejection; a genuine canonical/private conflict returned the generic retry instead of the resolution instruction.
  • 116 tests passed across 9 files: 10 managed-workspace cut cases, 4 persisted-handoff/replay cases, 87 handler/storage/memory/native siblings, and 15 direct planner/accounting consumer cases. SQLite, Git, handlers, receipts, and owner decisions are real; container-engine I/O is fixture-backed. The landing owner independently reran the 14 critical cases at the published byte-identical tree; all passed.
  • Focused TypeScript check, typed lint on all 9 touched source/test files, formatting, whitespace checks, and the staged test-line ratchet passed.
  • Fresh independent autoreview, P0–P2, against a3751eaf96 and the complete candidate: scoped-clean, no actionable findings. The reviewer assessed the diff and complete owning-source context; it did not independently execute tests. Hosted ClawSweeper review also completed at 10fe706 with no findings or before-merge blockers.
  • Exact-head broad CI and security gates passed at 10fe706; the native watcher reported GREEN. Changed test-file wall times: 89 s for runtime/rejection coverage and 41 s for persisted handoff coverage, including compiler startup. CI test-time sums: 14.457 s for the 10 runtime/rejection cases and 15.524 s for the 4 persisted-handoff cases. These integration tests traverse real Git and both SQLite owners; selector mocks cannot prove runtime preservation or adoption rollback.
  • pr-simplify: shared the managed-workspace fixture and consolidated foreign-receipt cases around one persisted cut instead of repeating full setup/adoption. Net production growth is 90 lines; 382 net regression-test lines are allocated specifically for these production-boundary regressions, with the shared scalar unchanged.

Known proof limitation: live-model proof remains unavailable because the existing source-attribution CLI preflight forbids operator agent messages from agent exec. The marker was not removed, and no alternate injection route, live Gateway/session mutation, or deployment was used.

Requested and co-authored by @shakkernerd.

Work sessions

Worked on by

roboclaw-bot and others added 2 commits November 1, 2026 09:56
Validate history selection before workspace retirement and preserve safe conflict recovery guidance. Prove persisted handoff authority and replay at adoption commit.

Co-authored-by: shakkernerd <[email protected]>
Worked on by:
- @shakkernerd

Co-authored-by: shakkernerd <[email protected]>
OpenClaw-Publication: 017d6ff3-1856-4efb-bac0-28427ebfec87
@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: L labels Nov 1, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 1, 2026 09:58
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR validates Rewind and branch selections before retiring retained sandboxes and preserves actionable workspace-conflict errors.

Example: A retained sandbox receives sessions.rewind with entryId "missing".

  • Before: The runtime can be removed before the request returns a missing-message error.
  • After: The request returns the error before workspace settlement or runtime retirement.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, coherent repair with meaningful production-owner regressions; confidence remains bounded by harness-only execution evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored follow-up is outside the ordinary contributor proof gate and adds no authority-bearing transfer; supplied evidence exercises real handlers, Git, SQLite, and adoption owners in-process, with container I/O fixture-backed and live-model proof explicitly unclaimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An invalid history selection can interrupt a usable sandbox, while a real workspace conflict returns a retry instruction that cannot resolve it.
Reason: The maintainer-authored direction restores documented no-op behavior and makes an existing recovery instruction visible without adding configuration or changing permissions.

Regression provenance

Regression provenance — suspected predecessor, not a causality claim: source commit 40a6c07e39d0 by Peter Steinberger; no PR verified.

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes two concrete current-main defects, and no actionable introduced bug was found.

Priority: P2
Reviewed head: 10fe706add6ef03c6edb15e0b92a375c841a9069

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied shipped-Gateway run demonstrates invalid-selection rejection with a real retained container followed by successful continuation.
Agent review details

How this fits together

Gateway history handlers delegate to durable, native, or memory session storage; the shared planner selects history, while the workspace owner settles edits and retires runtimes before a valid cut commits.

flowchart TD
A[Rewind or branch switch] --> B[Storage adapter]
B --> C[Shared semantic selection]
C --> D[Reject invalid selection]
C --> E[Settle workspace and retire runtime]
E --> F[Revalidate and commit history cut]
F --> G[Return result and publish change]
Loading

Technical review

Best possible solution:

Use the existing planner’s selection logic before retirement in every storage adapter, retain transaction-time validation, and disclose only the fixed conflict-recovery instruction.

Do we have a high-confidence way to reproduce the issue?

Current-main source exposes both failure paths, and the author reports matching base-red regressions; this read-only review executed no target code.

Is this the best way to solve the issue?

The patch fixes ordering at the existing storage boundary, shares selection with the final planner, and preserves the established conflict message without introducing another state owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 33e7baf17cb1.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 40a6c07 adds src/config/sessions/session-message-cut.ts:90 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 40a6c07e39d0; files: src/config/sessions/session-message-cut.ts)
  • Shakker: Raw commit 23173ed adds src/gateway/worker-environments/local-workspace-state.ts:295 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 23173ed1f61b; files: src/gateway/worker-environments/local-workspace-state.ts)
  • RoboClaw: Raw commit a3751ea adds src/config/sessions/session-message-cut-plan.ts:147 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a3751eaf96af; files: src/config/sessions/session-message-cut-plan.ts)

PR surface

Source +90, Tests +382, Other +2. Total +474 across 10 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 6 119 29 +90
Tests 3 559 177 +382
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 10 680 206 +474

Review metrics

Metric Value Why it matters
Production versus regression growth Production +119/-29 lines; tests and shared fixture +559/-177 lines. The net growth reuses the existing selection owner and adds distinct adapter, rejection, persisted-receipt, and commit-authority coverage.

Labels

Label changes:

  • add P2: Invalid history selections can unnecessarily destroy a retained runtime, and genuine workspace conflicts otherwise lead to ineffective retries.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Invalid history selections can unnecessarily destroy a retained runtime, and genuine workspace conflicts otherwise lead to ineffective retries.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted Gateway trace showing an invalid selection leaves a real retained sandbox usable for the next turn.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 1, 2026, 5:16 AM ET / 10:16 UTC.

@roboclaw-bot
roboclaw-bot merged commit f833631 into main Nov 1, 2026
276 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/rewind-sandbox-review-followup branch November 1, 2026 10:26
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
…nclaw#190219)

* fix: preserve retained sandboxes for invalid history cuts

Validate history selection before workspace retirement and preserve safe conflict recovery guidance. Prove persisted handoff authority and replay at adoption commit.

Co-authored-by: shakkernerd <[email protected]>

* fix: invalid Rewind requests interrupt retained sandbox sessions

Worked on by:
- @shakkernerd

Co-authored-by: shakkernerd <[email protected]>
OpenClaw-Publication: 017d6ff3-1856-4efb-bac0-28427ebfec87

---------

Co-authored-by: shakkernerd <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant