Repository navigation
fix(runtime)!: an action authored in the environment on a packaged object is the environment's, so MCP list_actions lists it once and its face runs - #33071
Conversation
…ject is filed under the environment, so MCP list_actions lists it once and its face runs it (ADR-0150 D4) The registry serves an environment-authored action bound to a packaged object inside that object's served `actions`, unstamped and tenant-authored. The collector filed that copy under the object's package, so the holder-keyed dedupe kept it beside the standalone copy: two rows, one under a namespace that never shipped the action, and its face refused. A tenant-authored embedded copy with no stamp is now the environment's. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czLj1eeZBYHELaRH6v
📓 Docs Drift Check3 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 — 29 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 66a49a6a9e5493f9ab72bf1a48027d7dd60156be && git checkout 66a49a6a9e5493f9ab72bf1a48027d7dd60156be
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4462b4d92b9fff58d43e6fa8e700fd0ea6d4f62d c4c1aa31b0c3968f31f1ba21b8452dc9053515bf && git checkout -B drift-repro 4462b4d92b9fff58d43e6fa8e700fd0ea6d4f62d && git merge --no-ff c4c1aa31b0c3968f31f1ba21b8452dc9053515bf
node scripts/docs-audit/affected-docs.mjs --json 4462b4d92b9fff58d43e6fa8e700fd0ea6d4f62d |
|
domain:server#8 · os-elon-musk · session_016WV4cwqTK71kjQzHae8T5J Contract-review-claim: session_016WV4cwqTK71kjQzHae8T5J · head a5bdc1d · 2026-11-13T07:38Z |
|
domain:server#8 · os-elon-musk · session_016WV4cwqTK71kjQzHae8T5J Contract reviewServed-tier: Read at 2026-11-13T07:43Z: the diff, the PR body, card #33029 (three comments, newest the re-posted claim 6846499643), the head's check-runs. Nothing built or run; every "moves" below is by reading unless it cites the dev's measurement. ① Derived judgmentsWho reads the changed value.
M1, must-fix: the narrowing is three places, not two. Readers 5, 6 and 7 move for an environment-authored FLOW action on a packaged object whose Predicate. Pins and ablation. The one ablation reverts ② Semver level
③ Boundary flags
④ Design judgmentThe narrowing takes no declared capability away; it makes the spec's own refusal real. ADR-0150 D5: a namespace answers its packages' declarations only, and "an environment item has no namespace, so it gets the reserved segment Must-fix before a new record:
Implemented-by: VERDICT: FAIL |
…flow target an environment action reads by the no-package rule Contract review M1: an environment-authored flow action on a packaged object has no package (ADR-0150 D3), so a target flow name two packages hold is refused 409 naming both on its face, its bare name and _env, where it ran the object's package's flow. A dogfood pin goes red when only the actionDeclaringPackage hunk is reverted. Two docblocks restated for the new rule. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czLj1eeZBYHELaRH6v
|
domain:server#8 · os-elon-musk · session_016WV4cwqTK71kjQzHae8T5J Contract reviewServed-tier: Delta review of record 6847350544 (VERDICT FAIL on ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentUnchanged from the prior record. The 404s are ADR-0150 D5 and the 409 is D3: an environment item has no package, so its reference is read by the no-package rule. The seat ruled to keep the hunk and declare it; the head does that, and the pin makes the declaration fail loudly if the hunk is ever dropped. Implemented-by: VERDICT: PASS |
…e action to a writable package Delta review S2: a code package is read-only to the metadata door (422), so the fix names a writable package whose own flow, or whose one dependency's flow, is meant. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czLj1eeZBYHELaRH6v
|
domain:server#8 · os-elon-musk · session_016WV4cwqTK71kjQzHae8T5J Delta note (text only) · head
|
|
domain:server#8 · os-elon-musk · session_016WV4cwqTK71kjQzHae8T5J ACCEPT · PR #33071 · head 席位核对
|
Requested by Elon · project thread
Fixes #33029
Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: none — the docs already state the rule this change makes true:
content/docs/api/client-sdk.mdx(Addressing an item by its package) says a namespace names the holding package and'_env'names an item authored in the environment, which no package holds; no skill teaches calling an environment action under a package's namespace.维护者速读
?package=)给某个包自带的对象写的动作,现在算「环境自己的动作」。AI 助手(MCP)的动作列表只列它一次、不挂包的命名空间,按列表给的名字(对象-动作)就能运行。/actions/_env/...即可;③ 这种环境动作如果是流程动作、目标流程名又被两个包同时持有,现在回 409 并列出两个包,以前默认跑对象所在包的那个流程,改法是用?package=把动作绑到一个可写包(该包自己的流程,或它唯一依赖的那个包的流程就是想要的那个),或换一个只有一个包持有的流程名。回滚就是 revert 这个 PR,运行时只改一个文件。packages/runtime/src/action-execution.ts的embeddedActionPackageOf(新函数,6 行)及它在collectActionDeclarations、actionDeclaringPackage的两处调用;再看packages/qa/dogfood/test/mcp-list-actions-environment-authored-holder.dogfood.test.ts的收窄钉子(两个 404、一个 409)。pnpm --filter @objectstack/dogfood exec vitest run test/mcp-list-actions-environment-authored-holder.dogfood.test.ts,预期 8 条全过;「namingshowcase… answer 404」和「… refused 409 naming both」两条就是收窄面。What changes
The protocol's merged listings, which the MCP bridge reads, serve an action an administrator saved with no
?package=twice: once in theactionlisting, with no package, and once inside the served object'sactionsin theobjectlisting, where the registry attaches it (attachBoundActions, #28356) by reference, unstamped and tenant-authored (_provenance: 'org').collectActionDeclarationsfiled every unstamped embedded action under the object's package, so the ADR-0150 D4 dedupe, keyed on the holder, kept both copies.embeddedActionPackageOf(new,packages/runtime/src/action-execution.ts) is the one rule for an embedded action's holder: its own stamp; else, when it is tenant-authored (isTenantAuthored,@objectstack/metadata-core, the registry's own test), no package; else the object's. The collector andactionDeclaringPackageboth read it.Narrowing, measured and ruled by the seat (direction A, the holder fixed in resolution, not a list-only dedupe), in three places:
run_actionwithnamespaceset to the object's package answersRESOURCE_NOT_FOUND(404) for such an action. It ran it before, because the embedded copy was filed under that package.POST /actions/NAMESPACE/OBJECT/NAMEwith that namespace answers the same 404.targetflow name two packages hold answersRESOURCE_CONFLICT(409) naming both, on its face, its bare name and_env. The action has no package (ADR-0150 D3), soactionDeclaringPackagegives the flow arm no caller package and the target is read by the no-package rule. Before, it ran the object's package's flow. The caller's fix: bind the action with?package=to a writable package whose own flow, or whose one dependency's flow, is meant, or target a flow name one package holds.list_actionslists that row withoutparams, andresume_runno longer admits it for a paused run of either package's flow, by the same reading.A flow target ONE package holds is unchanged (pinned). The changeset carries the BREAKING banner, the FROM → TO for all three, and the ADR-0087 disposition.
Tests
packages/qa/dogfood/test/mcp-list-actions-environment-authored-holder.dogfood.test.ts(new, isolated): the stock showcase withMCPServerPlugin, an admin session, the live MCP transport and the REST actions door.showcase_task-qa_env_authored_action, no refused face;run_actionruns it by that face.namespace: 'showcase'on MCP and/actions/showcase/...on REST answer 404./actions/_env/...still run it.targetnames a showcase-shipped flow (showcase_recalc_task_estimate, one holder) by bare name runs on REST and MCP, before and after (measured by the ablation below: at base it failed only at the listing assertion, after both runs passed).qa_shared_flow, and a second code package (com.example.qatwin, namespaceqatwin, booted withAppPlugin) ships the same name. An environment-authored flow action targeting it is refused 409RESOURCE_CONFLICTnaming both packages on the bare REST route,/actions/_env/...and the MCP face. (A Studio-created package cannot author that twin: the metadata door seals a name a managed package holds, 403.)showcase_mark_done, made AI-exposed in a derived configuration) lists once undershowcaseand runs by its face.?package=(a Studio-created package that depends on the showcase) lists once under its namespace and runs by it.Acceptance notes
com.example.showcase; the?package=action arrives stamped with its package in both places; the environment's action arrives standalone with no package and embedded unstamped with_provenance: 'org'. Nothing is dropped: the embedded copy of every kind is still collected.?package=com.example.showcaseis refused 422 (WRITABLE_PACKAGE_REQUIRED, the package is read-only), so the?package=control uses a Studio-created package.PUT /meta/object/...withactions). Such an action carries no per-action provenance, so it is still filed under the object's package. Noted, not filed.packagelessOriginOfclasses the surviving embedded row by the store'sembeddedset (actions of package-less OBJECT rows), so beside another holder it reads as the platform's; on an object-bound key the first declaration still answers, so nothing moves today (contract review nit). Left as is: no answer depends on it.#32437one-row-per-bound-object pin (packages/mcp/src/mcp-action-tools.test.ts) stays green: 25/25.Verification
Package tests, lint and the full dogfood run read head
a5bdc1d4(origin/main64c426abmerged). Headdc67e074adds the third narrowing's pin, two docblocks and the changeset text, and changes no executed runtime line. Headc4c1aa31changes text only (the caller's fix for the third narrowing, delta review S2). On it: the new dogfood file 8/8, both ablations above, and the derived gates re-run.Package tests and typecheck
pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2: Test Files 600 passed (600), Tests 11916 passed, 19 skipped. Lock verdictcommand-exit 0.pnpm --filter @objectstack/runtime typecheck: exit 0.pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2 src/mcp-action-tools.test.ts(the mcp: list_actions lists one action once per object it is bound to (invite_user ×4), and run_action by its listed name is refused as ambiguous #32437 pins): 25 passed.dc67e074.Ablations (two, each committed first, each rebuilt and proven in dist)
Each leg:
scripts/ablation-replace.mjs(anchor hit, blob moved),pnpm --filter @objectstack/runtime build,ablation-dist-preflight.mjsfound the marker indist/index.jsanddist/index.cjs; restored to HEAD (git diff HEADempty), rebuilt,--absentpreflight clean.embeddedActionPackageOfback to the object's package, markerABLATE_33029, headdc67e074): 5 failed, 3 passed. Red: the one-row listing, the face run, the two 404s, the one-holder flow control (at its listing assertion, after both of its runs passed, so that target runs at base too), and the two-holder 409. Green, as controls should be: the bare and_envruns, the package-shipped action, the?package=action.actionDeclaringPackagehunk ALONE (its call back to the object's package, collector fix kept, markerABLATE_ADP_33029): 1 failed, 7 passed. Red: the two-holder 409 pin; the bare REST route answered 200 runningshowcase shared flow, the object's package's flow, which is the BASE behaviour of the third narrowing.Derived gates and lint
node scripts/pm/dispatch-gates.mjs --commandsatdc67e074: 70 families, all run with exit codes recorded;--ranreconciliation: 68 run, 2 NOT MEASURED (exit 3, prerequisite):check-plugin-teardown-shape --self-test(needs an unshallow clone) andcheck:dual-build-cjs-loads(needs a whole-tree build). CI runs both. (Ata5bdc1d4: 67 run,check:type-check-debtalso exit 3 then, waiting on the verify lock; exit 0 now.)check-adr-0087-registration --base origin/main: exit 0.check-changeset-no-major --base origin/main: exit 0.pnpm lint: exit 0.Full dogfood (owed by the narrowing arm)
pnpm --filter @objectstack/dogfood testat heada5bdc1d4, under the verify lock: Test Files 459 passed, 3 skipped (462); Tests 3851 passed, 42 skipped (3893); lock verdictcommand-exit 0. Not re-run atdc67e074, whose runtime change is docblocks only.Generated by Claude Code