Skip to content

fix: sandbox preparation scans twice after creating workspace layout - #195787

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-known-layout-checkpoint-2324
Nov 9, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-known-layout-checkpoint-2324

Conversation

@steipete

@steipete steipete commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an unnecessary workspace scan during first sandbox preparation after the sandbox owner creates protected layout directories.

User Impact

Preparation skips the unchanged-workspace probe when its caller already knows the layout changed. The required checkpoint still captures the workspace under existing quiescence, authority and rejection checks. No configuration or database migration is needed.

Why This Change Was Made

The layout producer already reports whether it created directories, but the checkpoint owner discarded that fact and probed before performing the required capture. Forwarding the known mutation removes that redundant probe. Normal-probe callers and capture-required callers cannot coalesce into the same pending operation.

Production growth is 14 net lines for the internal option, forwarding and coalescing identity. The existing custody type moves to the existing types module to meet the file cap. No cache, schema, public configuration or concurrency policy is added. Related: #195713 and #195773. The actual layout capture required by #185777 is preserved.

Evidence

  • Three real-layout cases fail on exact main parent df13b6b8994cefe16f311f29f0301bba511ec617: the real sandbox producer probes before required capture. Candidate performs only capture, including clean, authored and real-workspace cases. Mixed checkpoint modes, normal probe-only calls, quiescence, authority revocation and rejected results remain covered.
  • Full focused runs: 143 passed/four skipped. Final changed cases: seven passed. Core/test types, format, scoped lint, all three dead-export scans, caps and exact 35-line test allocation pass. Independent Codex review is clean through P2.
  • Combined real Gateway five-pair measurements on native Podman/btrfs: 100 baseline canonical-probe records versus zero candidate records; median per-session workspaceLayout 10.304 → 6.864 s. Combined median run maximum 39.467 → 35.458 s, successor CPU 128.453 → 115.092 s; A/A maximum spread 0.201 s. Measurements include the template fix and common restart recovery, not an isolated claim for this PR alone.
  • Full 35.195 GiB APFS runs also remove every redundant probe and ready all 20 sessions. Their paired elapsed/CPU changes overlap 16.2% A/A variability, so no robust APFS speedup is claimed. The separately retained 62k-files/1.1-GB-per-session stress interpretation still times out at 180 seconds; this narrow probe fix does not resolve the remaining full scans/recovery stalls.

Exact-head CI 42576433452 passes on 0f0541e7423669d7e91f7fa3a0847ea43ebb7c46. Task-worktree dependency-link omissions were repaired without version changes and their failed checks rerun. pnpm check:changed still reports 20 historical forbidden changelog credits, reproduced on exact parent and introduced by 266a7aa0fe69 (#194364); this is not an overall-green local check.

No production data, production access, deployment or merge was involved.

Carry the protected mount directory producer result to the checkpoint owner. Preserve the quiesced full capture and ordinary unchanged fast path, with distinct in-flight keys for known mutations.

The real managed-layout regression fails on the parent with probe plus scan and passes with one scan. Full owner/consumer proof passed 143 tests; focused final proof passed 7. The 35-line allocation covers this regression and observer in the existing test support module.
@clawsweeper

clawsweeper Bot commented Nov 9, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T07:01:30.168893Z 0f0541e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: S labels Nov 9, 2026
@steipete steipete changed the title fix: sandbox preparation scans unchanged layout twice fix: sandbox preparation scans twice after creating workspace layout Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 0f0541e7423669d7e91f7fa3a0847ea43ebb7c46
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox/context.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/local-workspace.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@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 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR skips the unchanged-workspace probe after sandbox preparation creates protected layout directories.

Example: First preparation creates skills and .agents/skills in a managed sandbox workspace.

  • Before: Checkpointing probes the workspace and then performs the required capture.
  • After: Checkpointing proceeds directly to the required capture.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, coherent optimization with meaningful owner-boundary coverage and successful exact-head CI; directly inspectable runtime performance evidence is limited.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate does not apply to this maintainer-authored PR; inspected integration coverage exercises real layout and store owners with synthetic container transport, while the reported combined native run does not establish a controlled speedup.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: First managed sandbox preparation performs avoidable filesystem observation after creating protected layout directories.
Reason: The maintainer-authored direction removes identifiable waste without changing settings, permissions, storage formats, or required settlement behavior.

Regression provenance

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

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR removes redundant workspace observation through the existing checkpoint owner, with no introduced correctness or security defect found.

Priority: P2
Reviewed head: 0f0541e7423669d7e91f7fa3a0847ea43ebb7c46

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No inspectable current-head Gateway trace directly counts the removed probe; the exact-parent failures and combined native qualification are reported rather than independently replayed.
Agent review details

How this fits together

Sandbox layout preparation supplies a known-mutation fact to the managed workspace checkpoint owner, which holds reconciliation custody and publishes captured changes to the canonical workspace.

flowchart TD
A[Prepare managed workspace] --> B[Create protected directories]
B --> C[Report known mutation]
C --> D[Acquire checkpoint custody]
D --> E[Quiesce and capture]
E --> F[Publish canonical workspace]
Loading

Technical review

Best possible solution:

Carry the producer’s mutation fact into the existing checkpoint owner while preserving full capture, ordinary probes, and separate pending-operation identities.

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

Source shows generated layout reaching an unconditional probe before capture, and the PR reports the existing real-layout cases failing on the exact parent; this read-only review ran no target code.

Is this the best way to solve the issue?

The smallest complete repair forwards the existing producer fact through existing owners, preserves the earlier admission fix, and prevents callers with different capture requirements from sharing a pending result.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Generated-layout checkpoint keeps the original intent (9e579cd: Settle generated protected directories before pristine-workspace admission so they are not mistaken for authored work.)
  • Unchanged checkpoint probe keeps the original intent (df73fef: Avoid pausing unchanged command checkpoints while retaining quiesced capture for changed workspaces.)
  • Queued checkpoint sharing keeps the original intent (0f074a2: Share equivalent waiting captures while preserving each caller’s authority and closing sharing before filesystem observation.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 23dc268 adds src/gateway/worker-environments/local-workspace-projection.ts:41 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 23dc2686a2fd; files: src/gateway/worker-environments/local-workspace-projection.ts)
  • Shakker: Raw commit 9e579cd adds src/agents/sandbox/context.ts:174 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9e579cde6fce; files: src/agents/sandbox/context.ts)

PR surface

Source +14, Tests +35, Other +3. Total +52 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 31 17 +14
Tests 3 39 4 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 0 +3
Total 8 73 21 +52

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test changes Production +31/-17; tests and test support +39/-4 The runtime growth carries the mutation fact and distinguishes pending requests; regression growth extends existing owner-boundary cases with pass-through observation.

Labels

Label changes:

  • add P2: Redundant filesystem observation increases managed sandbox preparation work, with limited scope and no demonstrated loss of data or availability.
  • 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: Redundant filesystem observation increases managed sandbox preparation work, with limited scope and no demonstrated loss of data or availability.
  • 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.

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 9, 2026, 2:29 AM ET / 07:29 UTC.

@steipete
steipete merged commit 3c96164 into main Nov 9, 2026
171 of 174 checks passed
@steipete
steipete deleted the steipete/fix-known-layout-checkpoint-2324 branch November 9, 2026 08:21
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…#195787)

Carry the protected mount directory producer result to the checkpoint owner. Preserve the quiesced full capture and ordinary unchanged fast path, with distinct in-flight keys for known mutations.

The real managed-layout regression fails on the parent with probe plus scan and passes with one scan. Full owner/consumer proof passed 143 tests; focused final proof passed 7. The 35-line allocation covers this regression and observer in the existing test support module.
RomneyDa added a commit that referenced this pull request Nov 17, 2026
Allow initial guest PR preparation from the recorded project's published
history while preserving unpublished work and original PR identity.

(cherry picked from commit 2757947)

Stable adaptation: preserve the existing linked-identity fixture; expand
its options type and allocate exactly 89 regression LF instead of 84.
Production and documentation patches are unchanged from the source.

Companions: #188785 is present-equivalent. Later #188784, #190223,
#190576, #190542, #195413, #197229, #197243, #199717, #195787,
#197510, #193664, #199851, #199864, #197656, #198851, #193873,
#197594, #189006, #188904, #194025, #196200, #192283, #189010,
#188816 and e0466ff are not prerequisites to this scoped repair;
retain their separate intake dispositions. No later PR-number mentions.

Proof: baseline 4 failed/20 passed through registered agent action;
fixed 41/41 across preparation, refresh and base-action suites.
Type-aware lint4, formatting5, docs MDX1419 and diff check pass.
No live GitHub or full release qualification claim.

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

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: S 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