Skip to content

Comments

fix(run): disable question tool in non-interactive mode#11895

Open
justindra wants to merge 1 commit intoanomalyco:devfrom
justindra:fix/run-question-tool-disabled
Open

fix(run): disable question tool in non-interactive mode#11895
justindra wants to merge 1 commit intoanomalyco:devfrom
justindra:fix/run-question-tool-disabled

Conversation

@justindra
Copy link

@justindra justindra commented Feb 3, 2026

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.

The question tool was still available to the model during `opencode run`
even though session permissions denied it. This caused the run to hang
indefinitely waiting for a response that would never come.

Fixed by passing session permissions to LLM.resolveTools so tools with
deny rules are properly filtered out before being sent to the model.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

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.

opencode run hangs when model attempts to use question tool

1 participant