Skip to content

fix: shorten sandbox freezes during workspace base refresh - #199717

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-reconcile-pause-scope-20260919
Nov 15, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-reconcile-pause-scope-20260919

Conversation

@steipete

@steipete steipete commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes long freezes of running sandbox tools while base refresh and PR-source integration prepare canonical Git trees and remove temporary files.

User Impact

Existing guest commands can continue through repository merge preparation, temporary checkout creation, and successful post-transfer cleanup. Guest application still pauses its writers and confirms the prepared target before changing files. Conflicting guest writes remain saved and cause a visible conflict or retry error. Interrupted guest mutations retain their recovery pause.

Why This Change Was Made

Ordinary reconciliation already releases the guest during materialization and patch preparation. Base refresh retained an earlier pause across canonical work and kept the final pause through materialized-tree cleanup. Resume at those two existing owner boundaries; retain the existing projection revision, authority checks, journal settlement, and confirming target preflight. Guest writes do not advance a database revision, so the preflight comparison remains the content fence.

Runtime production delta: +4 net lines, including the existing operation-phase marker after resume. No schema, configuration, new cache, or stored-format change. The checkpoint-reference acceptance contract from #199683 remains intact; this is separate from the hashing fix in #199687 and payload work in #199524.

Evidence

Supplied read-only Team r335 / 292a425 aggregates show recurring 66–142 s pauses, including 38–53 s operation, 15–21 s cleanup, and 5–6 s capture. A prior local base-refresh reproduction measured 44.95 s of real repository work. At 16:57Z and 17:22:48Z, two sends queued 161.6 s and 142.7 s respectively (the latter included 134.6 s reply initialization), then drained 10–15 s after a long pause ended. Another 20.8 s queued send drained 13 s after a 66 s pause. This is a reported correlation, not a production causal replay; no Team state was accessed or modified by this change.

Native btrfs/Podman results at c2f2d749, against exact baseline 293518e8: synthetic 62,000 files / 1,100,004,000 bytes and a 37,780,287,488-byte (35.2 GiB) agent database with 10,000 synthetic sessions. Two baseline A/A controls preceded five counterbalanced pairs. Every arm verified canonical Git tree identity and every payload file in both trees.

Median, five pairs Before After Change
Maximum continuous pause 36.31 s 9.22 s −74.6%
Total paused time 46.13 s 14.96 s −67.6%
Native guest heartbeat gap 36.31 s 9.17 s −74.7%
Owner elapsed 53.67 s 54.51 s +1.6%
Process CPU 48.17 s 47.09 s −2.2%
Main-thread CPU 1.674 s 1.684 s +0.6%

Baseline A/A maximum pauses were 34.62/35.00 s and owner times 52.62/53.11 s. Across the five pairs, maximum pauses ranged 35.37–36.43 s before and 7.74–9.47 s after. These are observed samples, not production tail estimates. Materialization, patch preparation, and successful cleanup recorded zero paused time in every candidate arm. Median paused cleanup was 7.74 s before; it runs resumed after the fix. The coarse operation phase still includes the initial pristine snapshot reads. Initial consistent capture and final guest confirmation/application retain their freezes.

The native guest uses real Podman pause/unpause and a 25 ms heartbeat; GitHub responses are synthetic. This cold PR-import workload exercises the base-refresh owner on Team-shaped synthetic state, without Team access or live model calls. Process CPU excludes spawned Git/Podman subprocesses. Separate Node 24.22.1 profiling (two A/A controls and two counterbalanced pairs) measured sampled main-isolate allocation at 1279.16 → 1292.15 MiB (+1.02%). All six profile runs verified outputs. The initial large pinned-Bun baseline allocation control crashed with SIGSEGV; the successful unprofiled Bun timing campaign is unaffected, and no large-fixture Bun allocation result is claimed. Node profiling uses the repository-supported runtime selector, with identical runtime and source harness in both arms. The predeclared timing acceptance passed, including no unexplained >20% regression in a user-facing metric.

The existing registered-action cold-source tests fail on the original head because temporary checkouts run paused, and pass with the fix. A guest write during patch preparation is detected before mutation and remains intact, including on the full 62,000-file/35.2 GiB synthetic fixture. Existing recovery coverage now also writes while canonical-only acceptance is interrupted and verifies preservation through recovery. The full focused run and focused recovery replay cover 132 passing cases with two environment-dependent skips; the old pause expectation was updated only with that additional preservation proof.

Codex P0–P2 autoreview found no actionable defects. Final staged pnpm check:changed passed. Exact-head CI, including openclaw/ci-gate, and artifact build passed. No CI rerun or inherited-red exception was needed. ClawSweeper and hosted Codex reviewed the same head with no actionable findings; ClawSweeper has zero open checkbox items. No changed module is imported by ui/src.

Resume existing guest runtimes during canonical merge, checkout, and patch preparation; resume settled refreshes before temporary payload cleanup. Retain target preflight conflict detection and interrupted guest-write recovery. Add registered-action write-preservation regressions and extend the native owner benchmark with phase and database-shape evidence.
@clawsweeper

clawsweeper Bot commented Nov 15, 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 docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts docker Docker and sandbox tooling size: S labels Nov 15, 2026
@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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lets sandbox commands continue during base-refresh preparation and successful transfer cleanup.

Example: A running sandbox command shares a workspace while prepare_pr integrates newer source files.

  • Before: The command remains frozen during temporary checkout creation, merge preparation, and successful payload cleanup.
  • After: The command runs during preparation and cleanup, with a pause retained for confirming and applying workspace changes.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The runtime repair is narrow and source-consistent, with useful preservation tests, but performance validation remains incomplete and broad exact-head checks have not run.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Running sandbox tools stop making progress while base refresh performs preparation and cleanup that do not require frozen guest writers.
Reason: The maintainer-authored direction extends existing pause optimization with a small runtime change while retaining the consistency boundary.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it is a useful, maintainer-authored draft that narrowly reduces unnecessary sandbox pauses; source review found no actionable introduced defect.

Priority: P2
Reviewed head: c2f2d7494dc5a596f2e441cbf2ff5c1009384d63

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide the declared native baseline/candidate results showing preparation and successful cleanup run unfrozen with preserved contents and acceptable performance; redact IPs, credentials, phone numbers, and non-public endpoints.
Agent review details

How this fits together

GitHub source integration prepares canonical Git results, then the workspace projection owner transfers them into the guest filesystem using existing pause, conflict, acceptance, and recovery operations.

flowchart TD
 A[GitHub source action] --> B[Workspace projection owner]
 B --> C[Canonical preparation with guest running]
 C --> D[Pause and confirm guest target]
 D --> E[Apply and accept transfer]
 E --> F[Resume guest and clean temporary data]
Loading

Technical review

Best possible solution:

Retain the two existing-owner resume boundaries while preserving target confirmation, two-sided acceptance, and interrupted-mutation recovery.

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

Current-main source retains the guest pause across canonical merge preparation and refresh cleanup; the body reports red/green registered-action regressions, but this read-only review executed no target code.

Is this the best way to solve the issue?

The patch uses the existing quiescence and acceptance owners without adding runtime state or parallel policy, and its added tests cover distinct pause-placement, concurrent-write, and recovery failures.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Canonical base-refresh preparation changes intended behavior with a stated reason (23173ed: Base refresh integrates canonical ancestry while preserving guest files and Git history; later source-fetch optimization retained consistency pauses.)
  • Refresh acceptance and cleanup pause changes intended behavior with a stated reason (3bf03a6: Ordinary reconciliation was resumed outside mutation while two-sided refresh retained custody; the condition was carried through subsequent refactoring.)
  • Pause measurement harness keeps the original intent (3a6cc65: Measure source acquisition with real Git and workspace owners plus an optional native guest; the extension adds engine selection and phase attribution.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 23173ed adds src/gateway/github-publication-base-refresh.ts:197 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/github-publication-base-refresh.ts)

PR surface

Source +4, Tests +56, Docs +4, Other +52. Total +116 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 6 2 +4
Tests 2 57 1 +56
Docs 1 6 2 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 60 8 +52
Total 6 129 13 +116

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
Benchmark configuration 1 new benchmark flag: --native-engine Selects Docker or Podman for the existing measurement harness; no product configuration option is introduced.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Long pauses disrupt running sandbox commands during explicit GitHub workspace integration, with a focused repair and limited workflow scope.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • 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 15, 2026, 1:50 PM ET / 18:50 UTC.

@steipete
steipete marked this pull request as ready for review November 15, 2026 18:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 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-15T18:54:55.435823Z c2f2d74 Draft marked ready
ℹ️ 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.

@steipete
steipete merged commit aaee920 into main Nov 15, 2026
253 of 258 checks passed
@steipete
steipete deleted the steipete/perf-micro-reconcile-pause-scope-20260919 branch November 15, 2026 19:49
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 16, 2026
Resume existing guest runtimes during canonical merge, checkout, and patch preparation; resume settled refreshes before temporary payload cleanup. Retain target preflight conflict detection and interrupted guest-write recovery. Add registered-action write-preservation regressions and extend the native owner benchmark with phase and database-shape evidence.
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

docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts 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