Skip to content

fix: apply runtime config with external_directory permissions in execute path#3

Merged
Utkarshbhimte merged 1 commit intostagingfrom
fix/opencode-execute-runtime-config
Mar 27, 2026
Merged

fix: apply runtime config with external_directory permissions in execute path#3
Utkarshbhimte merged 1 commit intostagingfrom
fix/opencode-execute-runtime-config

Conversation

@Utkarshbhimte
Copy link
Copy Markdown
Collaborator

Problem

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 adapter_failed when reading AGENT_HOME files (HEARTBEAT.md, SOUL.md, TOOLS.md) that sit outside the working directory — OpenCode auto-rejected the external_directory permission requests.

Fix

  • Call prepareOpenCodeRuntimeConfig() in execute.ts before building runtimeEnv
  • Thread the prepared env (with XDG_CONFIG_HOME pointing to temp config) through command resolution, model validation, and child process execution
  • Clean up the temp config directory in a finally block

Testing

  • All existing adapter tests pass (7/7)
  • Typechecks clean

…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.
@Utkarshbhimte Utkarshbhimte merged commit fe39cc0 into staging Mar 27, 2026
@Utkarshbhimte Utkarshbhimte deleted the fix/opencode-execute-runtime-config branch March 27, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant