Skip to content

feat(harness): validate original Assistant context on Resume [SAP-3292] - #1015

Closed
ynadge wants to merge 1 commit into
assistant-native-resumefrom
assistant-resume-preflight
Closed

ynadge wants to merge 1 commit into
assistant-native-resumefrom
assistant-resume-preflight

Conversation

@ynadge

@ynadge ynadge commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Primary change type

  • Feature

Problem and motivation

Resume must validate the exact saved native conversation and original execution context before making that runtime available again.

Summary and scope

Reuse the bounded native-history reader inside the Resume coordinator's retained operation. Revalidate the complete saved association around IO, preserve typed missing-history/context errors, and return only a public attachment. Empty saved conversations do not invent context. No prompt, replacement association, or Terminal startup occurs.

Related work

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

Depends on #1014. Native stack target: main.

Validation

Resume, Resume-store, nativeHistory, lifecycle, End, host and router suites — 188 passed
Full Harness server and web TypeScript; scoped ESLint; git diff --check — passed

Tests and documentation

Native-history cases cover exact GET-only Resume, empty saved history, complete association changes, missing history/context, and hung authorization/query/preflight. Updated assistant-history.md. Increment:352 changed lines including tests/docs/changeset; SDK pr:size script is absent.

Compatibility and release impact

  • Additive explicit Resume consumer; existing inspection uses the same validated reader.
  • Changeset: @sapiom/harness patch.
  • Fix-forward: preserve exact binding and read-only context preflight while correcting Resume validation.

Security

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

AI assistance

  • AI assistance used: Codex implemented and reviewed the consumer and focused failure tests.

Checklist

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

Devin Review

@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: 0190cb11-6bb6-4e6c-8be5-668e9b5dc14c

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 +97 to +101
async resume(
id: string,
expectedRevision: number,
operationId: string,
): Promise<AssistantAttachment> {

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.

🔴 Resume validation is never used

Production never calls AssistantNativeHistory.resume. The attach endpoint still uses attach, so restored sessions bypass the new validation.

Learn more

AssistantNativeHistory has no production imports or construction sites. Only its unit test instantiates it. The browser resumes an ended session through POST /opencode/:id/attach, which calls AssistantLifecycleCoordinator.attach. That path can start the saved runtime and return a lease without executing this reader or its retained-context preflight.

Example: After a server restart, a saved conversation references unavailable retained context. Opening it calls attach, starts the runtime, and returns a lease. The new resume validation never runs, so execution can continue despite the unavailable context.

Recommended fix: Construct AssistantNativeHistory in startServer with the saved-association authority and delivery recovery preflight. Route explicit Resume requests to AssistantNativeHistory.resume with an operation UUID, while preserving ordinary live-runtime attachment behavior.

Devin Review

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

@ynadge ynadge closed this Sep 15, 2026
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