Skip to content

Persist workspace, conversation, and canvas state across reloads and failures #21

Description

@robinbraemer

Outcome

Preserve the canonical workspace, conversation, user draft, running-canvas revision, and last-known-good state across refresh, restart, crash, quota pressure, and interrupted writes. Recovery should feel like continuing work, not operating an internal state machine.

Dependencies

Builds on the Git-backed history contract in #25 and the persistent workspace host in #33.

Required behavior

  • Keep source, dependencies, assets, agent tools, compiler state, canvas revision, and history anchored to one canonical workspace identity.
  • Persist bounded schema-decoded conversation and task context needed for the agent to continue; credentials, private grants, model internals, raw provider payloads, and unbounded tool output stay excluded.
  • Preserve unsent user drafts and restore them without sending twice.
  • Reopen on the latest valid visible checkpoint and retain actionable diagnostics for an interrupted or failed edit.
  • Detect schema, host, runtime, and workspace incompatibility before mutation and offer a safe migration, export, or restore path.
  • Reject stale tool results and concurrent writes using workspace revision identity.
  • Handle OPFS/IndexedDB quota exhaustion, partial writes, corruption, interrupted migration, and multiple tabs without replacing the last-known-good state.
  • Compact bounded conversational context and disposable build caches without deleting source history.
  • Keep internal agent-session lifecycle and recovery receipts out of the default UI.

Acceptance criteria

  • Production Chromium refreshes and restarts during idle, prompt drafting, agent streaming, tool execution, incremental build, failing build, direct manipulation, Undo, and history restore.
  • Every restart returns to the exact canonical source revision and matching running-canvas revision or explains one bounded recovery action.
  • A preserved unsent draft is restored; a submitted prompt and its tool effects are never duplicated.
  • Fault injection covers quota exhaustion, partial writes, corrupted entries, incompatible schema, stale revisions, interrupted migration, simultaneous tabs, worker termination, and storage eviction.
  • The packaged macOS app recovers after runtime termination and relaunch without losing the latest valid work or exposing private state.
  • Fifty edit/reload cycles stay within the memory and storage budgets from Make Flect feel instant with strict live-editing performance budgets #20.
  • Recovery can inspect, export, retry, or restore without a model when the model is unavailable.
  • The user-facing flow contains no App/Shaper/Guardian, candidate, accepted/rejected, safe-mode, branch, or reset-mode terminology.
  • Recovery evidence is bounded and attributable and contains no credential-bearing transcript.

Non-goals

  • Persisting every model token, screenshot, network body, or tool payload.
  • Treating browser storage as a security boundary.
  • Inventing history separate from the canonical Git workspace.
  • Recreating disposable compiler caches when a clean incremental rebuild is safer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority:P1Next after the core live-editing loop is provenstatus:external-gateImplementation is locally complete; closure requires credentials, hardware, review, or publication

    Type

    No type

    Projects

    Status
    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions