Relationships
#4997 context.runModel(): a registry extension from another collective can't be called unless the caller's manifest lists it, and the target has no way to allow callers
Opened by skunk-ape · 11/22/2026
What happens
When a pulled extension calls context.runModel() on a behavior type from a different extension, swamp checks only the caller's manifest. The call is allowed when:
- both are the same extension, or
- the caller's
manifest.yamllists the target extension independencies, or - both extensions are in the same collective, or
- the caller has no extension name (it is sourced locally: the repo's own
extensions/, or added withswamp extension source add).
Otherwise it is refused:
Extension "@swamp/stagecraft" cannot invoke behavior type "..." from extension "@acme/zztarget" — add "@acme/zztarget" to dependencies in manifest.yaml.
So an extension designed to be called by another (for example a stagecraft tracker written as its own extension) works when it sits in the repo or is source-added, but not once it is published and pulled from the registry by a different collective. Its author can't fix that. Only the caller's author can, by listing every such extension in the caller's manifest, which doesn't scale to a plug-in model.
We found this while making stagecraft publish to trackers written as separate extensions.
Steps to reproduce
- Pull
@swamp/stagecraftfrom the registry. - Pull a tracker extension published by a different collective (for example
@acme/zztarget). - Run a stagecraft method that calls the tracker through
context.runModel().
Measured on swamp 20261120.161258 (sha 7b758e05), with @swamp/stagecraft 2026.11.21.3 and probe extensions, on v2 and v3 datastores:
- Tracker in the repo's own
extensions/, or added withsource add: allowed, about 10 ms. - Tracker pulled from another collective: refused with the error above, on both formats.
Cause
src/domain/models/model_invocation_service.ts:701-746 (origin/main e52c839ba). An unnamed caller returns early (line 701). Otherwise the caller's manifest dependencies are loaded and checked, then the same-collective case. Nothing reads the target's manifest.
Decision needed
This check is a trust boundary between pulled extensions, so the fix is a design choice, not just code. Options:
- A target-side opt-in: the target's manifest declares that it may be called by any extension (or by named extensions or collectives), for example to implement a published contract such as a stagecraft tracker.
- Honour the target's own dependency on the caller: if
@acme/zztargetdepends on@swamp/stagecraft, it is written for stagecraft, so stagecraft may call it. - Keep the caller-only rule and document it.
Related: context.runModel() is also unavailable on enrolled workers, and #2379 asks for context.runWorkflow. All three are about what a method may reach, and could be decided together.
Version
swamp 20261120.161258 (sha 7b758e05). Code references to main at e52c839ba.
Open
No activity in this phase yet.
Sign in to post a ripple.