Repository navigation
fix(core): show function and reload errors in dev, and real errors over MCP - #602
Merged
Merged
Conversation
…er MCP dev (and serve --debug-errors) now writes a function_error line to stderr with the route, source file, export, thrown message and stack behind a trusted function's generic 502/504, and a reload_rejected line carrying the message validate prints. The response body, JSON event log and observers are unchanged. Function load failures name the file, line, export and loader message. A binding or egress denial caused by a policy pinned to an older projectSha256 says so and points at `urlcode permissions`. The MCP server returns the CLI's message for failed tools, names unknown tools and bad or missing arguments in -32602, leaves get_extensions out of plan_feature's next list without a host file, matches explain_error on the supplied text, and echoes a supported requested protocol version. Closes #580 Closes #582 Refs #590 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Report project-relative sources with forward slashes, parse node --check output with CRLF line endings, and call a syntax error nested only when the entry file itself parses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # llms-full.txt
# Conflicts: # llms-full.txt
# Conflicts: # llms-full.txt
jimhoyd
enabled auto-merge (squash)
September 24, 2026 01:13
# Conflicts: # llms-full.txt # packages/core/src/feature-plan.ts
# Conflicts: # llms-full.txt # packages/core/src/cli.ts # packages/core/src/mcp.ts # packages/core/src/policy.ts # packages/core/src/router.ts
…uard, and update stale test expectations - router.ts: the pinned-policy binding-denial messages (#602) now combine with #607's grantHint wording instead of dropping the pin-specific explanation; the pin case takes priority since it fully explains the denial on its own. - config.ts: safeFile no longer names a reference that looks like a path traversal attempt (a '..' segment), fixing a regression #607 introduced and #602 exposed (issue #610) — MCP's validate tool now surfaces the CLI's real error text (#582), which would otherwise turn an escaping function/middleware source reference into a filesystem oracle. A plain in-project typo is still named, matching #607's own authoring-errors test. - test/dev-diagnostics.test.ts, test/mcp.test.ts: two assertions predated #607's route-name and file:line:column prefixes and #581's friendlier multiple-handlers message; updated to match the now-current, improved text rather than reverting the improvement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 24, 2026
jimhoyd
added a commit
that referenced
this pull request
Sep 24, 2026
…es (#590) (#633) Implements the remainder of #590 (protocol negotiation already landed in #602): rename ambiguous/inconsistent MCP tool names to a verb-first vocabulary (capabilities->list_capabilities, import_preview->preview_import, export_preview->preview_export, recipes_list->list_recipes, recipes_show->get_recipe, review_project->review, matching CLI `urlcode review`), keeping every pre-#590 name working as a deprecated alias with its own "Deprecated alias for ..." description in tools/list. Fix the `target` ambiguity (a route path in `explain` vs. a deployment target elsewhere) by introducing `deployTarget` as the canonical argument on inspect, list_capabilities, get_context, plan_feature and review, with the old `target` argument still accepted (deprecated) on those tools. get_context is now first in tools/list, matching its documented role as the first call. Every successful tools/call reply also carries structuredContent mirroring the JSON already in its text content. Add a read-only run_tests tool that runs tests/requests.json fixtures the way `urlcode test` does, reusing runProjectTests against a disposable server/data directory; it never writes a project file. list_skills/get_skill now return the real canonical inventory of all three shipped skills (skills/urlcode, .claude/skills/urlcode-authoring, .claude/skills/urlcode-operations) with each skill's own SKILL.md frontmatter description, read at call time so the inventory cannot drift from the skill it describes. Align llms.txt's skill list and llms-full.txt guidance (reconciled to: search_docs/get_context first, llms-full.txt only as a by-heading fallback, never a whole-file read or grep) accordingly, and update docs/TOOLING.md and docs/RECIPES.md to the canonical names and alias/ structuredContent/run_tests behavior. Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #580
Closes #582
Refs #590 (protocol-version negotiation only; the naming,
structuredContentand skills items need a separate decision)What changes
Dev diagnostics (#580)
urlcode devwrites afunction_errorJSON line to stderr for a trusted function's generic 502/504:requestId,status, matchedroute, project-relativesource,export, thrownmessageandstack. A handler's error keeps naming the handler as it bubbles out through middleware; the thrown value is not replaced, so middleware that catches it still sees the original. Shape failures (non-Response, bad status, changed native header, header/body limits, missing export) now carry a reason too.urlcode serve --debug-errorsturns on the same diagnostics. It is off by default, allowed only onserve, and rejected elsewhere.ServerOptions.debugErrors/diagnostics, stderr by default). They never reach the response body, the JSON event log or observers, so the documented guarantee that the event log carries no exception text still holds.HttpErrornow acceptsErrorOptions, so the reason travels ascause.{"event":"reload","status":"rejected"}, and also writesreload_rejectedto stderr with the messageurlcode validateprints (shareddescribeError, moved from the CLI intoerrors.ts).Function initialization failed in f.mjs:3 (export default): SyntaxError: Unexpected token ';'. Node 26 gives an ESM syntax error no location, so only on that failure path the runtime runsnode --check(parse only) on the entry file. A syntax error inside an imported module is reported as, in a module it imports.projectSha256now print both revisions and point aturlcode permissions. There is no auto-repin.sandbox: true) path is untouched.FunctionPool/function-worker.tsdid not change, and sandboxed failures still report only the generic answer.MCP (#582, #590)
get_capabilitynames), notOperation failed validation.-32602now names the unknown tool (and the flag that addsget_extensionsor the authoring tools), each unknown, missing or invalid argument (using ajvallErrors), and the arguments the tool accepts.plan_featureleavesget_extensionsout ofnext. The CLIplan-featurefollows the same rule.explain_errormatches ordered rules against the runtime's error families and returnsmatched,guidance,nextToolsand, for a schema error, the decodedlocation. Unmatched text getsmatched: nulland a pointer tosearch_docs.initializeechoes a requestedprotocolVersionit supports (2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05) and otherwise answers 2025-11-25.Docs updated: LOCAL-DEVELOPMENT (troubleshooting), TOOLING (MCP errors/negotiation), OBSERVABILITY and MONITORING (the diagnostics are not events), OPERATIONS (
--debug-errors), FUNCTION-SECURITY (stale pin message), the RUNTIME-IMPLEMENTATION RIM-GUEST-001 card, and regenerated llms-full.txt.Evidence
test/dev-diagnostics.test.ts(7 tests) covers the function_error content and a generic body, handler attribution through middleware, silence without the flag, reload_rejected matchingcreateRuntime's message, the stale-pin message, init failures (syntax line, top-level throw line, missing export, nested syntax error, unresolved package), and CLIvalidateoutput plus the--debug-errorsguard.test/mcp.test.tshas two new tests: protocol negotiation, and real tool errors, named tools and arguments,nextwithout a host, andexplain_errormatching.npm run verifypasses locally and so doesnpm run test:package.Limitations
🤖 Generated with Claude Code