How to Enable Safe Resume Functionality in Apache Maka
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 |
resume_feature_enabled must be true |
The runtime checks this flag before processing any resume request | 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(packages/storage/src/sqlite-runtime-store.ts) - Custom storage: Implement the
ContinuationAuthorityinterface 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):
features:
resume_feature_enabled: true
Or pass it directly to the engine constructor:
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 before allowing resume operations.
Step 3: Set Environment Variable (Optional)
For CI/CD or containerized deployments, use the environment variable fallback:
export MAKA_RESUME_FEATURE=1
The runtime checks this variable when no explicit config exists.
Step 4: Restart and Verify
After configuration changes:
- Restart Maka — the host boot sequence (
runtime-host-boot.ts) logs the flag status - UI verification — look for "Continuing this turn" instead of the disabled message (
apps/desktop/src/main/workhub-presentation.ts) - Log verification — check that
resume_feature_enabledappears astruein boot logs
Code Examples
Checking Resume Availability in UI Code
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
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 |
Reads resume_feature_enabled flag; gates resume requests |
packages/ui/src/runtime-resume-copy.ts |
Defines UI messages including continuation_authority_unavailable |
packages/storage/src/sqlite-runtime-store.ts |
Implements continuation authority persistence |
apps/desktop/src/main/workhub-presentation.ts |
Desktop UI presentation logic for resume flow |
packages/runtime/src/runtime-host-boot.ts |
Logs feature flag status during initialization |
Summary
- Storage requirement: Use SQLite runtime store or implement
ContinuationAuthorityinterface - Configuration requirement: Set
resume_feature_enabled: truein config orMAKA_RESUME_FEATURE=1as 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.tsand storage validation insqlite-runtime-store.tsprevent 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 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.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →