Skip to content

fix(agents): keep sandbox documentation references reachable - #174856

Merged
steipete merged 3 commits into
mainfrom
fix/sandbox-docs
Oct 17, 2026
Merged

steipete merged 3 commits into
mainfrom
fix/sandbox-docs

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #173657. Sandboxed agents were told to read the gateway host's OpenClaw documentation directory even when that directory was absent from the sandbox. Following the prompt produced failed reads and could leave local models answering from memory.

User Impact

Sandboxed runs receive readable docs/source paths already exposed by their filesystem bridge, or the existing public reference URLs. This includes seeded SSH-derived workspaces, whose bridges intentionally omit a local hostPath, and workspaces configured through a symlink. When neither local docs nor web tools are available, the prompt marks recalled behavior as unverified. No mounts or permissions are added.

Why This Change Was Made

The shared resolver projects candidates through the admitted filesystem bridge. Its declared path mappings identify the backing source, preserving the configured mount alias for projection and using canonical paths only to check backing identity and containment. Shadow mounts and escaping symlinks remain excluded; docs-only mounts do not expose the parent source tree. Older bridges without mapping descriptors retain their host-backed check.

Normal attempts and prepared compaction supply the same admitted context. Host CLI/system overview references remain unchanged, and remote worker prompts retain their explicit empty references. The Documentation section moves into a small section module so the oversized main renderer shrinks.

Production +81/-39 (+42 net); tests +104/-3 (+101 net); docs +2. Necessary production growth covers projection identity, mount aliases, and unavailable-retrieval guidance. No alternate resolver or mount policy was added.

Thanks @seriouslysean for the report and offline-retrieval clarification, and @LiuwqGit for the earlier repair and read-only workspace coverage in #173720. Contributor co-author credit is preserved.

Evidence

  • The real RemoteShellSandboxFsBridge regression failed on 58dabaef (1 failure / 12 passes, 57.90s wall), then retained /remote/workspace/docs and /remote/workspace after repair. A separate symlinked-root regression failed on 71a3bf (1 failure / 13 passes, 21.48s wall). Both now pass alongside unmounted, admitted workspace, read-only workspace, explicit bind, shadow, escaping-symlink and missing-bridge controls.
  • The first remote correction passed 85 focused tests with 10 existing macOS platform skips across reference resolution, prompt rendering and remote filesystem behavior (819.95s wall, dominated by cold compilation). The alias correction passes all 72 reference/prompt tests (447.06s wall; Vitest 281.95s, 97% transformation).
  • Core types (18.81s), agent test types (37.41s), scoped lint (52.89s), format, line-cap, assertion-safety, timeout-race, mock-export, config-docs and plugin-inventory checks pass. Local max-lines reports three untouched UI files, byte-identical to the pinned base; no baseline was loosened.
  • Snapshot regeneration passes (141.32s), with all eight generated files unchanged: zero byte/token delta. Neither remote correction changes prompt strings.
  • Original Docker/real-model proof on 58dabaef: isolated pnpm openclaw agent --local, workspace rw, no package-docs mount. Before, the actual read of the advertised host path failed. After, the fixture used public URLs with no read; admitted /workspace/docs read succeeded. Native Ollama qwen3:4b changed from a 2,048-token truncated baseline to a normal URL answer without a read (64.80s CLI / 37.93s agent). These live runs were not repeated for the remote-mapping corrections.
  • Those recorded package prompts have identical stable prefixes and all bytes outside Documentation. Documentation shrank 540→450 characters, approximately 135→113 tokens using ceil(chars/4) (−22 estimated tokens). Earlier snapshot generations have zero committed byte/token delta.

Platform: macOS host with Linux Docker for the original live proof. Remote regressions use the production bridge locally; no live SSH or Podman run is claimed. The original full SDK declaration build stalled, while supported runtime builds and original-head CI passed.

Prior-head CI (71a3bf, run 38991335333) failed only the baseline-ratchets job and its aggregate gate: an unrelated updater-test mock omitted ./update-command-database-context.js. The exact CI base faeeb6fba770c10b431db8412593692f2ecad726 reproduces the same diagnostic using an isolated Git index (34.39s); this PR changes neither that fixture nor its checker. Independent committed-branch Codex autoreview is scoped-clean at P2 and above on 8e66859bef63d71d501ed4a634b6bca81f431c56, including real bridge and shared mapping source context. ClawSweeper reviewed that exact head: both earlier findings are resolved, no actionable findings or Before merge items remain, and it is ready for maintainer review. The disclosed live-SSH proof gap remains.

Current-head CI run 38993224377 completed with 40 successful jobs, 25 skips, and the same unrelated mock-export failure in baseline-ratchets. The job pins base 1c72fb73b5e3de412c53d11dd082961bf887162f; an isolated index populated with that exact base reproduces the same updater diagnostic (70.43s). The moving PR API base is newer and passes the check, so attribution uses the job’s pinned checkout. No CI rerun, baseline relaxation, or unrelated source change was made.

openclaw/ci-gate is red solely from that attributed baseline-ratchet failure; the inherited-failure exception remains for the lead. This PR has not been merged.

Resolve docs and source paths through the admitted sandbox filesystem
bridge so prompts only advertise mounted container paths. Fall back to
public URLs for host-only references and acknowledge when neither local
docs nor web retrieval is available. Use the same owner for normal turns
and prepared compaction without expanding sandbox mounts.

Fixes #173657. Thanks to @seriouslysean for reporting the failed reads and
@LiuwqGit for the earlier repair and read-only workspace coverage.

Co-authored-by: LiuwqGit <[email protected]>
@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 agents Agent runtime and tooling size: S labels Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 23:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T02:04:01.454754Z 8e66859 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 58dabaef25

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/docs-path.ts Resolved
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR projects documentation references through existing sandbox mounts and acknowledges when documentation retrieval is unavailable.

Example: A workspace configured as /srv/project points to /mnt/repos/openclaw and is mapped to /remote/workspace.

  • Before: Canonicalizing the workspace before bridge projection discards readable local references.
  • After: The prompt retains /remote/workspace/docs and /remote/workspace while checking their canonical backing identity.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with both previous findings resolved, meaningful bridge coverage, and reported shipped-entry-point proof; no new blocking defect was identified.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body reports real CLI/Docker and Ollama behavior on the original head, with subsequent remote and alias corrections covered by production-bridge regressions rather than live SSH execution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Sandboxed agents follow documentation instructions that point outside their accessible filesystem and may answer from memory after failed reads.
Reason: The maintainer-authored direction restores usable documentation guidance without adding mounts, permissions, or configuration.

Merge readiness

✅ Ready for maintainer review

Both previous remote-reference findings are resolved, and no new actionable defect was found; current main still needs this repair.

Priority: P2
Reviewed head: 8e66859bef63d71d501ed4a634b6bca81f431c56

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Remote mapping corrections have production-bridge regressions but no reported live SSH run; original CLI/Docker proof predates those corrections.
Agent review details

How this fits together

Reference discovery takes host package/workspace candidates and the admitted sandbox bridge, then supplies usable paths to normal-turn and compaction prompt assembly.

flowchart LR
  A[Workspace and package roots] --> B[Reference resolver]
  C[Admitted sandbox bridge] --> B
  B --> D[Normal turn preparation]
  B --> E[Compaction preparation]
  D --> F[Documentation prompt section]
  E --> F
Loading

Technical review

Best possible solution:

Land the shared bridge-based reference repair after the existing exact-head landing gates pass.

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

Current-main discovery and prompt callers establish the reported host-path failure; the PR records live reproduction, but this review did not execute target code.

Is this the best way to solve the issue?

The repair belongs in shared reference discovery, reuses existing bridge mappings, covers attempts and compaction, and preserves mount ownership.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Documentation reference discovery keeps the original intent (e9a08dc: The original resolveClawdbotDocsPath implementation preferred workspace documentation and otherwise discovered package documentation for local-first guidance.)
  • Unified docs/source resolver keeps the original intent (67adcce: The merged refactor consolidated docs and source discovery under one resolver while preserving existing behavior.)
  • Documentation prompt rendering changes intended behavior with a stated reason (4a0be71: The merged simplification inlined the section while preserving prompt bytes; this PR explains its extraction and the intentional unavailable-retrieval wording.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned introduction and previous finding: The introduced diff adds sandbox-aware reference projection; the final correction passes the configured directory spelling to descriptor-based bridges and reserves canonical paths for identity and containment checks. (src/agents/docs-path.ts:43, 8e66859bef63)
  • Remote bridge contract: RemoteShellSandboxFsBridge intentionally returns container and relative paths without hostPath; its pathMappings expose the selected local backing roots, which the repaired resolver now consumes. (src/agents/sandbox/remote-fs-bridge.ts:66, 8e66859bef63)
  • Focused regression coverage: The scenario table uses production local and remote bridges and covers mount aliases, read-only workspaces, explicit docs binds, shadow mounts, escaping symlinks, and missing bridges. (src/agents/docs-path.test.ts:70, 8e66859bef63)
  • Current-main necessity: Fetched main still discovers host documentation without sandbox context and can advertise an inaccessible host path. (src/agents/docs-path.ts:23, aa74908822e7)
  • Shared callers and unchanged boundaries: Normal attempts and prepared compaction pass their existing sandbox context; host CLI and overview callers remain unsandboxed, and remote worker preparation retains explicit empty references. (src/agents/embedded-agent-runner/run/attempt-system-prompt-prepare.ts:214, 8e66859bef63)
  • Reported behavior proof and contributor credit: The complete PR body reports original real CLI/Docker and Ollama scenarios, distinguishes later bridge regressions from live SSH proof, and credits seriouslysean's report and LiuwqGit's earlier repair. (8e66859bef63)

Likely related people:

  • Peter Steinberger: Raw commit 67adcce adds src/agents/docs-path.ts:23 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 67adcce7e304; files: src/agents/docs-path.ts)

PR surface

Source +42, Tests +101, Docs +2. Total +145 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 81 39 +42
Tests 2 104 3 +101
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 187 42 +145

Root-cause cluster

Relationship: same_root_cause
Canonical: #173657
Summary: The report and both repair PRs address documentation references that sandboxed tools cannot read.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦐 gold shrimp.
  • 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 author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Misleading sandbox documentation references cause repeated failed reads and unreliable configuration answers without establishing a core runtime outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦐 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-17T00:26:03.513Z sha 58dabae :: needs changes before merge. :: [P2] Preserve readable references on remote filesystem bridges
  • reviewed 2026-10-17T01:44:15.833Z sha 71a3bf4 :: needs changes before merge. :: [P2] Project remote references from the configured mount alias

Reviewed October 16, 2026, 10:05 PM ET / October 17, 2026, 02:05 UTC (Revision 3).

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 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-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71a3bf45c3

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/docs-path.ts Resolved
@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Oct 17, 2026
@clawsweeper clawsweeper Bot removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Both remote-reference findings are addressed at 8e66859. The production remote bridge retains readable docs/source paths, including configured symlink aliases. The new alias regression fails before the fix; all 72 reference/prompt tests pass after it. Core/test types, scoped lint, snapshot generation, and applicable ratchets are complete; the independent review is clean at P2 and above. The PR body records the unchanged live proof, zero snapshot/token delta, and prior-head inherited CI failure.

@clawsweeper

clawsweeper Bot commented Oct 17, 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. labels Oct 17, 2026
@steipete
steipete merged commit aaf3536 into main Oct 17, 2026
144 of 151 checks passed
@steipete
steipete deleted the fix/sandbox-docs branch October 17, 2026 03:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…w#174856)

* fix(agents): keep sandbox documentation references reachable

Resolve docs and source paths through the admitted sandbox filesystem
bridge so prompts only advertise mounted container paths. Fall back to
public URLs for host-only references and acknowledge when neither local
docs nor web retrieval is available. Use the same owner for normal turns
and prepared compaction without expanding sandbox mounts.

Fixes openclaw#173657. Thanks to @seriouslysean for reporting the failed reads and
@LiuwqGit for the earlier repair and read-only workspace coverage.

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

* fix(agents): preserve remote sandbox documentation paths

* fix(agents): retain remote workspace mount aliases

---------

Co-authored-by: LiuwqGit <[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 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. docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Sandboxed agents are told to read local docs at a host path they cannot access

1 participant