Skip to content

feat: refresh managed sandbox bases before publication - #174532

Merged
shakkernerd merged 2 commits into
mainfrom
workspace-base-refresh
Oct 16, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
workspace-base-refresh

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A sandboxed project session can save changes and publish a draft PR, but it cannot update its existing private workspace from a newer selected repository base. That blocks ordinary conflict resolution when the repository is private and network credentials deliberately remain on the Gateway. Publication fetches the base for its own checks, but importing guest commits would violate the workspace boundary and copying files alone would lose the integrated base ancestry.

User Impact

github_publish gains an explicit refresh_base action for the current session's existing local managed sandbox workspace. It preserves accepted guest files, including ignored data and empty directories, brings in current base changes, and reports conflicting paths. Conflicts remain pending across retries until the caller resolves them and acknowledges the exact returned base commit. Existing ready, merge, and close actions retain full operator write permission.

Completion stages current source inside the sandbox while preserving its HEAD, branches, and commits, and returns an explicit local/base Auto Review target. Run tests and normal Auto Review with that target before publishing to update the same draft. Publication refuses pending integration rather than modifying reviewed files. Ordinary worktree removal is deferred while the integration still needs resolution.

Why This Change Was Made

The Gateway resolves the repository and base from saved workspace ownership and uses its existing authenticated transport. A source-only Git merge computes the result before changing either workspace. The existing pending-result lease and rollback journal apply that result to canonical and private files before advancing their shared baseline; native host Git state retains the selected base and merge ancestry. Refresh also joins publication's existing workspace exclusion.

The selected review base is transferred as a bounded source-only pack through the prepared sandbox's stdin. Git metadata operations stay inside that sandbox, and the temporary host pack is removed. No repository, arbitrary ref, other session, PR, credentials, or runtime can be selected through model arguments; the acknowledgment commit only checks the existing pending integration.

Evidence

The pre-change protocol rejects refresh_base; the existing private-workspace workflow has no supported route to obtain and integrate its newer base. The focused regression uses the existing real Git and publication fixtures, with synthetic GitHub transport. It exercises interruptions before transfer reservation and between workspace copies, intervening guest edits, explicit conflict resolution, preserved guest and upstream files, refusal to publish unresolved work, same-draft publication, retained base ancestry, and the guest's exact review diff.

Remote validation covered the 308 related test files: 4,972 tests passed and two platform cases were skipped, retaining completed groups across a runner interruption. The four-file recovery and admission batch passed 91 tests in 79.68 seconds after reproducing the pre-reservation failure; unchanged related-file proof was retained. Changed-file formatting/lint, the affected production and test compiler graphs, protocol generation, and package-boundary compilation plus its negative canary passed. These are command wall times; overlapping shard times are not added together.

The actual prior result-ref validator rejects the new refresh purpose before reading or applying it. That refusal protects an interrupted transfer. After both workspaces accept, its staged result is cleaned and native merge state owns remaining conflict resolution; the docs require finishing refresh and resolution before downgrade.

Independent engineering review is clean, and PR CI passed on the current head: 95 selected jobs, with an 813-second execution window. The saved-session live flow also passed: the guest refreshed its newer private base, resolved the conflict, passed 30 project tests, ran normal Auto Review with the returned local/base target, and updated the original draft. The upstream files and guest implementation stayed intact. Guest ready, merge, and auto-merge requests remained blocked after admin participation; the admin then merged the exact reviewed tree through the same conversation.

The live runtime uses this PR’s exact 24 changed files on the retained baseline, alongside the landed skill guards. It is source-equivalent proof rather than a whole-head deployment. Its retained fs-safe 0.26.5 atomic-write implementation and all JavaScript/declaration files are identical to 0.26.6 used by PR validation; the documented native delta concerns Btrfs cloning outside this Darwin flow. Existing requester and projection tests cover authority loss during awaited preparation, acceptance, and recovery; the refresh owner carries those current-authority checks through commands, reconciliation, and sandbox execution.

The final automated review found no concrete defect and requested additional authority-combination and tagged-upgrade runs. Independent source and evidence assessment found the existing owner-boundary tests sufficient: the tagged release uses the same workspace-projection schema, and ordinary stored-state interpretation is unchanged. A refresh-specific cross-session/mid-await injection and a literal tagged-runtime upgrade were not executed.

Visual evidence

Open preview

Before After
Guest cannot obtain current private base and leaves its draft unchanged Guest refreshes, resolves the conflict, passes tests and review, and updates the same draft

Actual guest tool-flow excerpt at4x speed; cropped timestamped screenshot stream, with metadata redacted

after-public.mp4

Visual verification

  • Baseline: 53216332eda7121dd5eaad38276dc46246866fd5
  • Exact head: 201bc4413ecd7b03308260c61480f0d37aab4cc7
  • Scenario: Continue the same blocked guest task, refresh its selected private repository base, resolve its README conflict, run tests and normal Auto Review, then update the existing draft.
  • Runtime/build: Recorded on f34b77ac614e9f6dcc9c72dd3fc7ad8b54fbee35, a retained-runtime composition with all24 contribution files byte-identical to201bc441. The retained dependency graph is unchanged from the before runtime; directly affected consumers and the fs-safe patch difference were qualified. This is source-equivalent live proof, not a full201 deployment.
  • Guest revision: 30 tests pass; native Auto Review completes scoped-clean using only local mode and the returned base
  • Preservation: GitHub confirms base ancestry; all7 upstream files and both shipping implementation/test blobs are preserved
  • Authority: Guest ready/merge/auto-merge request refused with GitHub unchanged; admin subsequently merged the reviewed head in the same conversation
  • Before and after use the same retained session, viewport, theme and bottom-of-conversation framing; both are identically cropped.
  • Original actual browser frames retained through assessment. Recording is a4x cropped excerpt with variable capture cadence, not a frame-timing or performance claim.
  • Expanded Auto Review tool result confirms local/base input, openclaw engine, report produced, exit0 and no timeout.
  • GitHub independently confirms the same draft update and then an admin merge whose tree equals the reviewed head and whose parent preserves current main.
  • No host branch repair, guest credentials, sandbox network grant, private-reader widening or automatic publication integration was used.

@clawsweeper

clawsweeper Bot commented Oct 16, 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 app: web-ui App: web-ui gateway Gateway runtime docker Docker and sandbox tooling agents Agent runtime and tooling size: XL labels Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 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: 201bc4413ecd7b03308260c61480f0d37aab4cc7
  • Maintainer: @shakkernerd
  • Repository role: maintain

These security sensitive changes were made:

  • src/gateway/method-scopes.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/methods/core-descriptors.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Adds an explicit refresh_base action that integrates the selected repository base into an existing managed sandbox workspace before review and publication.

Example: A sandboxed session has saved README changes while main advances to commit 4be1d11.

  • Before: The guest cannot fetch the private repository base and cannot resolve its draft's conflict.
  • After: The guest refreshes the base, resolves the README conflict, reviews against the returned commit, and updates the same draft.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful implementation with meaningful real-flow evidence and no discrete finding; authorization and existing-state validation limit merge confidence.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: A sandboxed agent cannot integrate a newer private repository base to resolve conflicts while GitHub credentials remain on the Gateway.
Reason: The maintainer-authored direction addresses a concrete blocked workflow through the existing publication and workspace owners.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep this PR open: it adds a useful, maintainer-directed capability absent from current main, and no definite introduced defect was found.

Priority: P2
Reviewed head: 201bc4413ecd7b03308260c61480f0d37aab4cc7

Before merge

  • Add real behavior proof - Authority-chain proof required: the inspected screenshots and source-equivalent live-flow account substantially address the refresh-to-review-to-draft happy path. Guest denial of ready/merge proves the existing privileged action boundary, not rejection of a different-session refresh. The new refresh fixture revokes authority before another invocation; existing requester/projection tests do not demonstrate revocation during this action's fetch, two-copy transfer, sandbox import, or retained-transfer recovery. Provide allowed and nearest-forbidden final-effect traces through the registered owner, redacting IPs, API keys, phone numbers, and non-public endpoints. Saved-state compatibility also needs an upgrade/reopen run from v2026.10.4; documentation and fresh fixtures do not establish that result. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - No concrete authorization bypass was found, but refresh-specific final-effect authority proof remains incomplete.
  • Resolve merge risk - The new session-write action crosses host-credential and sandbox boundaries, but final-effect rejection of cross-session or revoked refresh authority remains unestablished.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply refresh-specific cross-session and mid-await revocation/recovery traces, plus a v2026.10.4 upgrade-and-reopen run preserving existing settings and workspace data.
Agent review details

How this fits together

The Gateway publication broker uses host-held GitHub credentials and workspace ownership to fetch the selected base, reconcile source into canonical and private workspaces, and return a sandbox-local review target.

flowchart TD
  A[Agent publication tool] --> B[Gateway caller authorization]
  B --> C[Selected repository base]
  C --> D[Source merge preparation]
  D --> E[Workspace reconciliation owner]
  E --> F[Canonical and private source]
  F --> G[Sandbox review base]
  G --> H[Review and draft publication]
Loading

Technical review

Best possible solution:

Retain the explicit refresh action and existing reconciliation owner, with refresh-specific authority and saved-state compatibility evidence before merge.

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

Current main's tool and protocol lack refresh_base, and the inspected before screenshot shows the private-base task blocked by unavailable sandbox fetching.

Is this the best way to solve the issue?

An explicit action using Gateway credentials and existing workspace settlement fits the ownership boundary and avoids importing guest Git metadata or silently changing reviewed source during publication.

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Complete refresh-specific boundary evidence (recommended)
    Exercise a different-session caller and revocation during fetch or retained-transfer recovery through the registered refresh owner, recording rejection before unauthorized workspace writes or sandbox import.

Provenance checked

  • Private managed sandbox source boundary keeps the original intent (28d8ee4: Provide writable private project source without exposing host Git metadata, credentials, or unadmitted ignored files.)
  • Projection persistence and settlement custody keeps the original intent (cd326f9: Keep projection persistence in shared-state workers while retaining authority, acknowledged receipts, and recovery ownership.)
  • Conversation publication action authorization keeps the original intent (bf90074: Permit currently authorized operators to act on recorded PRs without transferring privileged authority to guest turns.)
  • Publication snapshot admission keeps the original intent (0606e31: Publish accepted workspace state through a Gateway-owned broker rather than granting workers standing forge credentials.)

Testing

Proof path: shipped entry point.

Security

Needs attention: No concrete authorization bypass was found, but refresh-specific final-effect authority proof remains incomplete.

Evidence

What I checked:

  • Introduced change and current main: Reviewed the pinned merge-base-to-head diff; current main has no refresh_base implementation, while the new owner performs explicit source integration and returns a local review base. (src/gateway/github-publication-base-refresh.ts:41, 201bc4413ecd)
  • Refresh authority boundary: The registered handler requires a prepared writable sandbox, matches the current conversation, retains requester and workspace authority, and joins publication's workspace exclusion. (src/gateway/server-methods/sessions-github.ts:174, 201bc4413ecd)
  • New-path authority coverage: The added real-Git scenario covers missing-sandbox and read-only rejection, interrupted preparation and two-copy recovery, conflict acknowledgment, preserved source, and same-draft publication; its revocation check occurs before a subsequent invocation, rather than during refresh. (src/gateway/github-publication-actions.test.ts:732, 201bc4413ecd)
  • Existing authority tests have narrower coverage: Requester tests reject authority changes during publication preparation, and projection tests recover ordinary synchronization after authority loss; neither exercises the new refresh action's fetch, two-copy transfer, and sandbox import together. (src/gateway/worker-environments/local-workspace-projection.test.ts:496, 201bc4413ecd)
  • Inspected live-flow screenshots: The supplied before/after images show the blocked private-base task followed by a reported refresh, README conflict resolution, 30 passing project tests, scoped-clean review against the refreshed base, and an update to the same draft. The body qualifies this as source-equivalent retained-runtime proof. (201bc4413ecd)
  • Video inspection infrastructure limit: The prepared manifest reports 'ffprobe failed: spawnSync ffprobe ENOENT'; fallback access to the linked recording returned 'Cache miss'. The recording was therefore not independently assessed, and this tooling limitation is not a contributor defect.

Likely related people:

  • Shakker: Raw commit bf90074 adds src/gateway/github-publication-actions.ts:22 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bf90074c33e2; files: src/gateway/github-publication-actions.ts)
  • Peter Steinberger: Raw commit ee122ba adds src/gateway/worker-environments/local-workspace-state.ts:134 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ee122ba9471c; files: src/gateway/worker-environments/local-workspace-state.ts)

PR surface

Source +669, Tests +412, Docs +43. Total +1124 across 24 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 15 707 38 +669
Tests 7 413 1 +412
Docs 2 44 1 +43
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 24 1164 40 +1124

Review metrics

Metric Value Why it matters
Production versus test growth Production +707/-38 lines; tests and test support +413/-1 lines The new merge and sandbox-transfer orchestration explains the production growth, while existing transport and reconciliation owners are reused.
Protocol additions 1 action and 2 optional acknowledgment fields refresh_base adds conflictsResolved and baseCommit without introducing repository, arbitrary-ref, or other-session selectors.

Labels

Label changes:

  • add P2: Useful managed-sandbox workflow improvement with a limited affected surface.
  • add merge-risk: 🚨 compatibility: Refresh adds a persisted result-reference purpose and changes saved projection settlement; the documented downgrade restriction is intentional, but stable-state upgrade/reopen evidence remains required.
  • add merge-risk: 🚨 security-boundary: Session-write callers can initiate credentialed base retrieval and source transfer into a sandbox; refresh-specific forbidden and revoked-authority effects need proof.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: Useful managed-sandbox workflow improvement with a limited affected surface.
  • merge-risk: 🚨 security-boundary: Session-write callers can initiate credentialed base retrieval and source transfer into a sandbox; refresh-specific forbidden and revoked-authority effects need proof.
  • merge-risk: 🚨 compatibility: Refresh adds a persisted result-reference purpose and changes saved projection settlement; the documented downgrade restriction is intentional, but stable-state upgrade/reopen evidence remains required.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rank-up moves

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

  • Add final-effect proof that a different-session caller and authority revoked during refresh or retained-transfer recovery cannot perform unauthorized workspace writes or sandbox import.
  • Demonstrate upgrade and reopen from v2026.10.4 with existing workspace settings, guest files, and pending-state recovery intact.

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 (1 earlier review cycle)
  • reviewed 2026-10-16T18:40:13.037Z sha c69e3aa :: needs real behavior proof before merge. :: none

Reviewed October 16, 2026, 3:41 PM ET / 19:41 UTC (Revision 2).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 16, 2026
@shakkernerd
shakkernerd merged commit 23173ed into main Oct 16, 2026
214 checks passed
@shakkernerd
shakkernerd deleted the workspace-base-refresh branch October 16, 2026 19:51
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Added: managed sandbox sessions can refresh their selected repository base, resolve conflicts, and update the same draft while preserving saved work.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
Add an explicit base refresh for managed sandbox workspaces, preserving saved edits and conflict resolution while retaining the selected base in draft publication ancestry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant