Skip to content

Infrastructure: Desktop driver improvements for workload hosting, lifecycle, and agent orchestration #4435

Open
3 of 17 issues completed

Description

@JasonVMo

Current status - 2026-11-07

PR #4463 integrates F2/F3/F4/F5 implementation and the F15 Windows follow-up. F1, F7, F8, and F12 implementation is already merged. Readiness for review is not completion of the full desktop program, and the acceptance-incomplete issues remain open.

The committed qualification ledger records Windows Fabric 21 Pass, 2 Partial, 1 Fail and Win32 Paper 21 Pass, 3 Partial, with per-probe source revisions, failed attempts, run IDs and cleanup. macOS's latest recorded combined-candidate run remains at a19fd3e1 (Fabric 4 Pass/5 Partial/15 Not run; Paper 2 Pass/2 Partial/20 Not run). These are historical endpoint records, not requalification of the new main merge.

Remaining work has explicit owners:

Protected story args remain intentionally refused; non-agent smoke remains explicitly legacy/unprotected. New input-lane declarations from merged #4464 do not erase earlier failures or qualify a disabled physical lane.

Goal

Evolve the desktop automation packages (desktop-driver, desktop-test, desktop-driver-mcp, storybook-desktop, and storybook-desktop-runtime) so standalone desktop applications and Storybook applications share one workload and resource owner, one native execution authority, and one bounded agent interface, with reliable recovery, verified ownership, and per-endpoint evidence. The desktop layers must remain usable without Storybook, and everything must work well when Storybook is connected.

Part of #4275. The foundation landed in #4434: MCP lifetime safety, truthful contracts and package status ledgers, and bounded fail-closed safeguards. The sub-issues below track the remaining work.

Approved architecture

A dual-model architecture review compared three approaches. Approach A was approved.

  • desktop-test is the application-neutral workload host and composition root, for one-shot CI runs and the long-lived serve host alike. Storybook contributes resources and context; WDIO and CSF contribute workload runners. The channel/driver child can remain a supervised child process: one resource owner does not require one process.
  • desktop-driver stays the native execution authority: hosts, targets, sessions, operations, references, settlement, and quarantine. It has no lifecycle, Storybook, or React imports.
  • The MCP adapter is a verified client. It never evaluates config, launches services, builds helpers, or accepts commands, paths, environment values, grants, or URLs from the model. It is renamed desktop-mcp only when real management tools land (F13), keeping a driver-only mode.
  • storybook-desktop provides optional catalog, channel, context, and CSF runner integration; its full CLI lifecycle takeover is transitional. storybook-desktop-runtime stays on-device only, with no Node harness dependency.
  • Contributions are static and typed (launch, Metro or other resources, Storybook, WDIO/CSF runners, driver service). No dynamic plugin loader, coordinator package, or per-user daemon is added until a decision gate below is met.

Alternatives considered and deferred:

  • B. Extract a dedicated coordinator package with typed plugins. Revisit when a second independent production consumer appears, or when lifecycle dependencies conflict with the harness's WDIO and reporting dependency profile.
  • C. Federated, protocol-first controllers. Revisit only when independent deployment is a real requirement.
  • Rejected: making the MCP adapter a supervisor, or moving app, Metro, or test lifecycle into the driver because it already has a listener.

Design invariants

Every sub-issue must keep these identities and lifetimes distinct:

Class Authority and release rule
Workload claim Supervisor. Release only after resource and effect accounting; otherwise retain a fenced recovery state.
Resource handle Recorded owner. Owned and borrowed are distinct; never stop or adopt borrowed resources implicitly.
Service identity and grant Verified service incarnation and attenuated permission scope; invalidated on replacement or revocation.
Target reservation and controller session Driver. One session per registered target, retained through acquisition, drain, and settlement.
Application ownership Session, supervisor, or external launcher. Exact process incarnation and causal ownership determine cleanup.
Physical input turn Native lock that serializes settled input across processes. Not an application or controller reservation.
Settlement and quarantine record Driver plus trusted durable storage. Uncertain effects outlive transport or service death.
Attach credential Exact application identity proof; never the same secret as a runtime bridge nonce.
Context epoch Driver and provider agreement. Stale render messages and preview references cannot establish current readiness.
  • Readiness tiers stay separate: service ready (verified listener, descriptor published), target acquirable, application ready (the controlling session verified the app), and context ready (authenticated runtime, correlated render, verified marker). A port that answers is not application readiness.
  • Handoff defaults to busy. An explicit relinquish or preempt stops new work, awaits settlement, confirms session deletion, and invalidates references before authorizing a new runner session. Revocation callbacks are not a drain barrier.
  • Cancellation: before dispatch it can have no effect; after dispatch, preserve applied, rejected, or indeterminate outcomes. A response deadline is not proof of settlement.
  • Reclaim: never reclaim only because a supervisor PID exited. Prove recorded resources are gone or safely recovered, reconcile unresolved effects, and handle PID reuse, concurrent reclaimers, interrupted writes, and late cleanup.
  • Reconnection: reconnecting a socket never restores native session or preview state. MCP transport loss keeps deletion responsibility and never replays a mutation; a bridge reconnect starts a new authenticated epoch; Metro reuse requires reverified runtime, catalog, and config identity.

Staging plan

Dependency graph

Solid arrows are blocking prerequisites, recorded as GitHub "blocked by" relationships. Dotted arrows gate only a later phase or option of the target item.

flowchart LR
  F1[F1 shared service and recovery] --> F2[F2 settled lifecycle and ledger]
  F1 --> F3[F3 lifelines and typed readiness]
  F2 --> F3
  F2 --> F6[F6 manifest trust]
  F2 --> F10M[F10-M macOS ownership]
  F2 --> F10W[F10-W Windows ownership]
  F1 --> F11[F11 runner handoff]
  F2 --> F11
  F4[F4 story epochs] --> F5[F5 controlled ingress]
  F1 --> F9[F9 Storybook contributions]
  F2 --> F9
  F3 --> F9
  F6 --> F9
  F7[F7 boundary guards] --> F9
  F8[F8 run queries] --> F13[F13 desktop-mcp management]
  F11 --> F13
  F12[F12 attenuated grants] --> F13
  F15[F15 foundation qualification] --> F14[F14 support matrix]
  IS[Input selection #4464 and #4466] --> F16[F16 input policy and receipts]
  F16 -.->|delivered-input evidence| F14
  F9 -.->|Storybook phase| F11
  F10M -.->|retained app option| F11
  F10W -.->|retained app option| F11
  F9 -.->|Storybook facet| F13
  F4 -.->|Storybook facet| F13
  F5 -.->|Storybook facet| F13
Loading

The original critical path is F1, F2, F3, F6, F9, then the Storybook phases of F11 and F13. F1 implementation is merged; the current landing gate is the F2/F3 integration in #4463, followed by F6 and F9.

Waves of parallel work

Wave Starts when Items that can run in parallel Coordination
1 Now F1 #4436, F4 #4437, F7 #4438, F8 #4439, F12 #4440, F15 #4441 F12 server integration must not collide with F1 recovery exports or later F5 routes. F15 runs in parallel per OS machine.
2 F1 lands; F4 lands F2 #4442; F5 #4443; F3 #4444 process work prepared against F1 Only one editor of supervisor.ts at a time. F3 integrates typed handles only after F2.
3 F2 lands F3 integration, F6 #4445, F10-M #4446, F10-W #4447, F11 #4448 generic handoff Native backends own separate files. Order the server.cjs commits F3, F5, F6.
4 F1, F2, F3, F6, and F7 land F9 #4449; F13 #4450 generic once F8, F11 generic, F12, and the transport decision are done One owner for supervisor and Storybook CLI integration; no parallel wholesale CLI rewrites.
5 F9 lands (plus F4 and F5 for the facet) F11 Storybook phase; F13 Storybook facet; F14 #4451 consolidation Enable the Storybook facet only after its safety dependencies.

F16 #4467 sits outside these waves. It starts once input-selection Part 1 (#4466) lands, and apart from the shared driver files below it does not depend on F2-F13.

Shared-file scheduling

These are scheduling constraints, not functional dependencies:

  • desktop-test/src/supervisor.ts, integration.ts, and config.ts: one lifecycle integration owner. Platform contributors propose shared changes instead of editing concurrently.
  • storybook-desktop/config/server.cjs: ordered integration commits from F1 (factory switch), F3 (lifeline and readiness), F5 (ingress), F6 (trust), then F9 (simplification).
  • storybook-desktop/src/driver/StorybookChannelOrchestrator.ts: F4 owns epochs and cancellation; F5 applies ingress afterward.
  • storybook-desktop/src/cli/DesktopStorybookCli.ts: F6 and F9 own their phases; later lease and handoff integration is coordinated.
  • desktop-driver/src/server/SessionManager.ts and grant routing: drain (F11), exit and identity (F10), attenuation (F12), and session input policy (F16) share an integration owner.
  • desktop-driver/src/server/createDesktopDriverServer.ts element and Actions routes, and operations/act.ts: F4/F5 preview-context checks (Desktop driver: typed resources, process lifelines, story lifetimes, exclusive agent ingress, and native qualification runbook #4463) and F16 input-policy enforcement touch neighboring lines. Keep both sets of edits surgical, and whichever lands second rebases.
  • Export maps, native wire schemas, root TypeScript references, the lockfile, changesets, and aggregate guidance use coordinated commits.
  • Physical-input qualification is serialized per interactive desktop; different OS machines can run in parallel.

Sub-issues

The original graph/waves above retain the design's ordering. This table records the current active landing gates. A delivered prerequisite is not kept as an active blocker just because its issue retains native acceptance work.

Item Issue Current status Active blockers / later phase gates
F1 #4436 Implementation merged in #4455; native acceptance remains None
F4 #4437 Implementation in #4463; endpoint gaps retained None
F7 #4438 Closed; merged in #4454 None
F8 #4439 Closed; merged in #4457 None
F12 #4440 Closed; merged in #4456 None
F15 #4441 Partial native qualification; further work can proceed None globally; per-case gates are in #4441
F2 #4442 Implementation in #4463; conservative recovery remains None; F1 contract is available
F5 #4443 Blocked for landing; implemented together in #4463 F4 #4437
F3 #4444 Blocked for landing; implemented together in #4463 F2 #4442
F6 #4445 Blocked F2 #4442
F10-M #4446 Blocked F2 #4442
F10-W #4447 Blocked F2 #4442
F11 #4448 Blocked F2 #4442; Storybook phase additionally F9, retained-app option F10-M/W
F9 #4449 Blocked F2 #4442, F3 #4444, F6 #4445; F1/F7 contracts are available
F13 #4450 Blocked Generic F11 #4448 and reviewed transport/scope decision; Storybook facet additionally F4/F5/F9
F14 #4451 Blocked for support-baseline completion F15 #4441; evidence collection can continue
F16 #4467 Blocked for landing; implementation stacked on #4466 #4466 (input-selection Part 1, a PR, so recorded here and with a label rather than as a native relationship)

The blocked issues carry Status: Blocked; their native GitHub blocked-by relationships retain the active prerequisites above (and any already-closed historical prerequisites). F3/F5 can co-land with their prerequisite in #4463. Later-phase/optional gates are not promoted into global hard blockers.

Decision gates

Decision Default now Evidence needed before changing it
Coordinator extraction Existing host; no new package A second independent consumer or a dependency-profile conflict
Management transport Decide one listener or a verified second endpoint in F13 Scope enforcement, incarnation and discovery, cancellation, and compatibility design
App survival across handoff Preserve existing semantics; opt-in host ownership Exact native ownership and cleanup evidence
Session continuity Connection-bound; no automatic resume A reviewed lease and grace protocol with ambiguous-response handling
Storybook ingress and reconnect Gate unsupported protection; no transparent-recovery promise Supported interception plus endpoint and renderer reconnect evidence
Multi-workspace concurrency Conservative workload exclusion Verified cross-service application claims and measured contention
Process co-location Keep the supervised child Measured benefit plus macOS responsibility and Windows containment qualification
Plugin generalization Static typed contributions A real second provider and a stable, exercised extension seam

Validation expectations

  • Each item owns its tests, owning references, changesets, and native or consumer evidence. Qualify with each item, not only at the end; F14 consolidates.
  • Run focused tests while iterating, each changed package's yarn format, yarn lint, yarn build, and yarn test, then yarn clean-lage-cache and yarn lage buildci, plus yarn lage test-links for markdown changes.
  • JavaScript tests and bundles do not qualify native behavior. Hosted capability skips are not passes. Report passed, failed, skipped, not run, or unsupported per endpoint and revision.

Evidence

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions