mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3020] [Issue]: chatResolvedToolNames includes stripped Spotify tools, bypassing the clean 'not allowed' denial #1591
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1591
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3020
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
chatResolvedToolNames(the runtime allow-list) is computed fromtoolDefsBEFORE the Spotify-unavailable filter runs. When Spotify credentials/scope are unavailable, the Spotify tools are removed fromtoolDefs(so the provider is never told about them), butchatResolvedToolNamesstill contains those Spotify tool names. That same set is later used as the runtime allow-list in the chat tool loop to decide which model tool calls are permitted. So a (hallucinated or textual)spotify_*call is treated as permitted and executed, returning a generic "Spotify not configured" error from the tool body instead of the cleaner, intended "Tool not allowed in this context" denial.How to reproduce (try it yourself)
enableTools=true) with noactiveToolIdsfilter sotoolDefsincludes all non-agent-only tools, including thespotify_*tools.user-modify-playback-statescope, sospotifyToolsAvailableis false.spotify_playcall (e.g. via a textual/hallucinated tool call).You'll see:
chatResolvedToolNames.has("spotify_play")is true, so the call is executed and returns{ error: "Spotify not configured..." }, rather than the consistent denial{ error: "Tool not allowed in this context: spotify_play" }.Expected: the runtime allow-list matches the tools actually offered to the provider, so a stripped
spotify_*call hits the clean "not allowed" denial.Where it is
packages/server/src/services/generation/tool-resolution-runtime.ts:538(pre-strip snapshot ofchatResolvedToolNames) and:571-577(toolDefs-only Spotify strip), returned stale at:772. Consumed inpackages/server/src/routes/generate.routes.ts:6411-6424(denial path bypassed). Divergent outcome inpackages/server/src/services/tools/tool-executor.ts:1567-1569(spotifyPlay generic error).What's happening
Ordering bug: the allow-list
chatResolvedToolNamesis snapshotted fromtoolDefsbefore the Spotify-availability filter mutatestoolDefs. The two are meant to be in sync but diverge for stripped Spotify tools.Suggested fix
Recompute
chatResolvedToolNamesfromtoolDefsAFTER the Spotify-unavailable strip. Change line 538 fromconsttolet, then inside the existingif (!spotifyToolsAvailable && toolDefs) { ... }block, after the strip/log:Regression avoided: the recompute must happen INSIDE the
!spotifyToolsAvailableblock (after the strip), NOT before line 548, becauseresolveSpotifyToolAvailabilityRequestat line 548 relies on seeing thespotify_*names in the set to decide credentials are required. Filtering the set before that call would break Spotify availability detection entirely (creds never fetched). Recomputing after the strip leaves the happy path (Spotify available) untouched and the agent Spotify path (which uses its ownallowedToolNames) unaffected; only the chat-loop allow-list is narrowed.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in PR #3021, now merged into staging. The chat tool allow-list is recomputed after unavailable Spotify tools are stripped, so hallucinated spotify_* calls are denied as not allowed instead of executing.