Glob tool false-negative on recently-created files (10 instances)

Resolved 💬 3 comments Opened Apr 27, 2026 by alfredneuworth Closed May 30, 2026

Glob tool false-negative on recently-created files (10 instances)

This issue is being filed as part of a batch of related upstream submissions discovered during architectural review of OpenClaw deployment. Filed locally 2026-04-22; submitted upstream 2026-04-27. See "Related issues (batch)" section at end for batch context.

Suggested labels (Mike to choose from labels actually available in target repo at submission time):
bug, severity:high, area:tools, tool:Glob, has-repro

Severity: HIGH — caused two false FAIL/NOT-VERIFIED verdicts in a live architectural audit
Upstream project: Anthropic Claude Code SDK (tool: Glob)

Summary

Claude Code's Glob tool returned "No files found" for patterns that matched files demonstrably present on disk with correct permissions. The audit trusted the Glob output and did not fall back to Read verification, producing false-negative verdicts in a production audit used for un-pause gating decisions.

Environment

  • Host: DESKTOP-CB8PBCM (Ubuntu 24.04, WSL2 on Windows 11 Pro)
  • Claude Code session transport: OpenClaw ACP plugin (runtime=acp, agentId=claude)
  • Session cwd: /home/alfred/.openclaw/workspace/claude (empty directory; absolute paths used for all reads/writes)
  • User: alfred:alfred, UID/GID match owner of target files
  • Node runtime: v22.22.1 via nvm
  • Date: 2026-04-22 AEST (sessions at 19:02, 19:11, 19:21 AEST)

Evidence — Glob invocations with false-negative results

Native Claude Code session logs at ~/.claude/projects/-home-alfred--openclaw-workspace-claude/. Each row cites the source session file and the exact tool_use entry.

| # | Session | Timestamp (UTC) | Glob pattern | Glob result | Ground truth at time of call |
|---|---|---|---|---|---|
| 1 | 3ea94610 | 09:02:19 | scripts/lib/*.test.js | No files found | 5 files present (born 13:55–15:29 AEST same day) |
| 2 | 3ea94610 | 09:02:19 | scripts/**/*.test.js | No files found | 5 files present |
| 3 | 3ea94610 | 09:02:20 | scripts/tmpdir-fixture-heartbeat-test.js | No files found | File present |
| 4 | b123ff71 | 09:11 | scripts/lib/*.test.js | No files found | 5 files present |
| 5 | b123ff71 | 09:11 | scripts/**/*.test.js | No files found | 5 files present |
| 6 | b123ff71 | 09:11 | scripts/**/*test* | No files found | 5 files present |
| 7 | b123ff71 | 09:11 | scripts/*fixture* | No files found | tmpdir-fixture-heartbeat-test.js present |
| 8 | b123ff71 | 09:11 | scripts/tmpdir* | No files found | tmpdir-fixture-heartbeat-test.js present |
| 9 | a7877865 | 09:21:53 | scripts/lib/*.test.js | No files found | 5 files present |
| 10 | a7877865 | 09:22:04 | scripts/**/*.test.* | No files found | 5 files present |

Total: 10 false-negative Glob results across 3 distinct Claude Code sessions.

Evidence — files actually existed, were readable

Ground-truth verification at 2026-04-22 20:47 AEST:

$ ls -la /home/alfred/.openclaw/workspace/scripts/lib/*.test.js
-rw------- 1 alfred alfred 16104 Apr 22 15:29 breaking-alert-detection.test.js
-rw------- 1 alfred alfred 16176 Apr 22 14:39 email-escalation.test.js
-rw------- 1 alfred alfred 13438 Apr 22 15:14 pending-sweep.test.js
-rw------- 1 alfred alfred  7425 Apr 22 13:55 state-atomic.test.js
-rw------- 1 alfred alfred 11861 Apr 22 15:23 task-queue-stall.test.js

File births (all before any Glob call that missed them):

  • state-atomic.test.js — 2026-04-22 13:55:33 AEST (5h 07m before first Glob call at 19:02)
  • email-escalation.test.js — 14:39:55
  • pending-sweep.test.js — 15:14:48
  • task-queue-stall.test.js — 15:23:40
  • breaking-alert-detection.test.js — 15:29:14 AEST (3h 33m before first Glob call)

Permissions: 0600, owner alfred:alfred — identical to the rule .js files (e.g. email-escalation.js) that Claude Code Read successfully in the same sessions. Files are readable by the user Claude Code runs as.

Evidence — Reads succeeded on the same files in the same sessions

Session 3ea94610 demonstrated that the files Glob failed to find were readable:

2026-04-22T09:02:19Z  Read /home/alfred/.openclaw/workspace/scripts/lib/email-escalation.test.js   → SUCCESS
2026-04-22T09:02:20Z  Read /home/alfred/.openclaw/workspace/scripts/lib/pending-sweep.test.js     → SUCCESS
2026-04-22T09:02:21Z  Read /home/alfred/.openclaw/workspace/scripts/lib/task-queue-stall.test.js  → SUCCESS
2026-04-22T09:02:21Z  Read /home/alfred/.openclaw/workspace/scripts/lib/breaking-alert-detection.test.js → SUCCESS

Four Reads succeeded in the same session the Glob returned empty. Session 3ea94610 subsequently wrote an audit stating "4 of 5 test files exist" — closer to reality than the later sessions which trusted Glob alone and claimed 0 of 5.

Ground-truth test run

Live test invocation at 2026-04-22 20:48 AEST:

$ node scripts/lib/state-atomic.test.js
...
Tests: 25 passed, 0 failed
✅ All tests pass

Files are real, readable, and runnable.

Permission-isolation hypothesis ruled out

All .test.js files have 0600 perms identical to the companion rule .js files:

-rw------- email-escalation.js        → readable by Claude Code ✓
-rw------- email-escalation.test.js   → Glob: No files found ✗, Read: success ✓

Same user, same perms, same directory, different Glob outcome.

Hypothesis on root cause (not a diagnosis; insufficient evidence)

Glob appears to use an index, cache, or traversal that either:

  1. Was built before the session's working directory was fully walked, and is not refreshed on subsequent calls.
  2. Has a path-normalisation bug such that scripts/lib/*.test.js does not resolve even though scripts/lib/*.js resolves in the same session.
  3. Excludes files based on a property that correlates with creation time — recently-created files (same calendar day as session start) are systematically missed.

Evidence is insufficient to discriminate. Every *.test.* and *test* variant failed across all three sessions; every non-test pattern in the same sessions succeeded.

Impact on a live audit (observed)

Session a7877865 (19:26 AEST, which produced the active Phase 2 audit at docs/audit-PHASE-2-AUDIT-2026-04-22.md) trusted the Glob empty result and produced two false verdicts:

  1. Criterion (e) Non-negotiable adherence — FAIL — "Zero of 5 expected per-rule test files exist. This is the most significant gap in the Phase 2 as-shipped deliverable." Actual state: 5 of 5 exist with 236 total assertions.
  1. Criterion (c) Gate 7 reality check — NOT VERIFIED — "No per-rule Gate 7 tests exist. CAS+wx mechanisms are in place but untested under concurrent execution." Actual state: Gate 7 sibling-race tests present in all 4 rule test files using spawnSync (e.g. email-escalation.test.js:228-301).

The audit has since been annotated with a header note (docs/audit-PHASE-2-AUDIT-2026-04-22.md, edit 2026-04-22 20:50 AEST) documenting that these two verdicts are Glob-false-negatives. Verdicts on criteria (a), (b), (d), and (f) did not depend on Glob and stand as written.

Reproduction steps (best effort)

Cannot produce a deterministic repro script without access to Claude Code internals. The pattern observed:

  1. Start Claude Code ACP session (Anthropic Claude Code CLI via OpenClaw acpx plugin).
  2. From within that session, Glob for a pattern matching files created earlier the same calendar day (at least 3 hours prior, in our case).
  3. Observe Glob returns "No files found" even though ls and Read show the files exist with the session user's read permissions.

Cannot yet confirm whether: (a) file age is the trigger, (b) session ordering matters, (c) cwd-vs-absolute-path matters, (d) some other cache-staleness trigger exists.

Mitigation deployed locally (documented for upstream context)

Added a protocol requirement to the audit-brief template mitigation: any audit criterion that asserts absence of files MUST (a) run Glob against the expected pattern, (b) if Glob returns empty AND the criterion would produce FAIL or NOT VERIFIED, fall back to direct Read attempts at the expected absolute paths, (c) cite both Glob result and Read fallback result before claiming absence.

This is a local workaround, not a fix. Upstream repair needed so the tool's primary purpose (find files matching a pattern) does not silently fail on recently-created files.

Related workspace artefacts

  • friday-reaudit-input/2026-04-22-claude-code-glob-false-negative.md — original incident record
  • docs/audit-PHASE-2-AUDIT-2026-04-22.md — audit carrying the two false-negative verdicts with header annotation
  • memory/lessons-learned.md — verifier-coupling pattern entry (6 instances, 2026-04-22; this Glob issue is instance 6)
  • Session transcripts: ~/.claude/projects/-home-alfred--openclaw-workspace-claude/{3ea94610,b123ff71,a7877865}*.jsonl

Related issues (batch)

This issue is filed as part of a batch of related upstream submissions:

  • [#53710] F12-A: Glob tool false-negative on recently-created files — Anthropic Claude Code repo
  • [openclaw/openclaw#72541] F11-C: Gateway completeness check false-negative on pure-relay agents — OpenClaw repo
  • [openclaw/openclaw#72540] Opus 4.7: supportsAdaptiveThinking allowlist missing claude-opus-4-7 — OpenClaw repo
  • [openclaw/openclaw#72539] Sub-B-FAR: Plugin SDK MessagePreSent outbound hook missing — OpenClaw repo

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗