[PR #11895] fix(run): disable question tool in non-interactive mode #13975

Open
opened 2026-02-16 18:18:47 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11895

State: open
Merged: No


Fixes #11899

Summary

  • Fixed opencode run hanging when the model attempts to use the question tool
  • The question tool is now properly excluded from the tools list in non-interactive mode

Problem

When running opencode run, if the model tried to use the question tool, it would hang indefinitely because:

  1. run.ts correctly sets session permission rules to deny the question permission
  2. However, LLM.resolveTools only checked agent.permission when filtering disabled tools
  3. Session permissions were ignored, so the question tool remained available
  4. When called, Question.ask() waits forever for a response that never comes

Solution

Updated LLM.resolveTools to merge both agent and session permissions when determining which tools should be disabled.

Changes

  • packages/opencode/src/session/llm.ts: Added sessionPermission to StreamInput type and updated resolveTools to merge it with agent permissions
  • packages/opencode/src/session/prompt.ts: Pass session.permission when calling processor.process()

Verification

Tested locally with bun run dev run "ask me a question using the question tool" - the model no longer attempts to use the question tool.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11895 **State:** open **Merged:** No --- Fixes #11899 ## Summary - Fixed `opencode run` hanging when the model attempts to use the question tool - The question tool is now properly excluded from the tools list in non-interactive mode ## Problem When running `opencode run`, if the model tried to use the question tool, it would hang indefinitely because: 1. `run.ts` correctly sets session permission rules to deny the `question` permission 2. However, `LLM.resolveTools` only checked `agent.permission` when filtering disabled tools 3. Session permissions were ignored, so the question tool remained available 4. When called, `Question.ask()` waits forever for a response that never comes ## Solution Updated `LLM.resolveTools` to merge both agent and session permissions when determining which tools should be disabled. ## Changes - `packages/opencode/src/session/llm.ts`: Added `sessionPermission` to `StreamInput` type and updated `resolveTools` to merge it with agent permissions - `packages/opencode/src/session/prompt.ts`: Pass `session.permission` when calling `processor.process()` ## Verification Tested locally with `bun run dev run "ask me a question using the question tool"` - the model no longer attempts to use the question tool.
yindo added the pull-request label 2026-02-16 18:18:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13975