Skip to content

feat(plugins): install local artifacts through the plugin manager - #4615

Open
thymikee wants to merge 6 commits into
0.22from
feat/0.22-managed-plugin-artifacts
Open

thymikee wants to merge 6 commits into
0.22from
feat/0.22-managed-plugin-artifacts

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Install a local plugin archive through the existing manager for #4591 and #4597.

agent-device plugins add-artifact ./provider-plugin.tgz --json
agent-device plugins list --json
import { addPluginArtifact } from 'agent-device/plugins';
await addPluginArtifact('./provider-plugin.tgz', { env: process.env, cwd: process.cwd() });

The manager verifies staged archive integrity before selection and records its installation ID, exact version and SHA-512 digest. Installation skips lifecycle scripts and factory loading; listing checks compatibility. The add receipt marks compatibility unchecked. Existing selections cannot be silently replaced or updated from the registry. Restart the daemon after changing selections. CLI operations use the supplied host environment and working directory.

Scope: 12 files; CLI, public manager API, tests, docs and changeset. No new package or publication change.

Validation

Tested head: 4d0b0108c3a7fc66f404031474582bf8f1224712.

  • Exact affected: 42 passed, 25 skipped; full check: 41 passed, 25 skipped.
  • Both receipts report exactCommit=true and checkoutChanged=false.
  • Packed SDK/CLI consumer exercises a real replay archive; local fixture tests cover rollback, isolation and concurrent mutation.
  • Coverage at 47b4d14 exposed an unhandled aborted fixture upload. A real interrupted-upload regression reproduced the error before the fixture fix and passed afterward; the owning test file passed 41 tests.
  • Independent review at b719e5d found one test assertion issue, corrected subsequently. The small fixture follow-up was cold-read; no fresh independent review at this head.

Hosted checks, T3/e2e adoption and live provider acceptance remain separate.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.14 MB 6.14 MB +4.0 kB
Package (unpacked) 6.14 MB 6.14 MB +4.0 kB
Package (download) 1.86 MB 1.86 MB +1.2 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 43.6 ms 30.7 ms -13.0 ms
CLI --help 77.3 ms 60.0 ms -17.3 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files

You’re at about 98% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/cli/commands/plugins.ts Resolved
Comment thread src/cli/commands/plugins.ts Resolved
Comment thread packages/plugins/src/store.ts Resolved
Comment thread .changeset/managed-plugin-artifact.md Resolved
@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

Reviewed with this repository's own Sentinel configuration (a30accf38081).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

Earlier reviews

Review of 47b4d14e · 16.11.2026 21:36 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (a30accf38081).

Review of 356a6696 · 16.11.2026 20:48 UTC

Apex Sentinel · ✅ Approve

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/plugins/src/store.ts:399 add-artifact refuses hosts where HOME is unset but homedir() resolves

2 findings below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (ea414582b7fa).

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 356a669. The verdict and the full list are in the summary comment.

Comment thread packages/plugins/src/store.ts Resolved
@thymikee

Copy link
Copy Markdown
Member Author

I found no blocking problem in the code at 356a669. All 17 checks pass at this commit and there are no conflicts. The containment claim rests on npm's extractor, the realpath checks at store.ts:437-449, and --ignore-scripts.

Not blocking, and you can take or leave these: addPluginArtifact at store.ts:393 copies the lock, config, publish and cleanup steps from changePlugin (store.ts:341-389), so the two can drift. Would one shared "replace one selection under the plugins lock" owner, with only the staging step differing, be simpler? Also, an artifact selection stores the version twice, in selection.version and selection.artifact.version (store.ts:455). A hand-edited config can make them differ, and only artifact.version is honored. Keeping one version field would remove that case.

Before merge, please answer or fix the open inline threads. The most useful ones are the host plumbing at plugins.ts:27 (#4615 (comment)) and the positional label at command-overrides.ts:23 (#4615 (comment)). The other threads that still apply are the Windows npm call in tests (#4615 (comment)), the unchecked-compatibility text output (#4615 (comment)), the prerelease leading zeros (#4615 (comment)), and the missing-HOME refusal (#4615 (comment)). The thread about documenting the replacement steps does not apply, so you can resolve it: website/docs/docs/plugins.md already documents them, and the CLI refuses with typed reasons (#4615 (comment)).

@thymikee

Copy link
Copy Markdown
Member Author

Thanks for the update. At 47b4d14 the code looks right to me, but the Coverage check is red on this head and it passed at 356a669, so the new failure came with this change. The failing route overlaps your delta: store.ts (isExactVersion, addPluginArtifact), src/cli/commands/plugins.ts and the new tests. The job log (run 43960510039) stops during the test run with no failing test or gate message, so it may be a runner problem rather than this change. Please rerun it; if it fails again, check whether the vi.spyOn on the @agent-device/plugins/store namespace behaves differently under coverage instrumentation.

From the earlier review: the HOME and ~/ handling now sits in resolveUserConfigPath, the CLI command uses host consistently, the artifact result reports compatibility as unchecked, leading-zero prerelease identifiers are rejected, and the npm pack fixtures check the exit code.

Could addPluginArtifact stage and validate the tarball through a source-specific helper, while sharing one store transaction owner with changePlugin for plugins.lock, config preservation, selection publication and rollback? Both paths implement that same transaction in store.ts and store.ts. Keeping the immutable artifact marker and npm lockfile details in staging would leave a smaller shared mutation boundary. Neither path has a concrete failure today. Would this smaller shape work, or what made you keep two copies?

The open inline threads from #r4591300984, #r4591300998, #r4591301004, #r4591301012, #r4591301043, #r4591301051 and #r4591349998 are fixed at this head. Please resolve them. There are no conflicts. Before merge, please answer the shared-transaction question and get Coverage green or explained.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready from the code side at 4d0b010. The earlier review at 47b4d14 (#4615 (comment)) asked for evidence, and that evidence is now in place.

Not blocking: the fix in src/core/interactors/limrun-ios-runner.fixtures.ts (https://github.com/callstack/agent-device/blob/4d0b010/src/core/interactors/limrun-ios-runner.fixtures.ts#L18) for the aborted-upload rejection is unrelated to the plugin manager, so would you consider moving it into its own small PR? Keeping it here is fine, since it is test-only and unblocks Coverage.

All seven earlier inline threads are addressed at this head, so you can resolve them. The six marked fixed are: the Windows npm exit-code check in store-artifact.test.ts (#4615 (comment)), the "unchecked" compatibility report in plugins.ts (#4615 (comment)), consistent host.env use in plugins.ts (#4615 (comment)), the leading-zero prerelease check in isExactVersion (#4615 (comment)), the package-or-path? label in command-overrides.ts (#4615 (comment)), and the HOME handling through resolveUserConfigPath (#4615 (comment)). The replacement-steps thread (#4615 (comment)) needs no change, because the steps are in website/docs/docs/plugins.md and the CLI refuses with typed reasons.

Smoke Tests failed in smoke:keyboard-ime, where open com.callstack.agentdevicelab --relaunch returned android-app-close-timeout. That is Android app lifecycle, and this diff does not touch it. The plugin store is not read on that route, and the run selects no plugins. Please rerun that job.

There are no conflicts. Before merge, please rerun the Android smoke job. Please also answer the open question from the 47b4d14 review: should changePlugin and addPluginArtifact (store.ts:342 and store.ts:394) share one store-transaction owner? This update does not address it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant