Skip to content

Commit acb2543

Browse files
committed
fix: skip pruned tools when counting toward nudge threshold
1 parent 3a77692 commit acb2543

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/state/tool-cache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ const MAX_TOOL_CACHE_SIZE = 500
66

77
/**
88
* Sync tool parameters from OpenCode's session.messages() API.
9-
* This is the single source of truth for tool parameters, replacing
10-
* format-specific parsing from LLM API requests.
119
*/
1210
export async function syncToolCache(
1311
state: SessionState,
@@ -24,6 +22,8 @@ export async function syncToolCache(
2422
continue
2523
}
2624

25+
const alreadyPruned = state.prune.toolIds.includes(part.callID)
26+
2727
state.toolParameters.set(
2828
part.callID,
2929
{
@@ -35,7 +35,7 @@ export async function syncToolCache(
3535
}
3636
)
3737

38-
if (!config.strategies.pruneTool.protectedTools.includes(part.tool)) {
38+
if (!alreadyPruned && !config.strategies.pruneTool.protectedTools.includes(part.tool)) {
3939
state.nudgeCounter++
4040
}
4141

0 commit comments

Comments
 (0)