fix: apply runtime config with external_directory permissions in execute path#3
Merged
Utkarshbhimte merged 1 commit intostagingfrom Mar 27, 2026
Merged
Conversation
…ute path The OpenCode adapter's testEnvironment() prepared a runtime config that grants permission.external_directory=allow via prepareOpenCodeRuntimeConfig(), but the actual execute() path skipped this entirely. This caused agents to fail with auto-rejected external_directory permission requests when reading AGENT_HOME files (HEARTBEAT.md, SOUL.md, TOOLS.md) that sit outside the working directory. Now execute() calls prepareOpenCodeRuntimeConfig() before building runtimeEnv, threads the prepared env through command resolution, model validation, and child process execution, and cleans up the temp config in a finally block.
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
The OpenCode adapter's
testEnvironment()prepared a runtime config that grantspermission.external_directory=allowviaprepareOpenCodeRuntimeConfig(), but the actualexecute()path skipped this entirely.This caused agents to fail with
adapter_failedwhen readingAGENT_HOMEfiles (HEARTBEAT.md,SOUL.md,TOOLS.md) that sit outside the working directory — OpenCode auto-rejected theexternal_directorypermission requests.Fix
prepareOpenCodeRuntimeConfig()inexecute.tsbefore buildingruntimeEnvXDG_CONFIG_HOMEpointing to temp config) through command resolution, model validation, and child process executionfinallyblockTesting