Skip to content

fix(harness): preserve final Assistant history checkpoints [SAP-3292] - #999

Closed
ynadge wants to merge 1 commit into
assistant-dormant-allocationfrom
assistant-history-checkpoints
Closed

ynadge wants to merge 1 commit into
assistant-dormant-allocationfrom
assistant-history-checkpoints

Conversation

@ynadge

@ynadge ynadge commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Primary change type

  • Bug fix

Problem and motivation

Retained history can miss the last completed snapshot when the native process exits, and streamed text deltas can cause excessive snapshot writes. Harmless credential refresh also rejected an otherwise authorized history read.

Summary and scope

Throttle background capture, flush explicit persistence/idle checkpoints, and allow an ordinary native exit up to 750 ms to finish its capture. End, access loss, workspace changes, and shutdown preempt immediately. Compare captured authority facts across history reads so unchanged grants can refresh safely. Document the retained-history endpoint and its bounds.

Related work

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

Depends on #998; follows review of #992. Native stack target: main.

Validation

pnpm --filter @sapiom/harness exec vitest run src/core/opencode-host.test.ts src/core/assistant-record-capture.test.ts src/core/assistant-history-access.test.ts src/core/opencode-observer.test.ts — 76 passed
pnpm --filter @sapiom/harness typecheck — passed
pnpm exec eslint (changed production files) — passed
git diff --check — passed

Tests and documentation

Regression tests exercise exit-time persistence, deadline, retirement preemption, stale completion after replacement, throttling, and changed versus refreshed authority. Added docs/assistant-history.md. The repository has no pr:size script; the measured increment is 351 changed lines including tests and documentation.

Compatibility and release impact

  • Breaking or externally visible changes: retained records can include a final in-flight checkpoint; explicit End remains immediate.
  • Changeset: N/A within the same unreleased capture feature stack, which already includes its package changeset.
  • Fix-forward: correct checkpoint scheduling in a follow-up while preserving the last retained record and immediate execution fencing.

Security

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

AI assistance

  • AI assistance used: Codex implemented the fixes and regressions; the root agent reviewed the lifetime boundary, wired production checkpoints, and reran targeted tests.

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.

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: f865f8ad-95ce-4ada-a723-9a8ce8ef2270

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: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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