anomalyco / anomalyco/opencode
shell: absolute Unix socket arguments fail during realPath advisory scan
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
The V2 shell tool fails before executing commands that contain an absolute path to a live Unix-domain socket. The best-effort command-argument advisory scan surfaces Unknown: FileSystem.realPath (...) as a fatal tool error.
Environment
- opencode version:
0.0.0-next-16076 - OS: Darwin 25.5.0, arm64
- Terminal: WarpTerminal,
TERM=xterm-256color,COLORTERM=truecolor - Shell:
/bin/zsh - Install/channel:
next, managed service healthy on the same version - Active plugins:
cmux-feed.js,cmux-session.js,voice.ts
Reproduction
-
Create a live Unix-domain socket:
ruby -rsocket -e 's=UNIXServer.new(%q[/tmp/opencode-realpath-live.sock]); sleep 60' -
While the socket is live, invoke the V2 shell tool with any command containing its absolute path:
printf '%s\n' /tmp/opencode-realpath-live.sock -
Observe that the shell command is not executed and the tool fails.
Expected Behavior
The shell command executes. Because command-argument path scanning is documented as best-effort and advisory, an unusual filesystem node should emit at most an external-directory warning and must not fail the command.
Actual Behavior
The shell tool fails before execution:
Unknown: FileSystem.realPath (/tmp/opencode-realpath-live.sock)
This reproduces consistently for a live Unix-domain socket. The identical printf command succeeds after the socket node disappears and emits only the normal external-directory advisory.
Additional Context
This was first encountered while sending a command to a local application over a Unix socket:
cargo run -q -p cutmanctl -- --socket /tmp/cutman-media.sock seek /tmp/cutman-fixture.mp4 2500 --base-revision 0
The failure appears to be in the advisory scanner rather than command execution:
packages/core/src/tool/shell.tstokenizes absolute command arguments and passes each throughFSUtil.resolveinexternalCommandDirectories.packages/util/src/fs-util.tscallsfs.realPathand recovers only fromPlatformErrorwith reasonNotFound.- On this system,
realPathagainst a live Unix-domain socket returns anUnknownfilesystem error, which escapes the supposedly advisory scan and aborts the shell tool.
A likely fix is to make argument-path canonicalization fully best-effort: preserve the lexically resolved path when realPath fails for any filesystem-node type, while retaining stricter resolution for actual shell working-directory authorization.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/core/src/tool/shell.ts at externalCommandDirectories and follow its FSUtil.resolve calls into packages/util/src/fs-util.ts. Reproduce with a live Unix socket and the printf command, then verify that argument scanning remains advisory: the command executes and only the normal external-directory warning appears.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100