Repository navigation
Commit 0c4f198
fix: filter question tool and respect session permissions in non-interactive mode
The question tool bypassed the permission pipeline by calling Question.ask()
directly without going through ctx.ask(). Combined with LLM.resolveTools()
only consulting agent-level permissions (where the build agent explicitly
allows question), this caused opencode run to hang indefinitely when the
model invoked the question tool (anomalyco#11899).
Three changes fix this:
1. LLM.resolveTools() now accepts session-level permissions and merges them
with agent permissions when computing disabled tools, so session rules
like question:deny actually filter the tool from the tool list.
2. SessionPrompt passes the session's permission ruleset through to the
LLM layer via the new StreamInput.permission field.
3. The question tool now calls ctx.ask() before Question.ask(), so even if
the tool isn't filtered out, the permission pipeline is consulted. On
denial, it returns a helpful message instead of hanging.
Refs anomalyco#11899
Co-Authored-By: Claude Opus 4.6 <[email protected]>1 parent a41c81d commit 0c4f198
3 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
255 | 256 | | |
256 | 257 | | |
257 | 258 | | |
258 | | - | |
259 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
260 | 264 | | |
261 | 265 | | |
262 | 266 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
| 677 | + | |
677 | 678 | | |
678 | 679 | | |
679 | 680 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
12 | 26 | | |
13 | 27 | | |
14 | 28 | | |
| |||
0 commit comments