mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3016] [Issue]: Webhook/script tools can be saved with a blank URL/body — the editor lets you save a broken tool #1587
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#1587
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/3016
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
handleSavevalidates only name, description, and the script-enabled capability. It never requires that awebhooktool actually has awebhookUrl, or that ascripttool has ascriptBody. Because the payload coerces a blank field to null (localExecType === "webhook" ? localWebhookUrl || null : null) and the persistence Zod schema acceptswebhookUrl: z.string().url().nullable()(null is valid), a user can select Webhook, leave the URL empty, and Save succeeds with no error. The tool is then enabled and selectable, but every invocation returns{ error: "No webhook URL configured" }. The same gap exists for script tools (empty body →{ error: "No script body configured" }). The editor's Unsaved/Saved UI gives no indication the tool is non-functional.How to reproduce (try it yourself)
call_api) and a description.You'll see: the save succeeds (payload
webhookUrlbecomes null;z.string().url().nullable()accepts null), the "Saved" flash shows, and the tool persists as enabled. When the model calls it, the tool result is{ error: "No webhook URL configured" }every time, with no warning given at edit time.Expected: Save is blocked with a clear error ("Webhook URL is required." / "Script body is required.") when the required field for the chosen execution type is empty.
Where it is
packages/client/src/components/agents/ToolEditor.tsx:157-184(handleSavevalidation + payload). Supporting: nullable schema accepting null atpackages/shared/src/schemas/custom-tool.schema.ts:17,19; no per-type guard in the route atpackages/server/src/routes/custom-tools.routes.ts:30-56; runtime errors atpackages/server/src/services/tools/tool-executor.ts:305("No webhook URL configured") and:341("No script body configured").What's happening
Per-execution-type required-field validation is missing in the client.
handleSaveguards name/description/script-enabled but not the execution-type-specific required field. The blank value is silently turned into null by thelocalWebhookUrl || nullcoercion, and the server schema treats nullwebhookUrlas valid (it must, since non-webhook tools legitimately have null), so neither layer rejects the empty case.Suggested fix
In
handleSave, add two required-field guards immediately after the existing script-enabled check (before theconst payload = {):Each guard is its own braced
if-block with its ownreturn, so it only fires for the matching execution type.Regression avoided: do NOT add a
staticResultrequirement — a blank static result is valid and the executor returns the default "OK" (tool-executor.ts:302). Write each guard as a separate braced block; the original one-line form (if (cond) setSaveError(...); return;) would make thereturnexecute unconditionally for every execution type, blocking ALL saves. Editing an existing valid webhook/script tool still saves (the field is populated), and server-side URL-format validation is untouched.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.