Skip to content

test(e2e): poll restart conversation history - #1663

Open
PierrunoYT wants to merge 1 commit into
Zoo-Code-Org:mainfrom
PierrunoYT:fix/1641-restart-persistence-poll
Open

PierrunoYT wants to merge 1 commit into
Zoo-Code-Org:mainfrom
PierrunoYT:fix/1641-restart-persistence-poll

Conversation

@PierrunoYT

Copy link
Copy Markdown

Related GitHub Issue

Closes: #1641

Description

The restart-persistence E2E previously checked persisted API conversation history with one immediate read after extension-host restart and another after reopening the task. Those reads could land in safeWriteJson's atomic-rename swap window, where the destination path is briefly absent, and report a false negative.

This change routes both checks through a shared waitForMarkedCompletion helper. It repeatedly calls the same api.hasTaskApiConversationHistorySequence read used by the original assertions until the sequence becomes visible or the existing 30-second waitFor deadline expires. There are no fixed sleeps and no production persistence behavior changes.

Test Procedure

pnpm --filter @roo-code/vscode-e2e lint
pnpm --filter @roo-code/vscode-e2e check-types
pnpm lint
pnpm check-types
pnpm exec prettier --check apps/vscode-e2e/src/suite/restart-persistence.test.ts
git diff --check

All commands pass. The commit and push hooks also completed the full workspace lint/typecheck gates (11/11 packages).

The targeted command below built the extension and webview and downloaded the pinned VS Code binary, but could not launch native VS Code in the local orb because no X display or xvfb-run is available. CI's mocked E2E runner should execute this exact scenario:

TEST_FILE=restart-persistence.test pnpm --filter @roo-code/vscode-e2e test:ci:mock

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue.
  • Scope: The change is limited to the restart-persistence E2E read race.
  • Self-Review: I have performed a self-review.
  • Testing: The affected package and workspace lint/typecheck gates pass; CI will run the graphical E2E.
  • Visual Snapshot: N/A — test synchronization only; no UI changes.
  • Documentation Impact: No documentation updates are required.
  • Contribution Guidelines: I have read and agree to the contributor guidelines.

Visual Snapshots

N/A — no UI changes.

Videos (interaction / animation only)

N/A.

Documentation Updates

  • No documentation updates are required.

Additional Notes

The production write ordering and history loader are intentionally unchanged. This only makes the E2E tolerate the already-documented atomic publication window.

Get in Touch

GitHub: @PierrunoYT

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c67781b8-e285-4a4c-9f2f-32a766463f6a

📥 Commits

Reviewing files that changed from the base of the PR and between 500152b and 1312150.

📒 Files selected for processing (1)
  • apps/vscode-e2e/src/suite/restart-persistence.test.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (5)
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.

⚙️ CodeRabbit configuration file

Files:

  • apps/vscode-e2e/src/suite/restart-persistence.test.ts
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.

⚙️ CodeRabbit configuration file

Files:

  • apps/vscode-e2e/src/suite/restart-persistence.test.ts
Reserve end-to-end coverage for behavior that requires the real VS Code host, workspace APIs, extension activation, webview messaging, file watchers, or a full workflow.

⚙️ CodeRabbit configuration file

Files:

  • apps/vscode-e2e/src/suite/restart-persistence.test.ts
Act as an adversarial second-opinion reviewer.

⚙️ CodeRabbit configuration file

Files:

  • apps/vscode-e2e/src/suite/restart-persistence.test.ts
Use short, stable, unique text in the task prompt.

📄 CodeRabbit inference engine (apps/vscode-e2e/AGENTS.md)

Files:

  • apps/vscode-e2e/src/suite/restart-persistence.test.ts
🔇 Additional comments (1)
apps/vscode-e2e/src/suite/restart-persistence.test.ts (1)

28-37: LGTM!

Also applies to: 99-99, 110-110


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved verification of restored and reopened tasks by waiting for completion sequences to appear before checking results.
    • Increased reliability of persistence checks during application restart scenarios.

Walkthrough

The restart-persistence end-to-end test now polls task history for the expected completion sequence. The restored-task and reopened-task checks use this polling instead of immediate boolean assertions.

Changes

Restart persistence validation

Layer / File(s) Summary
Poll completion history before assertions
apps/vscode-e2e/src/suite/restart-persistence.test.ts
Adds waitForMarkedCompletion and uses it for restored and reopened task completion checks. The helper waits for the expected smoke-test user turn, attempt_completion tool call, and marker input.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 13121

The restart-persistence checks now wait for the expected persisted completion sequence, avoiding transient atomic-rename read failures without adding fixed delays.

🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #1641 requires bounded polling without fixed sleeps and requires the polling read to match the assertion read. The changed restart-persistence.test.ts adds waitForMarkedCompletion, which cal…
Out of Scope Changes check ✅ Passed The diff changes only apps/vscode-e2e/src/suite/restart-persistence.test.ts. It adds a shared polling helper and replaces the two restart-persistence history checks. These changes directly support i…
Regression Evidence ✅ Passed The PR changes only restart-persistence.test.ts. The changed polling behavior has focused coverage in the same restart-persistence E2E: waitForMarkedCompletion calls `api.hasTaskApiConversationHis…
Security Boundaries ✅ Passed PASS. The pull request changes only apps/vscode-e2e/src/suite/restart-persistence.test.ts. The new helper repeatedly performs the existing read-only api.hasTaskApiConversationHistorySequence call …
Persistence Integrity ✅ Passed PASS. The pull request changes only apps/vscode-e2e/src/suite/restart-persistence.test.ts. It replaces two immediate reads with await waitForMarkedCompletion(...); that helper awaits waitFor, an…
Lifecycle Resource Cleanup ✅ Passed No changed lifecycle path can be shown to leak or duplicate work. The PR only adds waitForMarkedCompletion, which performs sequential api.hasTaskApiConversationHistorySequence reads through the ex…
Title check ✅ Passed The title clearly and concisely describes the main change: polling restart conversation history in the E2E test.
Description check ✅ Passed The description includes the linked issue, implementation details, test procedure, test limitations, checklist, snapshot and documentation decisions, and reviewer context. It is complete and aligned w…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: Wait for GitHub to finish calculating mergeability.

Review-state labels are managed by this workflow; do not edit them manually.

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Sep 16, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-maintainer CodeRabbit approved; waiting for a human maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Make the restart-persistence e2e tolerate the atomic-rename swap window when reading API conversation history

2 participants