mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3010] [Issue]: Custom tool can be created with a name that collides with a built-in tool; it is silently dropped with no user-facing error #1583
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#1583
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/3010
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
The create route validates a custom tool's name only against the snake_case regex and against OTHER custom tools (
storage.getByName). It never checks the name against the built-in tool ids (roll_dice,search_lorebook,write_chat_variable,spotify_play,edit_chat_message, etc.). A user can therefore create and enable a custom tool named e.g.roll_dice. The create returns 201, the tool persists, and it appears enabled in the UI. But at generation timeloadToolDefinitions()registers all built-ins first, then iterates enabled custom tools; when a custom tool's name is already registered, it is skipped with only a server-sidelogger.warnandcontinue. The custom tool's executionType/webhookUrl/scriptBody/staticResult are never wired up, so the model only ever invokes the built-in implementation. The user gets a tool that looks active but silently never runs — no error in the API response, no UI feedback. PATCH has the same gap: a valid tool can be renamed to a built-in name and reintroduce the dead tool.How to reproduce (try it yourself)
POST /custom-toolswith{"name":"roll_dice","description":"my custom roller","executionType":"static","staticResult":"hi"}(or create via the Tool Editor with nameroll_dice).getByNamefinds no existing CUSTOM tool namedroll_dice).You'll see: the model's
roll_dicecalls execute the built-in dice roller, never the custom static result. The only trace is a server log:Skipping custom tool "roll_dice" because it collides with existing built-in tool.Expected: the create (and rename) is rejected with a clear error explaining the name is reserved.
Where it is
packages/server/src/routes/custom-tools.routes.ts:30-42(POST create) and:44-56(PATCH, which also never re-checks the name); silent skip atpackages/server/src/services/generation/tool-resolution-runtime.ts:292-302. Supporting: regex-only validation atpackages/shared/src/schemas/custom-tool.schema.ts:8-13;getByNamescoped to the custom-tools table atpackages/server/src/services/storage/custom-tools.storage.ts:30-33; the 17 built-ins atpackages/shared/src/features/function-calls/tool-registry.generated.ts:23-41.What's happening
Name-uniqueness enforcement at create/update time only covers custom tools, not the reserved built-in namespace.
BUILT_IN_TOOLS(importable from@marinara-engine/shared) is never consulted in the route or storage layer. The downstream resolver treats the collision as a non-fatal skip (continue+logger.warn) rather than surfacing it, so the misconfiguration is invisible.Suggested fix
Reject custom-tool names that collide with any reserved built-in tool id, on BOTH create and rename, surfacing a 409 the UI already displays.
BUILT_IN_TOOLSincustom-tools.routes.ts:The
api-clientthrowsApiError(status, body.error)on non-OK andToolEditorsurfaceserr.message, so the message becomes visible UI feedback. No schema/client changes needed.Regression avoided: the original suggested fix patched POST only, leaving PATCH-rename able to reintroduce the exact dead tool — the corrected fix closes both. Do NOT additionally import
AGENT_ONLY_TOOL_NAMES: it is a private const intool-resolution-runtime.ts(not exported, would fail to compile) and is redundant since all six agent-only names are already inBUILT_IN_TOOLS. The change is an additive validation gate that never touches execution paths and only rejects names matching one of the reserved built-in ids.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in merged staging PR #3018.