Skip to content

feat(harness): commit Resume intent atomically [SAP-3292] - #1010

Closed
ynadge wants to merge 1 commit into
assistant-continuation-receiptsfrom
assistant-resume-receipts
Closed

ynadge wants to merge 1 commit into
assistant-continuation-receiptsfrom
assistant-resume-receipts

Conversation

@ynadge

@ynadge ynadge commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Primary change type

  • Feature

Problem and motivation

A lost Resume acknowledgement must identify the exact operation that reopened the original Assistant. Separate lifecycle and receipt writes leave a crash window with no reliable proof.

Summary and scope

Commit private Resume operation UUID, original revision and exact saved-association digest atomically with the open lifecycle. Strip the proof from all public lifecycle projections. Exact retries reconcile the committed revision; later lifecycle changes invalidate replay. Restoring a runtime after a crash advances a paused lifecycle under the same operation proof.

Related work

Related issue: https://linear.app/sapiom/issue/SAP-3292

Depends on #1009. Native stack target: main. The next coordinator consumer performs exact native/context preflight and lease handoff.

Validation

Resume store and related lifecycle/files suites — 77 passed
Final UUID-constrained Resume store suite — 18 passed
Scoped ESLint and git diff --check — passed
Full Harness TypeScript rerun — passed after concurrent native-helper fixture correction

Tests and documentation

Real-file tests cover concurrent commits, exact duplicate writes, restart reconciliation, changed binding/request/revision, private proof stripping, corrupt metadata, cancellation and post-publication fsync rollback. Updated assistant-history.md. Increment:407 changed lines including tests/docs/changeset; pr:size is absent.

Compatibility and release impact

  • Breaking or externally visible changes: additive private lifecycle metadata; existing public lifecycle schema unchanged.
  • Changeset: added for @sapiom/harness.
  • Fix-forward: preserve operation identity and lifecycle revisions while correcting reconciliation; never infer a missing native association.

Security

  • No secrets, credentials, private data, or unsanitized logs included.
  • No suspected vulnerability disclosed publicly.

AI assistance

  • AI assistance used: Codex implemented the atomic Resume store and tests; root reviewed the strict UUID and private/public contract and verified test evidence.

Checklist

  • CONTRIBUTING.md read; maintainer-authorized issue work.
  • One focused increment, tests, relevant checks, documentation, and release impact addressed above.
  • I can explain and maintain the submitted changes.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 9eaac1d2-0acc-4310-916a-604f4369ace1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +194 to +195
if (retry && expected === request.expectedRevision)
return publicLifecycle(current!);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Altered retry execution goes unnoticed

When an operation ID is retried with different execution, commitResume returns the prior lifecycle instead of rejecting the changed intent. Callers receive success for an operation they did not request.

Learn more

execution controls the lifecycle written by the original Resume commit, but it is not included in the persisted operation proof. The early idempotent-return path therefore needs to compare it against the committed lifecycle. This check applies only to a duplicate submitted from the original revision; crash restoration from the committed revision can still deliberately advance the operation to paused execution.

Example: An open, enabled session at revision 1 commits operation f187… with execution: "enabled", producing revision 2. A retry of f187… from revision 1 with execution: "paused" currently succeeds and returns the enabled revision 2 lifecycle instead of rejecting the changed request.

Recommended fix: Before the early return in commitResume, require current.execution === execution. Keep restart reconciliation unchanged when expected is the proof's committed revision.

Suggested change
if (retry && expected === request.expectedRevision)
return publicLifecycle(current!);
if (retry && expected === request.expectedRevision) {
if (current!.execution !== execution)
throw new AssistantSessionRevisionError();
return publicLifecycle(current!);
}
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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