fix(runtime): pass option-like Grep patterns after a -- separator - #3903
Conversation
ripgrep parsed a pattern beginning with `-` as flags, so the worker returned exit 1 and the caller mapped it to an empty match list. Mirror workspace-executor.ts, which already separates the pattern with `--`. Generated-by: Claude
Assert the `--` separator reaches runGrep, mirroring the existing workspace-executor coverage. Generated-by: Claude
7a70dbc to
7e7521c
Compare
|
Relationship note: PRs #3734, #3735, and #3903 all close #3733, touch the same two runtime files, and apply the same This comment records the relationship only; it is not a merge decision. Automated review note posted by @未开智选手. This is not an independent human review; a human should verify the conclusion. |
M4n5ter
left a comment
There was a problem hiding this comment.
I reviewed exact head 7e7521c2fc6a6ac90e664da292d7f1fc56f6de07 and found no P0–P3 issues.
This fixes the root cause rather than masking the result: the user-controlled pattern now follows ripgrep's -- option terminator, so a leading dash cannot be parsed as flags before the existing exit-code mapping runs. It also removes the behavioral divergence from the host-local executor without adding a parser, state, or another execution path.
I compared the equivalent fixes in #3734 and #3735. I selected this version because its regression pins the complete terminal argv contract (['--', pattern, path]) and the full worker response with the smallest production patch. Removing only the separator made that regression fail; restoring it passed, as did all 21 filesystem-worker tests. A direct ripgrep 15.2.0 check reproduced exit 1/no output without -- and the expected matches with it. The current-main merge tree is clean and preserves the reviewed two-file patch.
Posted by an automated review agent operated by @M4n5ter. This is not an
independent human review and does not satisfy the committer review required by
CONTRIBUTING.md. A human is accountable for this comment — please push back if
anything here is wrong.
简体中文
本条评论由 @M4n5ter 运行的自动化审查程序发出。它不构成 CONTRIBUTING.md
所要求的独立人类审查,也不能替代人类审查。有人类对本条评论负责,如有错误请直接指出。
Summary
The sandboxed filesystem worker appended the Grep pattern as a bare positional, so ripgrep parsed a pattern starting with
-as flags.-webkit-boxmade rg exit 1, whichoperations.tsmaps to{ kind: 'grep', matches: [] }— the model was told the string is absent from a file that contains it, with no error and no diagnostic.The host-local sibling already handles this at
workspace-executor.ts:455; this change mirrors it in the worker.Fixes #3733
Verification
Confirmed the underlying behaviour against ripgrep directly:
Ran locally against
packages/runtime:npm --workspace @maka/core run build,@maka/storage,@maka/runtime— all cleannode --test dist/__tests__/filesystem-worker.test.js— the new test passes; pass count goes 19 -> 20 with no new failuresbiome lintandbiome formaton both changed files — cleanNot run: the full workspace suite and the desktop app. This sandbox could not complete a root
npm install(the registry mirror blocks@xterm/xterm, and the Electron postinstall cannot reach its download host), so only thecore/storage/runtimeworkspaces were built and exercised.One pre-existing failure in that file —
reports no diff — not a new-file diff — when an existing file cannot be read— fails on unmodifiedmainin this environment too, because the test runs as root andchmod 000does not deny root. Unrelated to this change.AI use
Select exactly one:
Tool(s) and scope: Claude (Anthropic) — drafted the one-line fix and the regression test, and ran the local verification above. Reviewed and submitted by me.
Generated-by: Claudetrailers are on both commits.Checklist
Does this PR entail a change in behavior?