Relationships
#2846 Model add-ons that extend a built-in model type never attach in CLI processes
Opened by stack72 · 9/30/2026· Shipped 10/2/2026
Summary
An extension add-on (export const extension) whose target is a built-in model type such as command/shell is catalogued and reported healthy by swamp doctor extensions, but its methods never attach in a normal CLI process. model method run fails with unknown_method, and model type describe lists only the built-in methods. The same add-on targeting a local model type attaches fine. Found while live-testing swamp-club#2745.
Steps to reproduce
- swamp repo init --tool none in a scratch dir.
- Add extensions/models/localaddon.ts exporting extension with type command/shell and one method, hello.
- swamp model create command/shell shelly --global-arg run=true
- swamp model method run shelly hello
Result: unknown_method, Available methods: execute. Reproduced on the released binary (20260929, sha cd8f2d24) and on current main. Wiping .swamp/_extension_catalog.db and .swamp/bundles does not help. Pulled add-ons behave the same way.
Why (from reading the code)
Add-ons are attached by attachPendingExtensionsForType, which runs only from loadSingleType (lazy extension types), for types whose rows were re-bundled in the current catalog pass, or from the auto-resolver after it loaded new bases. Built-in types are registered eagerly, so ensureTypeLoaded returns early and none of these paths runs for them on a warm start. In swamp serve the add-on does attach, because a hot reload's discovery pass fully loads pulled extension dirs.
Expected
An add-on that extends a built-in type attaches wherever the type is used, as it does for local types.
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.