Skip to content

Infrastructure: Settle Storybook story-provider cancellation and reconnect epochs #4437

Open

Description

@JasonVMo

Current status - 2026-11-07

Implementation in #4463; no active prerequisite blocker. Windows/Win32 descriptor runs exercise cancellation, correlated delayed/error readiness, old-message rejection, quarantine/recovery, and same-session preview invalidation. The ledger retains exact reference kind, identity, generation, session continuity, and failed stimuli.

Remaining acceptance:

  • Partial, Win32: a render fault did not expose a fresh preview root, so fresh-preview lost-context mutation fencing is not proven. Production-bundle Metro reload is Unsupported and is not substitute evidence.
  • Partial, both Windows endpoints: Callout was shown and cleaned up, but a separately registered secondary-window target was not selected. Preserve chrome/window and immutable PNG lifetimes while invalidating only preview element references.
  • Not run on the latest recorded macOS candidate a19fd3e1: native cancellation, readiness/render faults, lost-context fencing/recovery and secondary-window cases. Fabric physical input remains Partial; earlier failure evidence remains in Infrastructure: Live-qualify the desktop driver and MCP foundation on macOS, Windows, and Win32 #4441.
  • Intentionally unsupported: transparent upstream bridge reconnect/session restoration. Exact same-live-incarnation restart must keep returning renderer-specific relaunch-required; uncertain or replaced identities stay fail-closed.

Physical input failures and broader platform/measurement gates remain #4441; full support consolidation remains #4451. Merging main is not a new native qualification.

Goal

Story providers have no cancellation or lifetime context, and runtime bridge reconnect and delayed-render fencing are incomplete. #4434 conservatively quarantines the target when a story change has an unknown effect. Add the context needed to settle or fence story changes precisely, so a late render can never satisfy or overwrite a newer selection, and so that whole-target quarantine is needed only when fencing cannot be proven.

Part of #4435 (plan item F4).

Scope

  • Owner: driver story context port and runtime bridge.
  • Paths (under packages/agentic/): desktop-driver/src/{storybook.ts,server/sessionStories.ts,operations/story.ts,operations/runtime.ts}, storybook-desktop/src/driver/StorybookChannelOrchestrator.ts, and the runtime bridge and story root in storybook-desktop-runtime, with tests.
  • Add a local signal and lifetime context separate from serializable inputs, a typed bridge-unavailable state, connection epochs, and prompt failure of pending requests on disconnect.
  • Version the producer/verifier story-marker contract and add conformance tests of real runtime output against the driver verifier, without Node imports in the runtime.
  • Pass story operations only the catalog fields they need, not source or test metadata.
  • Account for the orchestrator's prepare broadcast, HTTP navigation, authenticated readiness, and local timeout.
  • Investigate upstream @storybook/react-native channel reconnect behavior before promising transparent recovery.

Dependencies

Acceptance

  • An absent bridge fails promptly, before dispatch, with effect none.
  • Cancellation after dispatch settles or fences late work. Releasing the queue at a deadline is not acceptance.
  • An old ready, error, or render message cannot satisfy or overwrite a newer selection.
  • Context-sensitive actions reject stale previews.
  • Restarting the driver with a running app either reauthenticates safely or returns an explicit, renderer-specific relaunch-required state.
  • Behavior is qualified separately on macOS Fabric, Windows Fabric, and Win32 Paper.

Validation

  • Iterate with focused yarn test <name> in each changed package, then run its yarn format, yarn lint, yarn build, and yarn test. Finish with yarn clean-lage-cache then yarn lage buildci; run yarn lage test-links --verbose --grouped after markdown changes.
  • Add a patch changeset for each changed published package. Update the owning references/current-status.md rows (done, work in progress, unsupported) and affected README/AGENTS guidance in the same change.
  • Native, provider, or process-topology changes need matching-OS native contracts and the affected consumer lane. JavaScript tests and bundles do not qualify native behavior; hosted capability skips are not passes. Report each check as passed, failed, skipped, not run, or unsupported.

Evidence

  • Current state: "Story catalog/select/reset", "Exclusive Storybook control", and "Application-exit/reconnect continuity" in packages/agentic/desktop-driver/references/current-status.md; topology notes in packages/agentic/storybook-desktop/references/integration.md.
  • Retired plan: driver-next.md at 0569e1b86, sections 5 (story operations) and 8 (F4).

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