anthropics / anthropics/claude-agent-sdk-typescript

Glob tool returns "No files found" for a dir-prefixed relative pattern combined with an explicit path, even over populated directories (0.3.161)

Offen
#386 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Shell
Sterne
1.8k
Forks
226
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

**Version:** `@anthropic-ai/claude-agent-sdk` 0.3.161 (Node 20, Linux, `executable: "node"`, `systemPrompt: { type: "preset", preset: "claude_code" }`).

**Summary:** When the agent's built-in **Glob** tool is called with a **relative pattern that contains a directory prefix** (e.g. `registry/signals/*.md`) **and an explicit `path` argument**, it returns `"No files found"` even though matching files exist under `path`. The same directory lists fine seconds later in the same session with `{pattern: "**/*", path: }`, and with an absolute pattern and no `path`. The empty result is indistinguishable from a genuinely empty directory, so the model confidently reasons from a false world-state (in our fleet this produced wrong "the file does not exist" refusals of legitimate actions).

**Minimal repro** (deterministic, reproduced 6/6 across 4 independent sessions):

1. Fixtures:
- `/tmp/glob-probe/root/registry/signals/root-a.md`
- `/tmp/glob-probe/root/registry/signals/root-b.md`
- `/tmp/glob-probe/cwd/registry/signals/cwd-x.md` (a cwd decoy)
2. One SDK `query()` with `cwd: "/tmp/glob-probe/cwd"`, prompting the agent to call exactly:
`Glob {"pattern": "registry/signals/*.md", "path": "/tmp/glob-probe/root"}`
3. Result: `"No files found"` — neither the `path` target's two files **nor** the cwd decoy.

**Control cases (same sessions, all correct):**
- `Glob {"pattern": "**/*", "path": "/tmp/glob-probe/root/registry"}` → full listing.
- `Glob {"pattern": "/tmp/glob-probe/root/registry/*"}` (absolute, no `path`) → full listing.

**Expected:** `pattern` resolves relative to `path`; `registry/signals/*.md` under a root containing those files matches them.

**Actual:** empty result for any dir-prefixed relative pattern + `path` combination (`registry/**/*9990*`, `registry/signals/*.md`, `registry/**/*` all reproduce). The cwd decoy not being returned rules out "pattern rooted at cwd instead of `path`" — the shape matches against NEITHER root, pointing at how the bundled CLI composes the pattern with `path`.

**Impact:** any agent that navigates a file tree via dir-prefixed relative Glob patterns silently sees empty directories. No error is surfaced to the model or the harness (`permission_denials` is empty; the tool result is a normal success).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.