fix(plugin): restore the no-../src deployment contract — lazy widget-helper import (#995) - #997
Draft
aarontrowbridge wants to merge 1 commit into
Draft
fix(plugin): restore the no-../src deployment contract — lazy widget-helper import (#995)#997aarontrowbridge wants to merge 1 commit into
aarontrowbridge wants to merge 1 commit into
Conversation
…helper import (#995) The #799 widget twin statically imported the widget-authoring helper from ../src — the one edge the plugin dir's deployment contract forbids ('never anything from ../src/', the clause calib_chain/regime_priors/rehearsal carry): trimmed deployments ship only the plugin dir, so module init died at load and EVERY amicode_* tool vanished from hub sessions (2026-09-10, silent — the service runner captures engine stderr in memory on healthy boots). The lazy fail-soft form keeps module init whole everywhere; where the helper is absent the one widget tool refuses honestly (the engine builtin carries authoring on those surfaces) and the rest of the pack stays registered. A floor test now scans the plugin dir for static parent-relative imports so the contract is enforced by the suite.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Important
Problem — The opencode plugin that serves the entire amicode_* tool pack statically imported the widget-authoring helper from the extension service source tree. The plugin directory's own deployment contract (carried as comments by
calib_chain,regime_priors,rehearsal) is "never anything from ../src/": trimmed deployments — the hub service bundle — ship only the plugin directory. The static import therefore killed module init on the hub, silently (the service runner captures engine stderr in memory and emits it only on health failure), and every amicode_* tool vanished from hub-served sessions with this morning's 04:31 bundle deployment — includingamicode_session, the "spool a fresh session" verb that surfaced this.Approach — Replace the static import with a lazy, fail-soft dynamic import inside the widget tool's execute: module init survives everywhere; where the helper is absent, that ONE tool returns an honest refusal (nothing written — the engine's built-in widget tool and the MCP transport carry authoring on those surfaces) and the rest of the pack stays registered. A floor test now scans the plugin directory for static parent-relative imports, so the contract is enforced by the suite instead of comments. Tool names/descriptions/args are untouched (core/plugin parity stays byte-pinned).
Acceptance Criteria
Verification honesty
pnpm --filter amicode testlocally on this box carries pre-existing red in service/auth/overlay-seam tests (they bind ports that collide with the live hub on this machine) — identical failures on a clean main worktree, and CI's fast lane passes for a clean tree (PR #990's current run is all-green), so CI is the arbiter.Notes
Two follow-up seams discovered during diagnosis, deliberately out of scope: (1) the service runner swallows engine stderr on healthy boots (
engineLogis in-memory, emitted only on health failure) — that silence is why a whole tool pack could vanish unnoticed; (2) the MCP transport's session tool refuses by design (no in-process engine client) — an HTTP fallback would make the spawn verb work on every surface. Also observed: the fast suite mutatespackages/app-bundle/overlay/**in the working tree as a side effect of running it (reproduced in a fresh worktree) — worth its own issue.Closes #995