Skip to content

[M1.3c] Resume or compensate interrupted operations - #39

Merged
samuelmbabhazi merged 2 commits into
mainfrom
feat/m1.3c-operation-recovery
Nov 5, 2026
Merged

samuelmbabhazi merged 2 commits into
mainfrom
feat/m1.3c-operation-recovery

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

Completes M1.3 with the resumable/compensating executor and daemon-owned SQLite lifecycle. Depends on #38 and targets its branch.

The executor records each step before its side effect and checkpoints completion afterwards. After an uncertain interruption it retries explicitly retry-safe steps; otherwise it compensates the uncertain step and completed predecessors in reverse order. Compensations must be idempotent and are checkpointed themselves. Idempotency binds the payload to a versioned plan and its ordered recovery policy, and concurrent execution is serialized. Committed transitions are delivered through an ActionUpdate callback; delivery failures pause further effects and retry republishes the latest durable state.

The daemon acquires the journal's exclusive process lock at startup and closes SQLite during shutdown. It reports unfinished operations for later registered handlers; this foundation introduces no Docker/Caddy action or stream dispatcher. Those remain their own planned milestones.

Validation: crash injection after every one of three steps for both recovery policies; interruption during compensation; concurrent duplicate execution; cached outcomes; changed-plan rejection; notification failure; cancellation preserving intent; real SQLite reopen. Go race suite and golangci-lint pass. The startup test now waits for actual readiness instead of a fixed sleep, covering the new SQLite initialization. TypeScript/protobuf checks and the binary-size budget pass.

  • M1.3 acceptance criteria and recovery framework tests
  • Durable transition history and callback notifications
  • No new action, shell execution or raw payload/error persistence
  • Plan, spec and threat model updated
  • CI and maintainer review

No merge requested. This independent M1.3 stack is based on main; the separate M1.2c daemon changes will need their ordinary review-time integration.

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m1.3c-operation-recovery branch from ab5aeec to 8f09d5f Compare November 5, 2026 13:29
@samuelmbabhazi

Copy link
Copy Markdown
Collaborator Author

Rebased onto the updated #38; additive THREAT_MODEL conflict kept from both sides.

Review follow-ups added as commit 8f09d5f:

  • If announcing a step start fails, the step marker is cleared before returning, so a retry no longer compensates a non-retry-safe step whose side effect never ran.
  • Journal checkpoints use a non-cancellable context with a 10 s timeout, and success is recorded before checking for shutdown, so a step completing during SIGTERM is not compensated on restart.
  • After five failed compensation attempts the operation moves Compensating → Failed (terminal) instead of retrying on every boot.
  • agent.Run no longer swallows a journal close error when the run ends by cancellation.

Each has a regression test, checked to fail without the fix. SPEC 3.4 updated.

@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m1.3b-local-state to main November 5, 2026 14:18
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m1.3c-operation-recovery branch from 8f09d5f to 5ec511d Compare November 5, 2026 14:20
@samuelmbabhazi
samuelmbabhazi merged commit 57e89e0 into main Nov 5, 2026
2 of 11 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m1.3c-operation-recovery branch November 5, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant