Repository navigation
fix(runtime): MCP run_action answers a declared action with no handler as /actions does, 404 RESOURCE_NOT_FOUND - #31408
Conversation
… answers The MCP bridge threw a declared action with no handler as an uncoded "No handler registered" error, which run_action answered as the /actions reader's 400 VALIDATION_ERROR rejection. It now throws the routing miss REST /actions answers: its sentence, 404 and RESOURCE_NOT_FOUND. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pVLKxR5eAhTYetnwR
…ndOne fake Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pVLKxR5eAhTYetnwR
📓 Docs Drift Check1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 28 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 87627839733e4f334395ee48ff06244dc21f9d44 && git checkout 87627839733e4f334395ee48ff06244dc21f9d44
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 3a0aa915ae0e3838e93beace25bf14d116f3f596 f841c43e2d88f4846028f9c18552e9b4c8c80076 && git checkout -B drift-repro 3a0aa915ae0e3838e93beace25bf14d116f3f596 && git merge --no-ff f841c43e2d88f4846028f9c18552e9b4c8c80076
node scripts/docs-audit/affected-docs.mjs --json 3a0aa915ae0e3838e93beace25bf14d116f3f596 |
|
domain:server#6 · os-project-manager · session_01FEkQ5p3T5YWhLjurajudnQ 席位核对 · ACCEPT · 2026-11-08T06:45Z · head
|
Requested by Leehom · project thread
domain:server#6 · os-project-manager · session_01FEkQ5pVLKxR5eAhTYetnwR
Fixes #31330
Clause-②: no
Metadata-protocol: none
维护者速读
Error('No handler registered …')。现在改为抛出/api/v1/actions自己回答的那个路由未命中:同一句Action 'X' on object 'Y' not found,404,RESOURCE_NOT_FOUND。run_action通过/actions的同一个 reader(actionsDoorAnswerOf)作答,不带 code 的抛错被当成400 VALIDATION_ERROR,等于告诉 agent 它的输入有错。而 REST 对同一个动作回404。action-execution.ts)。只有 MCP 的 bridge 能走到这里,REST 及其它门的回答不变(runtime 全量绿,/actions的 pin 都没改)。MCP 为这个未命中写的action_invocation行也随之变成404/RESOURCE_NOT_FOUND,与 REST 写的那行一致。回滚即 revert。patch。packages/runtime/src/action-execution.ts中!dispatch.dispatched那段;新测试packages/runtime/src/mcp-run-action-ghost-routing-miss.test.ts。pnpm --filter @objectstack/runtime exec vitest run src/mcp-run-action-ghost-routing-miss.test.ts,预期 6 条全绿。What changes
@objectstack/runtimeaction-execution.ts. When the MCP bridge (invokeBusinessAction→dispatchAdmittedBusinessAction) finds no handler for a declared script action, it now throws the routing miss as REST/actionsanswers it from its routing-miss branch (domains/actions.ts). The sentence isAction 'X' on object 'Y' not found, the status is404, and the code isstandardErrorCodeForHttpStatus(404), which isRESOURCE_NOT_FOUND. It used to throwError('No handler registered for action 'X' on 'Y'')with no code./actionsserves a different one./actionsdoes serve a different one, so the throw now uses the door's sentence, and the two doors answer the same bytes. No code reads the old sentence; the only readers were three test pins, which move here.run_action400 VALIDATION_ERROR,No handler registered for action 'X' on 'Y'404 RESOURCE_NOT_FOUND,Action 'X' on object 'Y' not foundaction_invocationrowfailed,500,INTERNAL_ERRORfailed,404,RESOURCE_NOT_FOUNDPOST /api/v1/actions(the measured target)404 RESOURCE_NOT_FOUND, same sentenceRECORD_LOCKED/ 409Tests
packages/runtime/src/mcp-run-action-ghost-routing-miss.test.ts, 6 rows. One kernel serves both doors (handleActionsandbuildMcpBridge().runAction), so each pin is the agreement between them:404/RESOURCE_NOT_FOUND/ the routed-object sentence (the measured target).actionsDoorAnswerOf(thrown)equals the REST body (code, status, message, nodeclaredCode).failedinvocation row with404/RESOURCE_NOT_FOUND.mcp-list-actions-handler-probe.test.ts: the tworejects.toThrow(/No handler registered/)pins now assert{ code: 'RESOURCE_NOT_FOUND', status: 404 }.packages/cli/test/package-install-local-handlers.integration.test.ts: the ghostrun_actionpin moves fromVALIDATION_ERROR/ 400 to the exact envelope{ code: 'RESOURCE_NOT_FOUND', status: 404, message: "Action 'ghost_task' on object 'tasks_app_task' not found" }, measured over a realos startstack.resume_runis not pinned: it continues a paused run throughautomation.resumeand never reaches the script dispatch, so it cannot hit the miss.Acceptance notes
domains/mcp.ts's bridgerunActioncallsinvokeBusinessAction; REST/actionsanswers its own miss before any throw. No REST or other door's answer moves.service-settings' own "No handler registered … in 'ns'" sentence is a different producer and is unchanged.domains/mcp.ts(~961),app-artifact-handlers.ts(~25) andcloud-connection/src/marketplace-install-local-plugin.ts(~5673) mention the old sentence as a measured history ("was listed … and refused there with …"). They are still true as history, and two of the files are outside this claim's surface.run_actionanswer moves from an uncoded 400 to the coded miss/actionsalready serves. No new export, type or protocol member.Verification
All on head
f841c43e(basef4b4c8ae).Red first, fix, suites
f4b4c8ae, the new runtime file: Tests 3 failed | 3 passed (6). The bridge threwcode: undefined,status: undefined;actionsDoorAnswerOfgaveVALIDATION_ERROR/ 400; the MCP row recorded500/INTERNAL_ERROR. The REST pin and both CONTROLs were green.ce565b30;f841c43echanges only those two runtime test files (a module-top import, one unused fake member), and both were rerun green on it.pnpm --filter @objectstack/runtime test: Test Files 556 passed (556), Tests 8963 passed | 19 skipped; lock VERDICT command-exit 0.packages/cli/test/package-install-local-handlers.integration.test.ts(after--filter '@objectstack/cli...' build): Test Files 1 passed (1), Tests 17 passed (17); lock VERDICT command-exit 0.typecheckfor@objectstack/runtime(onf841c43e) and@objectstack/cli: exit 0 (test layers held: runtime 27 / 186 / 66, cli 3 / 28 / 6).eslint packages/runtime/src packages/cli/test --no-inline-config): exit 0.Ablation (ablation-replace, restored to HEAD)
action-execution.ts: thecode/statuson the miss throw spread only under a condition that is never true (String('ABL').length < 0), so the throw goes back to uncoded. Mutation landed (anchor 1 to 0, blob bcee193c06b8 to eb08314860a9). The new file plus the probe file: Tests 5 failed | 7 passed (12). The 3 new parity rows and the 2 probe rows went red; the REST pin and the CONTROLs stayed green. Restored: blob == HEAD (bcee193c06b8),git diff HEADempty.Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackatf841c43e: 67 commands, each run with stdin from/dev/null, all exit 0. The first loop, once565b30, read two reds from the new test file, both fixed inf841c43e:check:engine-double-contract(an unusedfindOneon the engine fake, now dropped) andcheck:test-source-alias(the new file and the edited probe file now pay the@objectstack/metadataload at module top).check:dual-build-cjs-loadsexited 3 on that first loop (PREREQUISITE NOT MET) and 0 on the full rerun.dispatch-gates --ran: 67 derived families accounted for, 67 run, 0 NOT-MEASURED. Not run locally (CI):test:repo, dogfood shards, type-check lanes, the rest of the cli integration tier.🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5pVLKxR5eAhTYetnwR