Skip to content

0.22: route web and Vega plugin process spawns and diagnostics through the plugin host #4862

Closed

Description

@thymikee

Found in the review of #4857 (#4857 (comment)). #4857 fixes it for HarmonyOS only; the same fault is in the two platform plugins already merged into 0.22 (#4792 web, #4828 Vega).

Problem

A managed platform plugin bundles its own copy of @agent-device/host-kit (deps.alwaysBundle matches /^@agent-device\//). A runtime import of @agent-device/host-kit/command or @agent-device/host-kit/diagnostics inside the plugin therefore uses a second AsyncLocalStorage scope that the daemon's withCommandHost(...) never enters. In the packed plugin:

  • spawned tools inherit process.env, not the captured host.env (cwd and environment of the daemon host);
  • exec traces and timers go to the plugin's own diagnostics store, so --debug logs lose them.

Workspace tests resolve the plugin from src, where host-kit is one instance, so they do not see it.

Runtime import sites reported by #4857:

  • packages/platform-web/src: agent-browser-install.ts, agent-browser-lifecycle.ts, agent-browser-process-record.ts, agent-browser-provider.ts, agent-browser-tool.ts, interactor.ts
  • packages/platform-vega/src: app-lifecycle.ts, input-actions.ts, inventory.ts, tool-provider.ts, vega-executable.ts
  • packages/provider-limrun/src has one such import on refactor(limrun): ship Limrun as the @agent-device/limrun plugin #4846; check whether a provider plugin has the same fault.

Required behavior

Every process a managed platform plugin spawns and every diagnostic it emits goes through the PlatformHost passed to setup() (runCommand, emitDiagnostic, withDiagnosticTimer), as #4857 does for HarmonyOS. The layering rule that #4857 adds to scripts/layering/platform-package-policy.ts then holds for web and Vega without a register entry.

Completion conditions

  • No runtime import of @agent-device/host-kit/command or /diagnostics in packages/platform-web or packages/platform-vega; their entries leave the policy register.
  • A packed-plugin test per family that runs a command with the tool reachable only through the host environment, and asserts the spawn's environment.
  • One --debug log per family that shows the tool's exec record under the request id.
  • A decision, with a test, for the Limrun provider import.

Depends on #4857 merging first (it adds the rule and the host ports).

Activity

  1. added this to the 0.22 - lean core milestone on Nov 20, 2026
  2. apex-sentinel-staging commented on Nov 20, 2026

    @apex-sentinel-staging

    Apex Sentinel · Issue review

    Suggested label: bug

    The issue reports existing wrong behavior where web and Vega plugins bundle separate host-kit instances, causing spawned process environments and diagnostics to bypass the daemon host context. It identifies affected files, expected behavior, and concrete completion checks, making it actionable.

    Required sections

    • Steps to reproduce (missing)
    • Expected and actual behavior (missing)
    • Version or environment (missing)
  3. thymikee commented on Nov 21, 2026

    @thymikee
    MemberAuthor

    Done in #4874 (merged into 0.22 as 5271581): web and Vega run every spawn, process read, install lock and diagnostic through the PlatformHost, and the layering rule derives the forbidden host-kit exports from its module graph.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions