Repository navigation
Conversation
Render an external_directory allow for the runtime tool-output directory after the default ask, globally and per agent. The directory comes from the runtime model, so the adapter hardcodes no container path. Refs #518 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Web workspaces use the directory under the container XDG_DATA_HOME and desktop derives it from its own XDG_DATA_HOME, including the config hash. Refs #518 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Refs #518 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Refs #518 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Refs #518 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
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.
Summary
Fixes #518. On OpenCode V2, unattended flow agent steps hang forever when the agent reads its own spilled tool output. Large tool results are written to
$XDG_DATA_HOME/opencode/tool-output/, which is outside the workspace, so reading them hits the renderedexternal_directory: * -> ask. Because rules are last-match-wins, neitheraccessnor an agent's own rules could allow it.Changes
external_directory: * -> ask, and right after it, both globally and per agent, allow only<toolOutputDirectory>/*.RuntimeConfigModelthe same wayscratchis passed, so the adapter hardcodes no container path:WEB_XDG_DATA_HOME/opencode/tool-output, the same constant now used for the container'sXDG_DATA_HOME;getDesktopXdgDataHome()/opencode/tool-output, the same value that feeds the spawned runtime'sXDG_DATA_HOME.scratch: it must be absolute with no wildcards, and a filesystem root is rejected.Trade-off to confirm
The tool-output folder is shared by every session and agent of the workspace (OpenCode keeps it for about 7 days). With this allow, an agent that has
read/globcan read what another agent's tools returned without an approval prompt. The boundary is still the same user's workspace. OpenCode V1's own defaults allowed this directory, and there is no per-session folder to narrow the rule to. @Inakitajes, please confirm this is acceptable (also asked in #518).Deployment note
The rendered V2 config changes, so every running V2 workspace reports
config-status: pending (config)until it restarts. The fix applies on that restart.Testing
external_directoryrules and atoolsallowlist;pnpm test,pnpm lintandbash scripts/check-podman-images.shpass on the final HEAD.Approval required — external_directory: /home/workspace/.local/share/opencode/tool-output/*. With this fix it runs to completion.🤖 Generated with Claude Code