fix(tool-config): respect question permission from OPENCODE_CONFIG_CONTENT#2230
fix(tool-config): respect question permission from OPENCODE_CONFIG_CONTENT#2230Chocothin wants to merge 1 commit intocode-yeongyu:devfrom
Conversation
…NTENT applyToolConfig() unconditionally set question permission based only on OPENCODE_CLI_RUN_MODE, ignoring the question:deny already configured via OPENCODE_CONFIG_CONTENT. This caused agents to hang in headless environments (e.g. Maestro Auto Run) where the host sets question:deny but does not know about the plugin-internal OPENCODE_CLI_RUN_MODE variable. Read permission.question from OPENCODE_CONFIG_CONTENT and give it highest priority: config deny > CLI run mode deny > default allow.
|
All contributors have signed the CLA. Thank you! ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
[sisyphus-bot] PR Review: Bugfix Verified ✅Bug Analysis: Root Cause (lines 34-35 in original): const isCliRunMode = process.env.OPENCODE_CLI_RUN_MODE === "true";
const questionPermission = isCliRunMode ? "deny" : "allow"; // Ignores config!Fix Verification:
Code Quality:
CI Status: 2/3 passing (CLA ✅, GitGuardian ✅, cubic AI reviewer still running) Merge Conditions:
Recommendation: Ready for approval and merge once reviewed. This fixes a real production issue in headless environments. |
|
@Chocothin I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: The change correctly prioritizes explicit 'deny' from config to fix headless hangs while preserving existing CLI behavior, backed by comprehensive tests.
Summary
applyToolConfig()ignores thequestion: "deny"permission already set viaOPENCODE_CONFIG_CONTENTand unconditionally overrides it based solely on the plugin-internalOPENCODE_CLI_RUN_MODEvariable. This causes agents to hang indefinitely in headless environments (e.g., Maestro Auto Run) where the host correctly setsquestion: "deny"but has no knowledge of the plugin-internal env var.Root Cause
The current logic in
tool-config-handler.ts:This only checks
OPENCODE_CLI_RUN_MODE(set exclusively by oh-my-opencode's ownrun()function insrc/cli/run/runner.ts). Any external caller that setsquestion: "deny"via the standardOPENCODE_CONFIG_CONTENTenv var gets silently overridden to"allow", causing the question tool to block on stdin in headless mode.Causal chain:
OPENCODE_CONFIG_CONTENT='{"permission":{"question":"deny"}}'question: "deny"✅applyToolConfig()runsOPENCODE_CLI_RUN_MODEis not set (host doesn't know about it) →questionPermission = "allow"question: "allow"→ overrides the host's denyFix
Read
permission.questionfromOPENCODE_CONFIG_CONTENTand give it highest priority:Changes
src/plugin-handlers/tool-config-handler.ts: AddedgetConfigQuestionPermission()helper that readsOPENCODE_CONFIG_CONTENTenv var. UpdatedquestionPermissionto check config deny first.src/plugin-handlers/tool-config-handler.test.ts: Added 12 tests covering 4 scenarios × 3 agents (sisyphus, hephaestus, prometheus), with proper env var save/restore.Test Results
Context
"allow")Summary by cubic
Respect OPENCODE_CONFIG_CONTENT.permission.question in applyToolConfig to avoid overriding host settings. This prevents headless hangs (e.g., Maestro Auto Run) by not forcing question: allow.
Written for commit 65bc742. Summary will update on new commits.