fix: seed task runtime home with the worker mise global config - #810
Merged
Conversation
Environment-defined stdio MCP servers (e.g. npx-based) failed to start in sandboxes because the task runtime HOME starts empty: mise shims resolve tool versions from $HOME/.config/mise/config.toml, and worker setup only writes the worker daemon's own home. OpenCode marked the servers "server unavailable / status=failed" (mise: "No version is set for shim: node") whenever no repo-level mise config applied to the spawn cwd. Copy the worker home's global mise config into the runtime home at the HOME-remap point in runTask. Existing runtime-home configs (snapshot resume, agent-written) are left untouched, and seeding is best-effort so it can never break task startup. This also fixes agent bash npx in repos without a pinned node version.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Environment-defined stdio MCP servers (for example
npx -y <mcp-package>) never came up in sandboxes. The config pipeline was fine — the servers reached the OpenCode config — but OpenCode marked themserver unavailable / status=failedabout a second after session create.Root cause:
npx/nodein the sandbox are mise shims, and mise resolves tool versions from the global config at$HOME/.config/mise/config.tomlwhen no repo-level mise config applies to the spawn cwd. The harness, agent bash, and MCP subprocesses all run withHOMEremapped to the per-task runtime home (<workspace>/.roomote-runtime-home), which starts empty — worker setup'smise use -g nodejs@22only writes the worker daemon's own home. So in any environment whose repo doesn't pin a node version, the shim fails instantly:and the MCP server dies before it can speak MCP. The agent just silently never sees its tools.
Fix
Add
seedRuntimeHomeMiseGlobalConfig, called at theHOME-remap point inrunTask: it copies the worker home's.config/mise/config.tomlinto the task runtime home.mise use -gitself).$HOME/.configis the one location that reaches every spawn path. This also fixes agent-bashnpxin repos without a pinned node version.Verification
npx-based MCP server; OpenCode loggedserver unavailable key=<name> type=local status=failed, and running the command in agent bash showed the mise shim error).lint:fast,check-types:fast, andknippass.Notes
vi.mock('../agent-home')needed the new export stubbed (missing mock exports crash the vitest fork via the run-task crash handler).