Skip to content

fix(read): explain directory paths - #114601

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
ralf003:fix/read-eisdir-guard
Aug 3, 2026
Merged

vincentkoc merged 1 commit into
openclaw:mainfrom
ralf003:fix/read-eisdir-guard

Conversation

@ralf003

@ralf003 ralf003 commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users or agents that passed a directory to the read tool received a raw EISDIR failure with no useful recovery direction. The same path could behave differently between local and sandbox-backed reads.

Why This Change Was Made

Normalize the filesystem's real EISDIR result at the read-tool error boundary, and reject directories at the sandbox bridge owner before its file-read operation. Both paths now return the same actionable instruction without adding a new read API, config surface, or fallback path.

User Impact

Directory mistakes now explain that read requires a file path and tell the agent to list the directory before choosing a file. Ordinary file reads are unchanged.

Evidence

  • Final rewritten head: 949e7b76fd71fc324e27b6f208ff8edc7711746d, based on 63651a1878f3d9d6b6de1cb9d2ac3789e5528562.
  • Focused regressions: node scripts/run-vitest.mjs src/agents/sessions/tools/read.test.ts src/agents/agent-tools.create-openclaw-coding-tools.test.ts -> 131/131 passed on the final rebased diff.
  • Stress proof: the same two-file lane passed three bounded repetitions, 393/393 assertions.
  • Core and core-test typechecks passed; the core-test rerun used a full, deep-linked GWT after the sparse GWT correctly exposed a missing workspace link rather than a code failure.
  • oxfmt, focused oxlint, temp-directory policy, git diff --check, and TruffleHog passed.
  • Exact-base branch autoreview: no findings, patch correct, confidence 0.99.
  • The remote Testbox attempt was cancelled after its GitHub checkout stalled before repository code or tests ran; local fallback followed repository policy.
  • Production delta: +15/-2; tests: +30/-0.

Co-authored with the original contributor. AI-assisted; all changes and evidence were reviewed by the maintainer.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 27, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 5:00 AM ET / 09:00 UTC.

ClawSweeper review

What this changes

This PR makes local and sandbox-backed agent read operations explain that a directory must be listed before a specific file can be read.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR remains necessary: current main still exposes the raw filesystem directory error at the local read boundary and only treats missing sandbox paths specially. The rewritten head normalizes the local EISDIR result and rejects sandbox directories before the bridge read, with no remaining code-level finding; it is ready for normal maintainer merge review after the exact-head required checks finish.

Priority: P2
Reviewed head: 949e7b76fd71fc324e27b6f208ff8edc7711746d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused cross-backend repair with direct regression coverage and recorded final-head validation; only the normal required-check gate remains.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body records final-head terminal validation for focused local and sandbox filesystem regressions, and the added tests directly exercise the repaired behavior.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body records final-head terminal validation for focused local and sandbox filesystem regressions, and the added tests directly exercise the repaired behavior.
Evidence reviewed 6 items Current-main behavior: Current main catches the local read failure with generic error coercion, so a filesystem EISDIR is not converted into recovery guidance.
Local repair boundary: The PR centralizes EISDIR normalization at the read tool’s existing error boundary, preserving all other error handling.
Sandbox owner repair: The sandbox access owner already obtains a typed bridge stat; the PR converts a directory stat into the same EISDIR path before readFile can run.
Findings None None.
Security None None.

How this fits together

The agent read tool accepts a requested path, routes it to either the local filesystem or a sandbox filesystem bridge, and returns text or an error to the model. This change makes directory mistakes produce the same actionable recovery guidance across both backends.

flowchart LR
  A[Agent requests read] --> B[Read tool]
  B --> C{Local or sandbox backend}
  C --> D[Validate requested path]
  D --> E[Read file content]
  D --> F[Explain directory path]
  E --> G[Tool result to model]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Required CI is still in progress for the final rebased head, so merge should remain gated on the repository’s normal exact-head checks.
  • Complete next step (P2) - No repair lane is needed because the final head addresses the prior backend-coverage concern; wait for exact-head checks and ordinary maintainer merge review.
Agent review details

Security

None.

PR surface

Source +13, Tests +30. Total +43 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 15 2 +13
Tests 2 30 0 +30
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 45 2 +43

Review metrics

Metric Value Why it matters
Production vs test delta production +15/-2; tests +30/-0 The small production increase implements two backend-owner checks, while the added tests cover both the local error boundary and the sandbox bridge boundary.

Stored data model

Persistent data-model change detected: serialized state: src/agents/agent-tools.create-openclaw-coding-tools.test.ts, serialized state: src/agents/sessions/tools/read.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one canonical actionable directory-path message by merging the two owner-boundary checks after the final head’s required validation completes.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one canonical actionable directory-path message by merging the two owner-boundary checks after the final head’s required validation completes.

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

Yes—source establishes the path: local reads propagate a native EISDIR, while sandbox reads have a typed directory stat before their bridge read. The PR adds focused tests for both routes, although this read-only review did not execute them.

Is this the best way to solve the issue?

Yes—the patch fixes the error at each backend owner without adding a read API, configuration, fallback, or downstream string-based workaround.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f62e42b69fe5.

Labels

Label justifications:

  • P2: Directory reads currently provide poor recovery guidance for an agent, while ordinary file reads remain available and unaffected.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body records final-head terminal validation for focused local and sandbox filesystem regressions, and the added tests directly exercise the repaired behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records final-head terminal validation for focused local and sandbox filesystem regressions, and the added tests directly exercise the repaired behavior.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Authored the final rebased repair, requested the current re-review, and is assigned to this PR as a repository member. (role: reviewer and rewrite author; confidence: high; commits: 949e7b76fd71; files: src/agents/sessions/tools/read.ts, src/agents/agent-tools.read.ts)
  • Peter Steinberger: The nearest prior blame for both changed read-path regions is commit 57d8b1f, which established the current baseline structure. (role: recent area contributor; confidence: medium; commits: 57d8b1fc7398; files: src/agents/sessions/tools/read.ts, src/agents/agent-tools.read.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-28T02:37:22.642Z sha f0b226b5b6326ab1c681bf03a310b7fb4dae258c :: needs changes before merge. :: [P2] Normalize directory reads across all supported backends
  • reviewed 2026-07-28T15:12:06.162Z sha 0c8962f6768e0e70a87ab5f941721296dd814c4d :: needs changes before merge. :: [P2] Normalize directory reads for backends without stat
  • reviewed 2026-07-29T12:43:28.062Z sha 89f7f17cd39072b90f6997d9125c01c62879ef06 :: needs changes before merge. :: [P2] Normalize directory reads for backends without stat
  • reviewed 2026-07-30T16:21:31.540Z sha a76013224f04842cd12e4c729d056dd6b065e7dd :: needs changes before merge. :: [P2] Normalize directory reads for stat-less backends
  • reviewed 2026-08-01T04:12:37.806Z sha a76013224f04842cd12e4c729d056dd6b065e7dd :: needs changes before merge. :: [P2] Normalize directory reads for the sandbox backend
  • reviewed 2026-08-02T09:57:07.985Z sha a76013224f04842cd12e4c729d056dd6b065e7dd :: needs changes before merge. :: [P2] Normalize directory reads for the sandbox backend
  • reviewed 2026-08-02T16:12:59.921Z sha a76013224f04842cd12e4c729d056dd6b065e7dd :: needs changes before merge. :: [P2] Propagate directory detection to the sandbox backend
  • reviewed 2026-08-03T08:52:25.352Z sha df2a729d181ea3625bd00cec5d524f1061669607 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 27, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 28, 2026
@clawsweeper clawsweeper Bot added 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 rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 28, 2026
@ralf003
ralf003 force-pushed the fix/read-eisdir-guard branch from f0b226b to 0c8962f Compare July 28, 2026 14:29
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 28, 2026
@vincentkoc
vincentkoc force-pushed the fix/read-eisdir-guard branch from a760132 to df2a729 Compare August 3, 2026 08:46
@vincentkoc vincentkoc self-assigned this Aug 3, 2026
@vincentkoc vincentkoc changed the title fix(read): reject directories before readFile to prevent raw EISDIR errors fix(read): explain directory paths Aug 3, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Rewritten at df2a729d181ea3625bd00cec5d524f1061669607. The sandbox bridge now rejects directory stats before readFile, ordinary reads normalize the real EISDIR, and both paths have focused regressions. The PR body contains the final proof and Testbox infrastructure note.

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 3, 2026
@vincentkoc
vincentkoc force-pushed the fix/read-eisdir-guard branch from df2a729 to 949e7b7 Compare August 3, 2026 08:54
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

Rebased onto live main at 949e7b76fd71fc324e27b6f208ff8edc7711746d. The exact-head focused lane passes 131/131, formatting/lint/diff checks are clean, and branch autoreview reports no findings at 0.99 confidence.

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc merged commit a0a1893 into openclaw:main Aug 3, 2026
189 of 194 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling 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. size: XS 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.

2 participants