Skip to content

fix(runtime): end Grep options before the pattern in the sandboxed worker - #3734

Open
udsy19 wants to merge 1 commit into
apache:mainfrom
udsy19:fix/worker-grep-pattern-separator
Open

fix(runtime): end Grep options before the pattern in the sandboxed worker#3734
udsy19 wants to merge 1 commit into
apache:mainfrom
udsy19:fix/worker-grep-pattern-separator

Conversation

@udsy19

@udsy19 udsy19 commented Aug 24, 2026

Copy link
Copy Markdown

fix(runtime): end Grep options before the pattern in the sandboxed worker

Summary

The filesystem worker appended the model-supplied Grep pattern as a bare
positional, so ripgrep parsed a pattern starting with - as flags.
-webkit-box exits 1, and packages/runtime/src/filesystem-worker/operations.ts:425
maps exit 1 to { kind: 'grep', matches: [] } — the model is told the string is
absent from a file that contains it, silently.

The host-local sibling already passes -- first
(packages/runtime/src/workspace-executor.ts:455). That separator arrived in
#2961, which edited this worker's grep case in the same commit but left its argv
unchanged, so the two search paths have disagreed since. This propagates it.

Fixes #3733

Verification

Ran locally on macOS 26.5.1 (25F80), Node v26.7.0, ripgrep 15.1.0:

  • npm --workspace @maka/runtime run test:dist — 3090 tests, 0 failures
    (baseline on main was 3089/0; the delta is the new case).
  • Negative control: restored operations.ts from origin/main and rebuilt — the
    new test fails (actual [… '--max-count=50', '-webkit-box', …] vs expected
    ['--', '-webkit-box', …]) while the other 20 cases in the file still pass.
  • npm run lint, npm run format:check, npm run typecheck,
    npm run check:asf-headers — all clean.

Not run: Windows and Linux sandbox surfaces.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code — located the divergence, drafted the one-line fix
and the regression test. Reviewed, reproduced and verified by me before submitting.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

…rker

The filesystem worker appended the model-supplied Grep pattern as a bare
positional, so ripgrep parsed a pattern beginning with `-` as flags. An
option-like pattern such as `-webkit-box` exits 1, which this worker
reports as `{ kind: 'grep', matches: [] }` — the model is told the string
is absent from a file that contains it, with no error anywhere.

The host-local sibling already passes `--` first
(packages/runtime/src/workspace-executor.ts). That separator was added by
its argv unchanged, so the two search paths have disagreed since. The
worker is the default path on macOS and Linux for every boundary except
bypass and external.

Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>
Generated-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(runtime): Grep reports "no matches" for any pattern starting with -

1 participant