Skip to content

Glob scans broad path despite a literal pattern prefix #46571

Description

@giampaolocasolla

Description

Glob can appear stuck when path is broad even if pattern starts with known literal directories. For example:

path: /Users/giampaolocasolla
pattern: .claude/plugins/*

On 1.18.25 this traverses the full home directory because path becomes ripgrep's working directory and pattern is only passed as a filter. Narrowing the traversal root to the literal prefix makes the call immediate.

I can contribute a focused fix that extracts safe literal directory prefixes before invoking ripgrep, preserves anchored glob semantics, and adds equivalence tests. Would that direction be acceptable for a PR? Related closed reports: #29437 and #33540.

Plugins

oh-my-opencode-slim, opencode-cmux, and local plugins. The behavior is in the native Glob implementation.

OpenCode version

1.18.25

Steps to reproduce

  1. Run Glob with path set to a large home directory.
  2. Set pattern to a narrow literal prefix such as .claude/plugins/*.
  3. Observe that Glob traverses unrelated directories and can take minutes.
  4. Run the equivalent call with path: /Users/giampaolocasolla/.claude/plugins and pattern: /*; it completes immediately.

Operating System

macOS 26.6.2

Terminal

OpenChamber

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions