Skip to content

fix(sandbox): keep guests running during GitHub source fetches - #197243

Merged
steipete merged 3 commits into
mainfrom
steipete/perf-micro-reconcile-pause-spans-host-operation-20260919
Nov 11, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/perf-micro-reconcile-pause-spans-host-operation-20260919

Conversation

@steipete

@steipete steipete commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes long sandbox freezes while GitHub PR preparation or base refresh downloads repository history and missing objects.

User Impact

The guest keeps running during Git history and object downloads. Working-file application and pending-transfer recovery retain their consistency pauses. This change does not impose a universal maximum pause duration; large consistency work can still pause the guest. The maintainer explicitly deferred a fixed freeze cap to preserve correctness: finishing or undoing partially applied transfers must retain the existing recovery contract. Remaining consistency-pause attribution and optimization are follow-up work.

Why This Change Was Made

Source integration previously downloaded history, hydrated missing blobs, and prepared merge ancestors inside the frozen workspace callback. Prepare those immutable Git objects with the guest resumed while retaining host custody. After remote verification, observe the guest's current Git state and verify the host HEAD, merge state, and recorded base across the custody gap before applying changes. Guest edits remain preserved or produce the existing actionable conflict.

The generic exec/Git shim does not itself acquire this pause. This fix targets the registered prepare_pr and refresh_base integration owner. It removes the fetch-under-pause path without changing schema, configuration, caches, or transfer recovery. Production code grows by 77 lines for the second custody phase and its identity checks; the preparation sibling keeps the existing file-size limit. Regression tests grow by 69 allocated lines; existing acquisition coverage is moved, not duplicated.

Evidence

  • Cold empty/existing-source regressions fail on parent 840105308d2964b937e42b34e44728c392408f61 because fetch observes a paused guest, and pass with the fix. The final four acquisition cases also preserve guest index-only edits during download and remote verification.
  • Focused owner suites after integrating fix: stop repeated cold fork fetches from empty workspaces #197229: 45/45 tests in three files (317.44 s Vitest / 324.10 s wrapper). Targeted typecheck, core/script lint, formatting, diff checks, and test-line ratchet pass.
  • pnpm check:changed completed. Its remaining unused-export failures reproduce as identical symbol sets on the original parent and integrated main parent d9094aba06050bc3fc036392616239cd625b4237: 57 production, 33 full-tree, and 1 script. Introducing commits/PRs are recorded below; these are main regressions, not ignored failures.
  • Independent Codex autoreview of the complete local candidate against d9094aba06050bc3fc036392616239cd625b4237 after conflict resolution, through P2: scoped-clean, no actionable findings. Source inputs were verified unchanged by the review helper.
  • Native Docker proof exercises the registered action with 62,000 existing files / 1.1 GB and a real fetch adding about 524 MiB of historical objects. Two completed pairs reduced total freeze from 116.536→55.371 s and 122.232→54.592 s. Every baseline fetch began/ended paused; both candidate fetches began/ended live. Final contents, HEAD and index checks passed. Candidate maximum heartbeat gaps remain 44.451–44.842 s.
  • A/A controls: owner 157.327/128.646 s; total frozen 136.162/114.989 s; process CPU 91.052/80.637 s. Paired owner timings: 135.594→132.227 s and 148.483→123.017 s; process CPU: 78.272→76.874 s and 88.488→75.423 s. The A/A spread does not support a small throughput/CPU improvement claim.
  • The predeclared campaign is incomplete. A3 completed as a retained contention outlier (268.070 s owner / 232.110 s frozen); B3 failed untimed fixture setup before the owner ran or a native guest existed. No slow/failed sample was replaced. The remaining pairs and separate allocation profiles have not run. The maintainer explicitly accepted the two completed pairs and passing consistency checks as sufficient evidence to land this focused fix; the incomplete campaign and allocation measurements remain disclosed.
  • Exact-head PR CI is green for d16e7e9a6b474f5225b08c4524e3c130bec61ba7: run 43044512158. The only change from measured source 28458d9f26cfb6198c7a84136336f6adfad48df8 is a nonexecuted benchmark header sentence; production and generated fixture code are unchanged. Its scoped independent Codex review is also clean.

Measurement limitations: this is a macOS APFS bind mount with a real Docker/OrbStack guest, not btrfs or a large-database qualification. Process CPU excludes spawned Git child CPU; planned inspector allocation profiles cover only the main JS isolate, not worker/native allocations. The benchmark permits 180 s fixture subprocesses; production's 60 s command timeout is unchanged, so >60 s completed fetches prove pause placement/content correctness, not production timeout policy. Controls/pairs ran at host load 5–10 on 32 CPUs; A3 rose to 25 and post-failure load reached 53. Concurrent source-review reads overlapped A3 and are recorded as possible interference, without attributing causality. No live deployment was run.

pnpm build:ci-artifacts passes locally in 5m 31s with nonfatal CSS/chat-boot budget warnings from unchanged UI inputs. The initial manual CI dispatch failed preflight because its selected validation tier required a different workflow/target relationship; it is not build proof and was not rerun.

Exact-parent unused-export attribution
Owners/findings Introducing commit PR
Knowledge contract/tool-results/rowDate 9b7dcdc #196767
Telegram widget exports b22f35f #196991
Summary-heading helper c7152f3 #196207
Model/config/tool/session/oom-score exports 625945b #192552
MCP tool-directory bounds/description 80ba593 #196252
Lease diagnostic projection 2c4e34a #196724
Web-tunnel binding/message types 5f2f21a #196388
createKeyFile 37a3b16 #196380
Billing-route warning helper 56617cd #191326
Provider runtime/external-auth exports f63e5cd #190205
Provider-auth facade types cf1ae7b #190544
ACCEPTED_REFRESH_STATUSES 6a5ac74 #197189

Prepare immutable history and object contents with the guest resumed under existing host custody, then observe guest Git state and verify the host integration identity before applying source changes.

Regression proof covers cold source imports and guest index edits during downloads and source verification. Allocate 82 net test lines for these distinct failures; existing acquisition coverage is moved, not duplicated. Consistency capture and transfer recovery retain their existing pause contract.
@clawsweeper

clawsweeper Bot commented Nov 11, 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: XL labels Nov 11, 2026
Preserve both acquisition suites from main and the pause regression, sharing their fixture setup. The resulting change allocates 69 net test lines. Focused suites pass 45 tests; the CI artifact build and fresh independent review pass against integrated main d9094ab.
@steipete
steipete marked this pull request as ready for review November 11, 2026 14:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 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-11T14:33:24.291935Z 28458d9 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.

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

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR downloads GitHub source objects with the guest running, then checks workspace identity before applying files under a consistency pause.

Example: Prepare a fork PR in a workspace containing 62,000 files.

  • Before: The guest stayed paused during history downloads; one native run recorded 116.536 seconds frozen.
  • After: The fetch began and ended with the guest running; the paired run recorded 55.371 seconds frozen with content and index checks passing.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused repair with native production-owner evidence, meaningful regressions, green exact-head CI and no remaining findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Supplied native Docker results exercise the registered action, real Git acquisition and workspace owners: candidate fetches begin and end with the guest running, and final contents, HEAD and index checks pass; only a benchmark comment changed afterward, and the maintainer accepted the disclosed incomplete measurement campaign.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Sandbox guests stop running while GitHub preparation downloads repository history and missing objects.
Reason: The focused repair has demonstrated user value, and the maintainer explicitly accepted its evidence and deferred a universal freeze cap.

Merge readiness

✅ Ready for maintainer review

This PR is ready for landing consideration: no actionable findings remain, exact-head CI passes, and the maintainer explicitly lifted the earlier hold.

Priority: P2
Reviewed head: d16e7e9a6b474f5225b08c4524e3c130bec61ba7

Before merge

None.

Findings

None.

Agent review details

How this fits together

The GitHub publication integration owner receives verified PR or repository-base identities, acquires immutable Git objects through host transport, and applies source changes to the canonical checkout and sandbox projection through existing reconciliation owners.

flowchart TD
  A[Verified GitHub source] --> B[Settle pending transfers]
  B --> C[Resume guest and fetch objects]
  C --> D[Verify source and observe guest Git state]
  D --> E[Reacquire custody and check identity]
  E --> F[Apply source under consistency pause]
  F --> G[Prepare review base and resume guest]
Loading

Technical review

Best possible solution:

Land the focused separation of immutable source acquisition from paused file integration while preserving existing recovery and conflict handling.

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

Current-main source places Git acquisition inside the paused integration callback, and supplied native baseline runs record paused fetches; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The change fixes pause ownership at the shared integration boundary, removes the replaced fetch-under-pause implementation, and preserves consistency checks without adding configuration or a competing state owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Source acquisition and integration keeps the original intent (23173ed: Base refresh preserves guest work and merge ancestry while keeping credentials and transfer authority on the host; later PR preparation and partial-clone repairs extended this owner.)
  • Pause placement around immutable preparation changes intended behavior with a stated reason (fix: shorten long sandbox freezes during workspace reconciliation #196835: Ordinary reconciliation moved immutable preparation outside pauses while retaining journal recovery and two-sided base-refresh consistency requirements.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Earlier hold explicitly resolved: The latest maintainer request supersedes the earlier hold, accepts the two completed native pairs and consistency checks, and defers a universal freeze cap to preserve partial-transfer recovery. (d16e7e9a6b47)
  • Fetches leave the consistency pause: Preparation settles pending transfers and resumes the guest before acquiring history, current contents, and merge-ancestor objects under existing host custody. (src/gateway/github-publication-source-preparation.ts:50, d16e7e9a6b47)
  • Integration identity remains checked: Before applying source, integration checks host HEAD, recorded base and pending merge identity; source verification precedes the updated guest Git observation. (src/gateway/github-publication-base-refresh.ts:196, d16e7e9a6b47)
  • Focused regression coverage: Cold empty and existing-source cases check that fetches occur with a running guest; separate download and verification injections preserve index-only guest work and reject initial import without applying PR files. (src/gateway/github-pr-workspace-acquisition.test.ts:23, d16e7e9a6b47)
  • Native behavior evidence: The full PR body records real Docker guest and Git-fetch measurements through the registered action, two completed baseline/candidate pairs, passing contents/HEAD/index checks, and explicit limits on timeout, filesystem and allocation claims. (scripts/perf/github-publication-pause-measure.ts:1, d16e7e9a6b47)
  • Exact-head CI and source equivalence: Run 43044512158 completed successfully on the reviewed head; comparison with the measured revision changes only a nonexecuted benchmark header sentence. (scripts/perf/github-publication-pause-measure.ts:25, d16e7e9a6b47)

Likely related people:

  • Shakker: Raw commit 9218dca adds src/gateway/github-publication-base-refresh.ts:249 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9218dca35cbf; files: src/gateway/github-publication-base-refresh.ts)
  • Peter Steinberger: Raw commit baf76f9 adds src/gateway/github-publication-base-refresh.ts:322 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: baf76f91ca2a; files: src/gateway/github-publication-base-refresh.ts)

PR surface

Source +77, Tests +69, Docs +8, Other +425. Total +579 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 259 182 +77
Tests 2 131 62 +69
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 2 425 0 +425
Total 7 823 244 +579

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 regression growth Production +77 net lines; tests +69 net lines. Growth supports a separate preparation phase, custody-gap identity checks, and distinct guest-index regressions; existing cold-acquisition coverage is moved.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on maintainer: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Reduces disruptive sandbox freezes during GitHub source acquisition without changing publication capabilities or recovery contracts.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-11T14:46:31.653Z sha 28458d9 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-11T15:30:56.398Z sha d16e7e9 :: blocked before merge. :: none

Reviewed November 11, 2026, 10:41 AM ET / 15:41 UTC (Revision 3).

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review final head d16e7e9. Your previous review of 28458d9 reported no findings or open checklist items. The only subsequent code change replaces a nonexecuted benchmark-header sentence; independent scoped review is clean and final-head CI is green.

The body now records the completed native pairs and the interrupted measurement campaign accurately. The guest runs throughout both candidate fetches, while final contents, HEAD and index remain verified. Remaining measurement/allocation proof and the universal fixed-cap requirement are explicitly unresolved; the PR is held, with no claim that those requirements are satisfied.

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 11, 2026
@clawsweeper clawsweeper Bot removed the clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. label Nov 11, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

  1. Await maintainer action — resolved. The maintainer has now explicitly directed landing this focused fix after final-head review has zero open items. This supersedes and lifts the hold in my earlier comment fix(sandbox): keep guests running during GitHub source fetches #197243 (comment). The PR body already records the current decision; the older comment is historical, not an operative hold.

The maintainer accepts the two completed native pairs (116.536→55.371 s and 122.232→54.592 s frozen time) with passing consistency checks as sufficient evidence for this fix. The incomplete timing/allocation campaign remains disclosed. A fixed total-freeze cap is explicitly deferred: preserve the existing partial-transfer recovery contract rather than risk correctness to meet a deadline. Attribution and reduction of the remaining consistency pause are follow-up work.

The reviewed head remains d16e7e9. No code change is needed for this decision: source preparation resumes the guest at src/gateway/github-publication-source-preparation.ts:50, and integration preserves the identity checks at src/gateway/github-publication-base-refresh.ts:196. Your final-head review reported no actionable code findings; exact-head CI is green. Please re-review with the maintainer hold lifted.

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. labels Nov 11, 2026
@steipete
steipete merged commit 3a6cc65 into main Nov 11, 2026
167 checks passed
@steipete
steipete deleted the steipete/perf-micro-reconcile-pause-spans-host-operation-20260919 branch November 11, 2026 15:45
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor Author

Follow-up measurement rule for the remaining consistency pause:

Use the same synthetic registered prepare_pr initial-import flow: 62,000 files / 1.1 GB, 512 MiB historical Git objects, a real native Docker guest and verified final files, HEAD and index. Start with one diagnostic run recording existing phase spans, host snapshot calls, immutable before/after checkout and manifest preparation, staging, application and guest review-index work. Nested spans are inclusive; pause overlap is accounted separately. This attribution run is not an A/B improvement claim.

The candidate must move identified immutable preparation out of the guest-frozen interval while preserving current identity/pristine checks, source admission, guest edits/index state, and two-sided transfer recovery. The primary work-count target is zero frozen immutable before/after checkout and staging calls on initial import; no extra full-tree scan or hashing pass should be introduced to achieve it. A fixed freeze cap remains out of scope by the maintainer's decision.

For the resulting production change, compare the same baseline/candidate workload serially with two A/A controls and five counterbalanced pairs where host conditions permit. Record owner wall time, total/maximum frozen duration, guest heartbeat, process/guest CPU, memory and separately sampled allocation, preserving all failures/outliers. Timing/CPU regressions need investigation; incomplete or contended proof will be disclosed rather than presented as a completed campaign. Filesystem and profiler scope remain explicit. No live deployment is part of this proof.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 12, 2026
…law#197243)

* fix(sandbox): keep guests running during GitHub source fetches

Prepare immutable history and object contents with the guest resumed under existing host custody, then observe guest Git state and verify the host integration identity before applying source changes.

Regression proof covers cold source imports and guest index edits during downloads and source verification. Allocate 82 net test lines for these distinct failures; existing acquisition coverage is moved, not duplicated. Consistency capture and transfer recovery retain their existing pause contract.

* docs(perf): describe the pause fixture generically
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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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