Skip to content

Implement retained Workflow Workspace restoration #218

Description

@taras

Story

As a workflow author, I want xmd workflow to retain one provider-backed Workspace with the run's journal, repositories, and Agent state, so repeatable procedures resume after interruption without reconstructing intermediate filesystem history or granting Agents mutation authority.

Settled contract

PR #358 records the normative behavior in architecture.md and specs/workflow-workspace-spec.md:

  • xmd run uses the caller's current environment and has no restoration guarantee.
  • xmd workflow creates a WorkflowRun with one implicit root Workspace.
  • Each run owns one SQLite database containing logically separate filtered journal, versioned DOFS, Repository/Worktree metadata, and Agent-session stores.
  • One expansion produces one effect and one Workspace transaction.
  • Completed durable effects restore their results; ephemeral attachments rebuild the live Effection tree; partial replay continues against the retained frontier.
  • Missing authoritative Workspace state is unrecoverable rather than silently replaced.
  • Agents are read-only and propose mutations as constrained generated XMD.
  • Prompt, Push, PullRequest, and Issue are reconciled external effects rather than local transactions.
  • Worker Shell is included through a Deno Worker and just-bash, after the transaction spine exists.
  • Public lifecycle commands remain host-neutral so a future cloud host can implement them; no remote-host selector ships initially.

This is the implementation umbrella. Child issues own executable acceptance details; this body owns their dependency order and the invariants they share.

Implementation order

1. Retention and one filesystem vertical slice

2. Repository and deterministic Git composition

3. Agent authority and constrained execution

4. Compose and certify the product workflow

Cross-cutting invariants

  • WorkflowRun establishment and base pinning remain acyclic and precede Workspace attachment.
  • Shared production modules use contextual APIs and contain no Deno, SQLite, DOFS, Cloudflare, GitHub, or runtime detection.
  • One authoritative host-owned DOFS connection serves a workflow database and serializes Workspace-local effects.
  • Existing security filtering runs before journal insertion; co-located DOFS content is not automatically journal or training data.
  • Completed root replay attaches no Workspace, Agent, process, or external provider.
  • Status, list, and history are read-only and cannot advance a run.
  • No required state exists only in an Agent transcript, host path, provider handle, or branch name.
  • External effects never claim atomicity across SQLite and a provider; they reconcile stable identity.
  • Evidence PRs 🔬 Spike: host Cloudflare DOFS directly in Deno with SQLite (#349) #350, 🔬 Spike: run Cloudflare Worker Shell and Worker JavaScript natively in Deno (#351) #353, and 🔬 Spike: make Worker Shell effects transactional (#357) #362 remain unmerged experimental evidence. Production is implemented in focused PRs from the child issues.

Completion

This umbrella closes when the retained Workspace lifecycle, repository/Git composition, read-only Agent path, constrained Worker Shell, and end-to-end workflow certification are complete and PR #181 describes only shipped behavior.

Intentionally excluded

  • A public remote-host selector or deployed XMD service.
  • Worker JavaScript in the initial topology.
  • Native subprocess execution, writable FUSE, bundled workerd, or Containers.
  • Automatic ingestion of arbitrary Workspace files for training.
  • Recovery from deleted or corrupt authoritative Workspace state.
  • Rewinding external systems during a history fork.

Evidence

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions