# DeepSeek-Reasonix Extension Recovery Policy During Session Resume: Clear-and-Restart Design Explained

> Discover DeepSeek-Reasonix's extension recovery policy. Learn how it clears and restarts extensions during session resume for a fresh start, not state recovery.

- Repository: [YHH/DeepSeek-Reasonix](https://github.com/esengine/DeepSeek-Reasonix)
- Tags: architecture
- Published: 2026-08-13

---

**DeepSeek-Reasonix does not recover extension runtime state when resuming a session—instead, it clears all extension-related state and re-initializes extensions as fresh side-cars.**

The **recovery policy for extensions during session resume** in DeepSeek-Reasonix follows a strict "clear-and-restart" approach. As implemented in `esengine/DeepSeek-Reasonix`, the framework treats extensions as **non-recoverable side-cars** that are torn down and rebuilt whenever a user resumes a previously saved session. This design prioritizes session consistency over state persistence for extension components.

## How Session Resume Triggers Extension Reset

The resume workflow in DeepSeek-Reasonix consists of three coordinated steps that collectively enforce the extension recovery policy.

### Step 1: Goal Resumption

Before any session continuation can occur, the active **Goal**—the central planning unit in Reasonix—must be resumed via `app.ResumeGoalForTab`. This operation, found in the delivery continuation logic, guarantees that the delivery scope and checkpoint are valid for the resumed session.

### Step 2: Runtime Rebuild and Extension State Clearance

The same rebuild operation that restarts the Goal's runtime also **re-initializes every extension side-car**. In [`desktop/frontend/src/lib/useController.ts`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/desktop/frontend/src/lib/useController.ts), the reducer branch handling a `rebuild` action explicitly nullifies all extension-related state:

```typescript
// Inside useController.ts reducer (lines 2161-2176)
case "rebuild":
  return {
    ...state,
    // A rebuild restarts the runtime's extension sidecars too,
    // so extension state ... is cleared.
    extensionStatuses: {},
    extensionForm: undefined,
    extensionNotifications: [],
    extensionGenerations: {},
  };

```

This code demonstrates that **extension recovery is intentionally prevented**—the complete extension store is wiped rather than preserved.

### Step 3: Fresh Extension Instantiation

With extension state cleared, any subsequent extension interactions occur through newly instantiated side-cars. In-flight extension actions, pending notifications, and UI forms from the previous session are discarded.

## Code Implementation of Extension Recovery Policy

The following pattern illustrates how session resume operations trigger the extension reset mechanism:

```typescript
// Resume the current Goal before continuing session
const resumed = await app.ResumeGoalForTab(tabId);
if (!resumed) throw new Error("Goal resume failed");

// Dispatch resume hydration, which triggers rebuild
dispatchTo(tabId, {
  type: "hydrate_start",
  reason: "resume-session",
});

// In useController.ts reducer — extension state cleared on rebuild
case "rebuild":
  return {
    ...state,
    // Extension sidecars are restarted → clear their state
    extensionStatuses: {},
    extensionForm: undefined,
    extensionNotifications: [],
    extensionGenerations: {},
  };

```

The `rebuild` case at **lines 2161-2176** in [`useController.ts`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/useController.ts) is the critical implementation detail enforcing the **recovery policy for extensions**.

## Key Source Files Defining Extension Behavior

| File Path | Purpose | Critical Section |
|-----------|---------|----------------|
| [`desktop/frontend/src/lib/useController.ts`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/desktop/frontend/src/lib/useController.ts) | Core state machine for tab actions, resume logic, and extension handling | Lines 2161-2176 — explicit extension state clearing on rebuild |
| [`desktop/frontend/src/lib/bridge.ts`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/desktop/frontend/src/lib/bridge.ts) | Backend kernel communication; defines resumed transcript format | Lines 3598-3601 — resume payload structure confirming extension side-car restart |
| [`desktop/frontend/src/lib/deliveryContinue.ts`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/desktop/frontend/src/lib/deliveryContinue.ts) | Delivery continuation ensuring Goal resumption precedence | Lines 14-23 — `resumeGoal` must succeed before delivery continues |

## Why DeepSeek-Reasonix Rejects Extension State Persistence

The **recovery policy for extensions** during session resume reflects deliberate architectural trade-offs:

- **Determinism** — Fresh extension instances eliminate state synchronization errors between sessions
- **Simplicity** — No need to serialize, store, and replay complex extension side-car state
- **Isolation** — Prevents stale extension state from corrupting resumed sessions

Extensions must be re-loaded from source files or re-instantiated by the host UI hub after every resume operation.

## Summary

- **DeepSeek-Reasonix extension recovery policy** is "clear-and-restart" — no runtime state is preserved
- The `rebuild` reducer action in [`useController.ts`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/useController.ts) (lines 2161-2176) explicitly clears `extensionStatuses`, `extensionForm`, `extensionNotifications`, and `extensionGenerations`
- Extensions are **non-recoverable side-cars** that must re-initialize after every session resume
- This design maintains session consistency at the cost of extension state persistence

## Frequently Asked Questions

### What happens to extension notifications when a session resumes?

Extension notifications are **discarded**. The `extensionNotifications` array is reset to `[]` during the rebuild triggered by session resume. Any pending notifications from the previous session do not survive the transition.

### Can extensions opt into state persistence across session resumes?

No. According to the [`useController.ts`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/useController.ts) implementation, the extension clearing behavior is **hardcoded in the rebuild reducer**—there is no configuration flag or extension API to preserve runtime state. Extensions must re-initialize from scratch.

### Does the Goal resume before or after extensions are cleared?

The Goal resumes **before** extension clearing occurs. The `app.ResumeGoalForTab` call in [`deliveryContinue.ts`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/deliveryContinue.ts) (lines 14-23) must succeed first, then the subsequent `hydrate_start` dispatch triggers the rebuild that clears extension state. This ordering ensures the planning unit is valid before extension re-initialization begins.