Repository navigation
fix(agents): preserve find result paths - #133302
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 9:40 AM ET / 13:40 UTC. ClawSweeper reviewWhat this changesThe PR centralizes find-result formatting so native fd and custom search backends preserve relative paths, filename whitespace, and directory markers. Regression provenancePossible 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -10, Tests +104. Total +94 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Closes #133301
What Problem This Solves
Fixes an issue where agents using
findreceived 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
fd10.5.0 on Darwin: all three final scenarios passed; thereadtool successfully consumed all seven returned file paths. This proof uses temporary fixtures only, with downloads disabled.fdinstallation is required in CI.check:changedgate passed for all three changed paths, including all core test type shards and architecture checks.a9769e3ceab19b2f0663a75000db843bcc03d71b, including the required merge gate.