Skip to content

[Fix] Subtask approval E2E times out after task restoration - #1434

Merged
edelauna merged 2 commits into
mainfrom
fix/subtask-approval-e2e-flake-2wi44j7kgz2ig
Aug 29, 2026
Merged

[Fix] Subtask approval E2E times out after task restoration#1434
edelauna merged 2 commits into
mainfrom
fix/subtask-approval-e2e-flake-2wi44j7kgz2ig

Conversation

@zoomote

@zoomote zoomote Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

​Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

Related GitHub Issue

Follow-up to #1223 and #1320.

Description

Await both asynchronous task restorations in the pending-subtask-approval E2E test before observing or approving the restored action. Enable type-aware @typescript-eslint/no-floating-promises across the E2E module so this class of race fails lint, and make the existing async entry points, event handlers, test registrations, and polling helper explicit about promise ownership. The polling helper now also clears its timers deterministically on success, rejection, and timeout.

Test Procedure

  • Run the ordered mocked subtask E2E suite repeatedly. The suite passed 10 consecutive runs after reproducing the timeout on run 4 before the change.
  • Run pnpm --filter @roo-code/vscode-e2e lint.
  • Run pnpm --filter @roo-code/vscode-e2e check-types.
  • Run pnpm --filter @roo-code/vscode-e2e themes:test.
  • Run pnpm test.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above). Follow-up to the regression coverage added in [Fix] Restore subtask approvals when users return to tasks #1320.
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Visual Snapshot (UI changes only): If a user would notice this change at a glance (layout, theme tokens, brand elements, empty/error states), I've added or updated a *.visual.tsx snapshot in webview-ui/. See webview-ui/AGENTS.md -> "When a UI change needs a snapshot". Not applicable; this is test synchronization only.
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Visual Snapshots

Not applicable. There is no UI change.

Videos (interaction / animation only)

Not applicable.

Documentation Updates

  • No documentation updates are required. This changes only E2E synchronization and lint enforcement.
  • Yes, documentation updates are required.

Additional Notes

The original failure timed out after restoring the parent but before creating the child. The test passed 10/10 in isolation before the fix, confirming the flake depended on ordered lifecycle timing rather than approval-recovery behavior. Enabling the new lint rule surfaced eight existing call sites; all were resolved rather than baselined or suppressed.

Get in Touch

Follow up in the linked Discord thread or mention @roomote on this PR.

@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna force-pushed the fix/subtask-approval-e2e-flake-2wi44j7kgz2ig branch from 934ef0d to 993ebd9 Compare August 29, 2026 12:54
@edelauna
edelauna marked this pull request as ready for review August 29, 2026 12:54
@edelauna

Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review 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: Pro Plus

Run ID: ee903d07-4dc9-480d-9ef2-9a10cc1caa07

📥 Commits

Reviewing files that changed from the base of the PR and between 993ebd9 and 165ea60.

📒 Files selected for processing (5)
  • apps/vscode-e2e/eslint.config.mjs
  • apps/vscode-e2e/src/runTest.ts
  • apps/vscode-e2e/src/suite/index.ts
  • apps/vscode-e2e/src/suite/utils.ts
  • apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts

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

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (9)
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases. Check cleanup and deterministic async behavior and prefer shared typed test helpe...

⚙️ CodeRabbit configuration file

Files:

  • apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths. Verify promises and errors are handled, existing helpers are reused, and new code introduces no `any`, unjustified dou...

⚙️ CodeRabbit configuration file

Files:

  • apps/vscode-e2e/src/suite/index.ts
  • apps/vscode-e2e/src/runTest.ts
  • apps/vscode-e2e/src/suite/utils.ts
  • apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts
  • apps/vscode-e2e/eslint.config.mjs
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. Keep detailed protocol, parsing, storage, retry, and edge cases at low...

⚙️ CodeRabbit configuration file

Files:

  • apps/vscode-e2e/src/suite/index.ts
  • apps/vscode-e2e/src/runTest.ts
  • apps/vscode-e2e/src/suite/utils.ts
  • apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts
  • apps/vscode-e2e/eslint.config.mjs
Act as an adversarial second-opinion reviewer. Verify PR claims against implementation, contracts, and tests. Trace changed inputs through normal, boundary, error, cancellation, retry, and default paths and their consumers. Seek plausible c...

⚙️ CodeRabbit configuration file

Files:

  • apps/vscode-e2e/src/suite/index.ts
  • apps/vscode-e2e/src/runTest.ts
  • apps/vscode-e2e/src/suite/utils.ts
  • apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts
  • apps/vscode-e2e/eslint.config.mjs
Add focused tests for UI binding and save behavior, persistence or normalization, and the value returned by `getStateToPostToWebview()`, including true and false/unset cases when defaults could hide omissions.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts
Fix lint violations in new TypeScript code instead of suppressing them.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • apps/vscode-e2e/src/suite/index.ts
  • apps/vscode-e2e/src/runTest.ts
  • apps/vscode-e2e/src/suite/utils.ts
  • apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts
Keep e2e tests focused on high-value cross-boundary smoke coverage; do not place detailed protocol, parsing, storage, retry, or edge-case assertions there when lower-level tests can cover them.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts
Prefer package-local unit or integration tests over E2E tests; use E2E tests for real extension-host boundaries and full-workflow smoke checks rather than detailed service, protocol, or UI assertions.

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

Files:

  • apps/vscode-e2e/src/suite/index.ts
  • apps/vscode-e2e/src/suite/utils.ts
Use `mock.addFixture()` with a `RegExp` match for requests that cannot be matched by a stable substring; programmatic fixtures are replay-only and are not recorded.

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

Files:

  • apps/vscode-e2e/src/runTest.ts
🔇 Additional comments (5)
apps/vscode-e2e/eslint.config.mjs (1)

4-18: LGTM!

apps/vscode-e2e/src/runTest.ts (1)

234-237: LGTM!

apps/vscode-e2e/src/suite/index.ts (1)

38-40: LGTM!

apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts (1)

23-23: LGTM!

Also applies to: 48-48, 58-58, 74-74, 84-84

apps/vscode-e2e/src/suite/utils.ts (1)

12-46: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved end-to-end workflow reliability by ensuring task resumption completes before approval checks run.
    • Improved handling of timing issues and unexpected failures during automated workflows, reducing the likelihood of incomplete or misleading results.
    • Enhanced test execution stability and error reporting for more dependable validation of task and approval flows.

Walkthrough

The VS Code E2E changes enforce floating-promise checks, handle asynchronous failures, rewrite polling cleanup, and await task resumption before approval assertions.

Changes

VS Code E2E promise handling

Layer / File(s) Summary
Enforce and handle promises
apps/vscode-e2e/eslint.config.mjs, apps/vscode-e2e/src/runTest.ts, apps/vscode-e2e/src/suite/index.ts, apps/vscode-e2e/src/theme-fixtures/fixtures.test.ts
The TypeScript ESLint override reports floating promises as errors. Runner and approval failures are logged and propagated through process status. Theme fixture test declarations explicitly discard returned promises.
Rewrite waitFor polling
apps/vscode-e2e/src/suite/utils.ts
waitFor uses one promise with guarded settlement, recursive polling, timeout rejection, and cleanup for both timers.
Await task resumption
apps/vscode-e2e/src/suite/subtasks.test.ts
The pending subtask approval test awaits parent and child resumeTask calls before approval assertions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 165ea

This localized change synchronizes asynchronous E2E task restoration and strengthens promise-handling checks without introducing a known production-impacting issue; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: edelauna

🚥 Pre-merge checks | ✅ 5 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Regression Evidence ⚠️ Warning The pending-subtask E2E test provides focused coverage for the awaited parent and child restorations. However, apps/vscode-e2e/src/suite/utils.ts has a substantial changed behavior with no focused c… Add lowest-layer tests for waitFor that cover eventual success, timeout rejection, synchronous condition errors, asynchronous condition rejection, and that polling stops after each settlement. Add focused tests for the new top-level clean…
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: fixing the pending-subtask-approval E2E timeout after task restoration.
Description check ✅ Passed The description explains the root cause, implementation, promise-handling changes, timer cleanup, testing steps, and scope. It references related issues and completes the required sections. The issue-…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Trust And Persistence Invariants ✅ Passed PASS. The changed paths do not introduce a secret/PII leak, input trust bypass, approval bypass, or persisted-state loss. subtasks.test.ts now awaits both api.resumeTask() calls before checking or…
Full details: Description check

Explanation

The description explains the root cause, implementation, promise-handling changes, timer cleanup, testing steps, and scope. It references related issues and completes the required sections. The issue-link checklist remains unchecked, but the description is otherwise substantially complete.

Full details: Regression Evidence

Explanation

The pending-subtask E2E test provides focused coverage for the awaited parent and child restorations. However, apps/vscode-e2e/src/suite/utils.ts has a substantial changed behavior with no focused coverage. The new waitFor implementation adds condition-error rejection and deterministic cleanup on success, rejection, and timeout. The repository has no utils test file, and its call sites only exercise successful polling or swallow timeout errors. The new rejection handling in runTest.ts and suite/index.ts also has no focused test. No visible UI changed, so the Playwright snapshot condition does not apply.

Resolution

Add lowest-layer tests for waitFor that cover eventual success, timeout rejection, synchronous condition errors, asynchronous condition rejection, and that polling stops after each settlement. Add focused tests for the new top-level cleanup rejection handling in runTest.ts and the approveCurrentAsk() rejection handler in suite/index.ts, or extract those handlers into testable functions. Retain the existing pending-subtask E2E test for restoration sequencing.

Full details: Trust And Persistence Invariants

Explanation

PASS. The changed paths do not introduce a secret/PII leak, input trust bypass, approval bypass, or persisted-state loss. subtasks.test.ts now awaits both api.resumeTask() calls before checking or approving restored asks. waitFor clears its timeout and polling timer on success, rejection, and timeout, and guards late condition completion with settled. runTest.ts attaches a rejection handler while retaining the existing cleanup finally path. The approval handler logs rejected approvals instead of bypassing approval. No changed path creates a new lifecycle-resource leak.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/subtask-approval-e2e-flake-2wi44j7kgz2ig

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/vscode-e2e/eslint.config.mjs

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

apps/vscode-e2e/src/runTest.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

apps/vscode-e2e/src/suite/index.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

  • 2 others

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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 29, 2026
@edelauna

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Aug 29, 2026
@edelauna
edelauna added this pull request to the merge queue Aug 29, 2026
Merged via the queue into main with commit b55ff87 Aug 29, 2026
20 checks passed
@edelauna
edelauna deleted the fix/subtask-approval-e2e-flake-2wi44j7kgz2ig branch August 29, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants