You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Totoro-qaq (via GitHub)" <gi...@apache.org> on 2026/09/10 16:36:49 UTC
[PR] fix(runtime): name ripgrep when Grep cannot run it [maka]
Totoro-qaq opened a new pull request, #5169:
URL: https://github.com/apache/maka/pull/5169
## Summary
Without ripgrep, every Grep call on the local path failed with a bare `spawn rg ENOENT`, and the filesystem worker said only "Grep is unavailable in this runtime." Both paths now fail with `grep_unavailable` and a message that names ripgrep, gives a platform install command and the official install page. The local path looks `rg` up on every call, so it says to retry; the worker resolves ripgrep once when the runtime starts, so it says to restart Maka.
Two cases needed more than new copy:
- Node reports a missing spawn `cwd` exactly like a missing executable (`spawn rg ENOENT` both ways). The local path only blames ripgrep after confirming the cwd still exists; a deleted session directory keeps its original error.
- The worker pins ripgrep's realpath at startup. If that file disappears later, for example when `brew upgrade` removes the old keg, the spawn `ENOENT` was normalized to `not_found` ("The requested path was not found.", marked recoverable), which reads as a missing search path. The worker runs `rg` from the filesystem root, so that `ENOENT` now maps to `grep_unavailable` with the stale path and a restart hint.
Exit code 1 still means no matches, and `EACCES`, timeouts and other spawn errors keep their current handling. The Windows sandbox refusal is unchanged. Shipping ripgrep with the product (Phase 2 in the issue) is out of scope.
Fixes #5167
Thanks to @colaforniaw for the analysis and the phased plan in the issue.
## Verification
Local macOS arm64, Node 22.23.1, dependencies installed with npm 11.19.0:
- Runtime suite (`test:dist`): 3,411 tests, 3,398 passed, 13 skipped, 0 failed.
- Five new tests in `workspace-executor.test.ts` and `filesystem-worker.test.ts`. On `main` the three conversion tests fail (`ENOENT`, `not_found`, and the old copy). The two guards, missing cwd keeps `ENOENT` and a non-executable `rg` keeps `EACCES`, pass on both; removing the cwd check makes the missing-cwd guard fail.
- The pre-push checks from CONTRIBUTING pass: `npm run lint`, `npm run format:check`, `npm run build` (all workspaces), `npm run typecheck`, and knip for `apps/desktop` and `packages/ui`. The ASF header check and `git diff --check` pass too.
Local path with no `rg` on `PATH`:
```
RipgrepUnavailableError [grep_unavailable]: Grep requires ripgrep (`rg`), which was not found on PATH. Install it with `brew install ripgrep`, or see https://github.com/BurntSushi/ripgrep#installation. Then retry.
```
Not run locally: Linux, Windows, and the suites of the workspaces downstream of runtime. CI covers them for this diff: `scripts/ci-test-plan.mjs` selects the runtime, eval, computer-use, cli, desktop and runtime-host suites plus the Linux sandbox smoke, and the `filesystem-worker/**` path filter triggers the Windows sandbox workflow. The packaged desktop app was not exercised.
## AI use
- [ ] No generative tool made a substantive contribution
- [x] Generative tooling made a substantive contribution
Tool(s) and scope: Claude Code investigated the defect, authored the implementation and regression tests, ran local verification, and prepared the contribution drafts. Submitted with contributor approval.
## Checklist
- [x] Tests cover the change and fail without it
- [x] Lint, format, typecheck and the affected suites pass locally
Does this PR entail a change in behavior?
- [x] Yes — described under Summary above
- [ ] No
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(runtime): name ripgrep when Grep cannot run it [maka]
Posted by "Totoro-qaq (via GitHub)" <gi...@apache.org>.
Totoro-qaq commented on code in PR #5169:
URL: https://github.com/apache/maka/pull/5169#discussion_r3995422233
##########
packages/runtime/src/ripgrep-guidance.ts:
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Grep's only engine is ripgrep, and nothing ships it (#5167). These builders
+ * keep the missing-ripgrep copy identical on the local executor and the
+ * filesystem worker, so the model and the user learn the same fix whichever
+ * path ran the search. The Windows sandbox refusal deliberately stays in the
+ * worker: that is a capability limit of the AppContainer, not a missing
+ * dependency.
+ */
+
+const RIPGREP_INSTALL_URL = 'https://github.com/BurntSushi/ripgrep#installation';
+
+function ripgrepInstallHint(platform: NodeJS.Platform): string {
+ const command =
+ platform === 'darwin'
+ ? '`brew install ripgrep`'
+ : platform === 'win32'
+ ? '`winget install BurntSushi.ripgrep.MSVC`'
+ : 'your package manager (for example `apt install ripgrep`)';
+ return `Install it with ${command}, or see ${RIPGREP_INSTALL_URL}.`;
+}
+
+/** The local executor looks `rg` up on PATH at every call, so a retry suffices. */
+export function ripgrepMissingOnPathMessage(platform: NodeJS.Platform = process.platform): string {
+ return `Grep requires ripgrep (\`rg\`), which was not found on PATH. ${ripgrepInstallHint(platform)} Then retry.`;
+}
+
+/** The worker resolves ripgrep once, when the runtime starts. */
+export function ripgrepMissingAtStartupMessage(
+ platform: NodeJS.Platform = process.platform,
+): string {
+ return `Grep requires ripgrep (\`rg\`), but no usable copy was found when Maka started. ${ripgrepInstallHint(platform)} Then restart Maka.`;
+}
+
Review Comment:
Thanks, agreed. Restart was the wrong recovery, especially for a Host that outlives Desktop. Addressed in ebc6df0:
- The launch configuration keeps a resolved ripgrep while the same file is still there, and looks it up again on the next launch when it was missing, has disappeared, or was replaced in place, with the same executable check and macOS dependency-root inspection. Installing ripgrep and retrying now recovers in the same running Host, and the sandbox only grants the copy that was found. Inspection results are kept per file identity, so an unchanged binary that can't be granted doesn't run `otool` on every launch.
- The guidance says where to install it: the WSL distribution when `WSL_DISTRO_NAME` is set, otherwise the machine the Host runs on, noting that for a remote Host that is the server rather than this computer. I left the hostname out on purpose: this text goes to the model as tool output, a default macOS hostname carries its owner's name, and Maka otherwise only uses it as a device name in Desktop, which already shows the active Host.
- On Windows the winget Links directory is also a candidate, because a running Host keeps the PATH it started with.
- Tests cover both transitions you asked for (missing → installed → the next launch finds it; a pinned copy removed with a replacement elsewhere), plus a copy reinstalled in place. Each fails if its re-resolution is removed.
One thing is unchanged: the local executor still looks `rg` up on the Host's own PATH, so an install into a directory that PATH doesn't include is only picked up once the Host sees the new PATH.
Could you take another look when you have a moment?
_Changes made with Claude Code; I reviewed and ran them._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(runtime): name ripgrep when Grep cannot run it [maka]
Posted by "me2seeks (via GitHub)" <gi...@apache.org>.
me2seeks commented on PR #5169:
URL: https://github.com/apache/maka/pull/5169#issuecomment-5652042972
Relationship to #5246: #5246 incorporates this PR's missing-ripgrep recovery work while preserving its authorship, and adds per-Grep dependency resolution. It is standalone against `main`. If #5246 merges first, this PR is superseded; please do not merge both.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(runtime): name ripgrep when Grep cannot run it [maka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5169:
URL: https://github.com/apache/maka/pull/5169#issuecomment-6137964008
<!-- maka-lifecycle:stale-warning -->
This pull request has had no new commits for 30 days and has been marked stale. It will be closed in 7 days unless a new commit is pushed.
Comments do not reset this timer: only a new commit does. If the pull request is intentionally long-lived, a maintainer can apply the `pinned` label.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(runtime): name ripgrep when Grep cannot run it [maka]
Posted by "Totoro-qaq (via GitHub)" <gi...@apache.org>.
Totoro-qaq commented on PR #5169:
URL: https://github.com/apache/maka/pull/5169#issuecomment-6138652938
Superseded by #5246, which landed this missing-ripgrep handling on `main`. Closing. Thanks @me2seeks for carrying it over!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(runtime): name ripgrep when Grep cannot run it [maka]
Posted by "Totoro-qaq (via GitHub)" <gi...@apache.org>.
Totoro-qaq closed pull request #5169: fix(runtime): name ripgrep when Grep cannot run it
URL: https://github.com/apache/maka/pull/5169
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(runtime): name ripgrep when Grep cannot run it [maka]
Posted by "me2seeks (via GitHub)" <gi...@apache.org>.
me2seeks commented on code in PR #5169:
URL: https://github.com/apache/maka/pull/5169#discussion_r3995262277
##########
packages/runtime/src/ripgrep-guidance.ts:
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Grep's only engine is ripgrep, and nothing ships it (#5167). These builders
+ * keep the missing-ripgrep copy identical on the local executor and the
+ * filesystem worker, so the model and the user learn the same fix whichever
+ * path ran the search. The Windows sandbox refusal deliberately stays in the
+ * worker: that is a capability limit of the AppContainer, not a missing
+ * dependency.
+ */
+
+const RIPGREP_INSTALL_URL = 'https://github.com/BurntSushi/ripgrep#installation';
+
+function ripgrepInstallHint(platform: NodeJS.Platform): string {
+ const command =
+ platform === 'darwin'
+ ? '`brew install ripgrep`'
+ : platform === 'win32'
+ ? '`winget install BurntSushi.ripgrep.MSVC`'
+ : 'your package manager (for example `apt install ripgrep`)';
+ return `Install it with ${command}, or see ${RIPGREP_INSTALL_URL}.`;
+}
+
+/** The local executor looks `rg` up on PATH at every call, so a retry suffices. */
+export function ripgrepMissingOnPathMessage(platform: NodeJS.Platform = process.platform): string {
+ return `Grep requires ripgrep (\`rg\`), which was not found on PATH. ${ripgrepInstallHint(platform)} Then retry.`;
+}
+
+/** The worker resolves ripgrep once, when the runtime starts. */
+export function ripgrepMissingAtStartupMessage(
+ platform: NodeJS.Platform = process.platform,
+): string {
+ return `Grep requires ripgrep (\`rg\`), but no usable copy was found when Maka started. ${ripgrepInstallHint(platform)} Then restart Maka.`;
+}
+
Review Comment:
[P2] Make retry refresh the worker's ripgrep configuration
"Then restart Maka" does not reliably recover this failure for Desktop users. `createFilesystemWorkerLaunchSpecProvider` caches its first resolution, including an absent ripgrep or a pinned executable path. Installing ripgrep after that resolution does not refresh the cached worker configuration. Desktop quit only retires its owned ephemeral local Host; a separately managed or remote/WSL Host can remain running when the user restarts Desktop.
Please prefer an **install, then retry** recovery path: when ripgrep is unavailable or its resolved executable has disappeared, allow a subsequent attempt to re-resolve it in the task's execution environment and rebuild the relevant worker launch configuration. Preserve executable inspection and sandbox dependency-root validation when refreshing it. Keep successful configuration caching if appropriate, and avoid restarting the entire service merely to refresh dependency discovery.
The guidance should identify the execution environment (local machine, WSL distribution, or SSH server) so users know where to install the dependency without needing to understand Host lifecycle ownership.
Please cover both transitions: initially missing rg → installed → retry succeeds, and pinned rg removed/replaced → retry resolves the replacement. They should recover within the same running Host without broadening sandbox access.
<details>
<summary>中文</summary>
“重启 Maka”在 Desktop 场景下不一定能恢复:worker 的启动配置会缓存首次检测结果,包括未找到 rg 或已经固定的 rg 路径。安装后重试仍会使用该缓存。Desktop 退出只负责停止自己拥有的临时本地 Host;独立服务或远程/WSL Host 可能在重启 Desktop 后继续运行。
建议优先支持 **安装后重试**:rg 不可用或原执行路径消失时,让后续尝试在任务实际执行的环境重新检测 rg,并重建相关 worker 启动配置。刷新时仍需执行可执行文件检查和沙箱依赖路径验证,可以保留正常情况下的配置缓存。避免仅为刷新依赖检测而重启整个服务、影响其他任务。
提示应指出安装位置,例如本机、具体 WSL 发行版或 SSH 服务器,让用户无需理解 Host 生命周期。
建议覆盖两条恢复测试:首次缺少 rg → 安装 → 重试成功;固定的 rg 被删除或替换 → 重试找到新路径。两者都应在同一个运行中的 Host 内恢复,并保持沙箱边界。
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org