Skip to content

fix(agents): preserve find result paths - #133302

Merged
steipete merged 1 commit into
mainfrom
codex/qa-20260830-find-paths
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-20260830-find-paths

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #133301

What Problem This Solves

Fixes an issue where agents using find received unusable paths when the search directory ended in a separator, filenames contained trailing whitespace or a literal POSIX backslash, or custom backends returned relative paths. Results could lose their first character, point into the wrong directory, or falsely appear to be directories.

Why This Change Was Made

Format both backends in the existing result owner. Relativize absolute paths with the native path library, retain search-relative results, preserve directory markers and filename bytes, and represent the search directory itself as . or ./. This removes both manual prefix-slicing paths without changing traversal, ignore rules, limits, stream handling, or public operation shapes. Production is net −10 lines; tests add 104 lines.

User Impact

Agents can pass the returned filenames directly to read, including when the search directory has a trailing separator or filenames contain meaningful whitespace, Unicode, or a literal POSIX backslash. Custom backends retain the documented relative-or-absolute path contract. No configuration, migration, dependency, or operator action is required.

Evidence

  • Captured native and custom-backend failures before the repair, including a separate literal-backslash regression.
  • Final focused suites: 40 passed, with one existing Windows-only case skipped on macOS.
  • Actual native fd 10.5.0 on Darwin: all three final scenarios passed; the read tool successfully consumed all seven returned file paths. This proof uses temporary fixtures only, with downloads disabled.
  • Committed tests use the existing hermetic process/custom-backend seams; no external fd installation is required in CI.
  • The full maintained check:changed gate passed for all three changed paths, including all core test type shards and architecture checks.
  • Independent P0–P2 source and behavior review passed; fresh automated review was scoped-clean at P0.
  • Exact-head CI passed at a9769e3ceab19b2f0663a75000db843bcc03d71b, including the required merge gate.
  • ClawSweeper reviewed the exact head: no findings and no before-merge actions.
  • Native Windows execution was not performed locally; Windows separator cases are covered hermetically. The existing newline-delimited filename transport is unchanged; this repair does not claim support for filenames containing newlines.

@steipete steipete self-assigned this Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Aug 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 13:31
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 9:40 AM ET / 13:40 UTC.

ClawSweeper review

What this changes

The PR centralizes find-result formatting so native fd and custom search backends preserve relative paths, filename whitespace, and directory markers.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

No blocking correctness finding. This maintainer-owned PR repairs a source-proven path-identity defect at the shared result owner and should remain open for ordinary maintainer review and exact-head CI.

Priority: P2
Reviewed head: a9769e3ceab19b2f0663a75000db843bcc03d71b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused net-negative production repair with behavior-oriented coverage and no supported correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository state identifies this as a maintainer-authored PR, so the external-contributor real-behavior gate does not apply; the submitted body nevertheless records native fd and read-tool after-fix evidence, while the committed tests exercise the hermetic producer seams.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository state identifies this as a maintainer-authored PR, so the external-contributor real-behavior gate does not apply; the submitted body nevertheless records native fd and read-tool after-fix evidence, while the committed tests exercise the hermetic producer seams.
Evidence reviewed 6 items Shared owner repairs both backend paths: The introduced formatter receives raw paths from both the injected backend and fd, uses native relative-path calculation only for absolute values, and retains an explicit directory marker after normalization.
Caller and downstream path resolution: The stable session-tool factory exposes find in the read-only tool set, while read resolves relative input against the same working directory; this makes the returned relative paths the appropriate boundary to repair.
Regression coverage exercises both producers: New table-driven custom-backend cases cover absolute, relative, root, self-directory, prefix-sibling, whitespace, and directory-marker values; the fd seam covers trailing separators, Unicode, whitespace, and a literal POSIX backslash.
Findings None None.
Security None None.

How this fits together

The session find tool accepts an agent workspace query, receives matches from either fd or an injected backend, and returns paths that agents use in later file operations. Its output must preserve the filesystem path identity while making absolute matches relative to the requested search directory.

flowchart LR
  A[Agent search request] --> B[Find tool]
  B --> C[Native fd backend]
  B --> D[Custom search backend]
  C --> E[Shared path formatter]
  D --> E
  E --> F[Relative result paths]
  F --> G[Agent file operations]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -10, Tests +104. Total +94 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 21 31 -10
Tests 2 104 0 +104
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 125 31 +94

Review metrics

Metric Value Why it matters
Production versus test LOC production +21/-31 (net -10); tests +104/-0 The bug fix removes the two divergent manual projections while adding boundary cases for both result producers.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #133301
Summary: This PR explicitly targets the concrete path-identity behavior reported by the linked issue.

Members:

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

Technical review

Best possible solution:

Keep one shared result projection at the find-tool owner, retaining raw backend path bytes until that projection and preserving the focused producer-boundary coverage.

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

Yes, source reproduction is high confidence: the prior fd path trims every line and slices absolute results manually, while the custom path uses the same prefix heuristic. The linked report supplies concrete pre-fix scenarios, though this read-only review did not execute target code.

Is this the best way to solve the issue?

Yes. Moving both producers to the existing shared result builder is the narrowest maintainable repair; preserving separate ad hoc slicing and trimming branches would retain the divergence that caused the defect.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a focused agent file-discovery correctness repair with limited, non-security blast radius.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies this as a maintainer-authored PR, so the external-contributor real-behavior gate does not apply; the submitted body nevertheless records native fd and read-tool after-fix evidence, while the committed tests exercise the hermetic producer seams.

Label justifications:

  • P2: This is a focused agent file-discovery correctness repair with limited, non-security blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies this as a maintainer-authored PR, so the external-contributor real-behavior gate does not apply; the submitted body nevertheless records native fd and read-tool after-fix evidence, while the committed tests exercise the hermetic producer seams.

Evidence

What I checked:

  • Shared owner repairs both backend paths: The introduced formatter receives raw paths from both the injected backend and fd, uses native relative-path calculation only for absolute values, and retains an explicit directory marker after normalization. (src/agents/sessions/tools/find.ts:118, a9769e3ceab1)
  • Caller and downstream path resolution: The stable session-tool factory exposes find in the read-only tool set, while read resolves relative input against the same working directory; this makes the returned relative paths the appropriate boundary to repair. (src/agents/sessions/tools/index.ts:160, a9769e3ceab1)
  • Regression coverage exercises both producers: New table-driven custom-backend cases cover absolute, relative, root, self-directory, prefix-sibling, whitespace, and directory-marker values; the fd seam covers trailing separators, Unicode, whitespace, and a literal POSIX backslash. (src/agents/sessions/tools/find.test.ts:26, a9769e3ceab1)
  • Current-main comparison: The fetched current-main revision retains the prior manual projection; the verified test merge changes only these three find-tool files, so the reported repair is neither already present nor obscured by base-branch drift. (src/agents/sessions/tools/find.ts:233, b4f85100f72d)
  • Feature-history routing: The current find-tool files entered nearby history in commit 671c6e7; its raw-parent boundary is incomplete locally, so this supports routing rather than an introduction attribution. (src/agents/sessions/tools/find.ts:219, 671c6e75859b)
  • Codex dependency gate is not triggered: The changed behavior is local session-tool formatting using Node path utilities and internal helpers; the diff has no Codex harness, runtime, protocol, or proof claim dependency. (src/agents/sessions/tools/find.ts:1, a9769e3ceab1)

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit 1505218 into main Aug 30, 2026
314 checks passed
@steipete
steipete deleted the codex/qa-20260830-find-paths branch August 30, 2026 13:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

find returns unusable paths for trailing search separators and filename characters

1 participant