Skip to content

The open-source app everyone uses to manage agents at work

Move OPENCODE_DISABLE_PROJECT_CONFIG after envConfig loop

Devin Foley1549799c1e1f
diff --git a/packages/adapters/opencode-local/src/server/execute.ts b/packages/adapters/opencode-local/src/server/execute.ts
index d39c379503..788ad835e4 100644
--- a/packages/adapters/opencode-local/src/server/execute.ts
+++ b/packages/adapters/opencode-local/src/server/execute.ts
@@ -128,10 +128,6 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
const hasExplicitApiKey =
typeof envConfig.PAPERCLIP_API_KEY === "string" && envConfig.PAPERCLIP_API_KEY.trim().length > 0;
const env: Record<string, string> = { ...buildPaperclipEnv(agent) };
- // Prevent OpenCode from writing an opencode.json config file into the
- // project working directory (which would pollute the git repo). Model
- // selection is already handled via the --model CLI flag.
- env.OPENCODE_DISABLE_PROJECT_CONFIG = "true";
env.PAPERCLIP_RUN_ID = runId;
const wakeTaskId =
(typeof context.taskId === "string" && context.taskId.trim().length > 0 && context.taskId.trim()) ||
@@ -173,6 +169,11 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
for (const [key, value] of Object.entries(envConfig)) {
if (typeof value === "string") env[key] = value;
}
+ // Prevent OpenCode from writing an opencode.json config file into the
+ // project working directory (which would pollute the git repo). Model
+ // selection is already handled via the --model CLI flag. Set after the
+ // envConfig loop so user overrides cannot disable this guard.
+ env.OPENCODE_DISABLE_PROJECT_CONFIG = "true";
if (!hasExplicitApiKey && authToken) {
env.PAPERCLIP_API_KEY = authToken;
}