# How to Enable Safe Resume Functionality in Apache Maka

> Learn how to enable Safe Resume in Apache Maka. Configure the resume_feature_enabled flag and ensure your storage backend supports continuation authority for seamless recovery.

- Repository: [The Apache Software Foundation/maka](https://github.com/apache/maka)
- Tags: how-to-guide
- Published: 2026-09-09

---

**Safe Resume in Apache Maka requires two conditions: a storage backend that supports continuation authority and the `resume_feature_enabled` configuration flag set to `true`.**

Safe Resume (also called Safe Resume Ownership) allows **Apache Maka** to continue interrupted tasks by reliably restoring execution context from the last trusted boundary. This guide explains the source-level requirements and step-by-step configuration based on the Maka codebase.

## Requirements for Safe Resume

Maka enforces two strict requirements before allowing a resume operation:

| Requirement | Purpose | Source Location |
|-------------|---------|---------------|
| **Storage must support safe-resume ownership** | The storage layer must store and retrieve a `continuation_authority` record proving the last execution boundary is trusted | [`packages/ui/src/runtime-resume-copy.ts`](https://github.com/apache/maka/blob/main/packages/ui/src/runtime-resume-copy.ts) |
| **`resume_feature_enabled` must be `true`** | The runtime checks this flag before processing any resume request | [`packages/runtime/src/runtime-resume.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/runtime-resume.ts) |

When storage lacks support, Maka displays: *"The current storage does not support safe resume ownership."* When the feature flag is disabled, users see: *"Resuming interrupted tasks is not enabled."*

## Step 1: Use a Supported Storage Backend

The **SQLite runtime store** implements the required `ContinuationAuthority` interface by default.

- **Default option**: Use [`sqlite-runtime-store.ts`](https://github.com/apache/maka/blob/main/sqlite-runtime-store.ts) ([`packages/storage/src/sqlite-runtime-store.ts`](https://github.com/apache/maka/blob/main/packages/storage/src/sqlite-runtime-store.ts))
- **Custom storage**: Implement the `ContinuationAuthority` interface to expose continuation authority records

The storage layer persists proof that the last execution boundary is trustworthy, enabling Maka to safely reconstruct state.

## Step 2: Enable the Feature Flag

Add the configuration to your Maka config file (YAML or JSON):

```yaml
features:
  resume_feature_enabled: true

```

Or pass it directly to the engine constructor:

```typescript
import { MakaEngine } from '@maka/runtime';

const engine = new MakaEngine({
  features: {
    resume_feature_enabled: true,  // critical for safe resume
  },
});
await engine.start();

```

The runtime reads this flag in [`packages/runtime/src/runtime-resume.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/runtime-resume.ts) before allowing resume operations.

## Step 3: Set Environment Variable (Optional)

For CI/CD or containerized deployments, use the environment variable fallback:

```bash
export MAKA_RESUME_FEATURE=1

```

The runtime checks this variable when no explicit config exists.

## Step 4: Restart and Verify

After configuration changes:

1. **Restart Maka** — the host boot sequence ([`runtime-host-boot.ts`](https://github.com/apache/maka/blob/main/runtime-host-boot.ts)) logs the flag status
2. **UI verification** — look for *"Continuing this turn"* instead of the disabled message ([`apps/desktop/src/main/workhub-presentation.ts`](https://github.com/apache/maka/blob/main/apps/desktop/src/main/workhub-presentation.ts))
3. **Log verification** — check that `resume_feature_enabled` appears as `true` in boot logs

## Code Examples

### Checking Resume Availability in UI Code

```typescript
import { getConfig } from '@maka/config';
import { continuationAuthorityUnavailable, resumeFeatureNotEnabled } from '@maka/ui/runtime-resume-copy';

function showResumeOption(): boolean {
  const config = getConfig();
  
  if (!config.features.resume_feature_enabled) {
    showToast(resumeFeatureNotEnabled);  // "Resuming interrupted tasks is not enabled."
    return false;
  }
  
  if (!storage.hasContinuationAuthority()) {
    showToast(continuationAuthorityUnavailable);  // storage doesn't support ownership
    return false;
  }
  
  return true;
}

```

### Custom Storage Implementation

```typescript
import { SqliteRuntimeStore } from '@maka/storage/sqlite-runtime-store';

// Extend the SQLite store or implement ContinuationAuthority directly
class CustomSafeStore extends SqliteRuntimeStore {
  // Inherits continuation_authority handling
  // Override for custom persistence logic if needed
}

```

## Key Source Files

| File Path | Role in Safe Resume |
|-----------|-------------------|
| [`packages/runtime/src/runtime-resume.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/runtime-resume.ts) | Reads `resume_feature_enabled` flag; gates resume requests |
| [`packages/ui/src/runtime-resume-copy.ts`](https://github.com/apache/maka/blob/main/packages/ui/src/runtime-resume-copy.ts) | Defines UI messages including `continuation_authority_unavailable` |
| [`packages/storage/src/sqlite-runtime-store.ts`](https://github.com/apache/maka/blob/main/packages/storage/src/sqlite-runtime-store.ts) | Implements continuation authority persistence |
| [`apps/desktop/src/main/workhub-presentation.ts`](https://github.com/apache/maka/blob/main/apps/desktop/src/main/workhub-presentation.ts) | Desktop UI presentation logic for resume flow |
| [`packages/runtime/src/runtime-host-boot.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/runtime-host-boot.ts) | Logs feature flag status during initialization |

## Summary

- **Storage requirement**: Use SQLite runtime store or implement `ContinuationAuthority` interface
- **Configuration requirement**: Set `resume_feature_enabled: true` in config or `MAKA_RESUME_FEATURE=1` as environment variable
- **Verification**: Restart Maka and confirm via UI toasts and boot logs that Safe Resume is active
- **Source enforcement**: Runtime checks in [`runtime-resume.ts`](https://github.com/apache/maka/blob/main/runtime-resume.ts) and storage validation in [`sqlite-runtime-store.ts`](https://github.com/apache/maka/blob/main/sqlite-runtime-store.ts) prevent unsafe resume attempts

## Frequently Asked Questions

### What happens if I try to resume without enabling the feature flag?

Maka displays *"Resuming interrupted tasks is not enabled"* and blocks the operation. The runtime checks `resume_feature_enabled` in [`packages/runtime/src/runtime-resume.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/runtime-resume.ts) before processing any resume request.

### Does Safe Resume work with custom storage backends?

Yes, but your custom storage must implement the `ContinuationAuthority` interface to store and retrieve continuation authority records. Without this capability, Maka shows *"The current storage does not support safe resume ownership."*

### Can I enable Safe Resume only for specific environments?

Yes. Use the `MAKA_RESUME_FEATURE=1` environment variable for targeted enablement in staging or production containers, while keeping it disabled in development via the absence of the variable or explicit `resume_feature_enabled: false` in local config files.