Skip to content

fix(e2e): stabilize flaky E2E tests against timing races - #20900

Merged
AmethystLiang merged 2 commits into
mainfrom
auto-e2e-tests-autofix-scheduled-ci-1h-run-58-20260915T0700
Sep 16, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
auto-e2e-tests-autofix-scheduled-ci-1h-run-58-20260915T0700

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​68 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​55
Prod 0 0 0 0

Problem

E2E tests are failing intermittently due to timing races between async operations: tab parking, status hydration, tooltip rendering, and terminal state updates.

Solution

Multiple targeted fixes to await stable states and scope assertions correctly:

  • Cold activation oracle: Wait for all tabs to reach stable parked state (0 mounted, 8 parked) instead of one-shot read that races the sweeper
  • Native chat hydration: Scope user/assistant text assertions to transcript subtree to avoid false matches in chrome elements
  • Onboarding host selection: Publish a verified runtime host status snapshot so skip-to-project-setup finds the host available instead of falling back to Local
  • Paired web host health: Encode faults in status snapshot at max sequence to prevent background hydration from overwriting the injected fault
  • Quick open tooltip: Clear stale tooltips before hover, increase timeout windows, add intervals for retry attempts
  • Terminal attention: Pass 'terminal-bell' marker value to markTerminalTabUnread() instead of relying on undefined

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

These are test-stabilization fixes only; no new test coverage needed.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • N/A — test-only changes
  • Self-reviewed for correctness, security, and performance
  • Test-only changes, cross-platform impact N/A
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@pullfrog pullfrog 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.

ℹ️ No critical issues — one minor consistency suggestion inline.

Reviewed changes

  • Cold-activation oracle — the pre-activation assertion now waits for a stable { mounted: 0, parked: 8 } state via expectStableColdActivationMountState instead of the one-shot read that raced the parking sweeper.
  • Native chat hydration — user/assistant text assertions are scoped to the [data-native-chat-root="true"] transcript subtree so chrome (worktree row, tab title) can't match.
  • Onboarding skip path — publishes a verified/ready host status snapshot at max sequence so the registered server reads available and a later hydrate can't downgrade it.
  • Paired-web unavailable host — encodes the blocked/disconnected fault in entry.snapshot (transport/verification/retired) at max sequence rather than a status-only write.
  • Quick-open tooltip — clears the pointer before re-hovering and widens the retry/timeouts.
  • Terminal attention — seeds the tab bell with the 'terminal-bell' marker value (matches production; a bare call stores undefined, which the DOM ignores).

ℹ️ Nitpicks

  • Both specs hardcode 2_147_483_647 as the "cannot be outbid" sequence sentinel. A shared named constant would keep the intent discoverable and flag the assumption if the store's sequence semantics ever change.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread tests/e2e/terminal-attention.spec.ts Resolved
@coderabbitai

coderabbitai Bot commented Sep 15, 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: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 4817fc88-5105-4e8f-8a0b-f7183860d182

📥 Commits

Reviewing files that changed from the base of the PR and between 0aee6e7 and 618ecae.

📒 Files selected for processing (2)
  • tests/e2e/onboarding.spec.ts
  • tests/e2e/terminal-attention.spec.ts

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


📝 Walkthrough

Walkthrough

The changes update five end-to-end tests. The terminal test now checks the stable parked state. The onboarding test publishes a verified ready host snapshot and uses a longer assertion timeout. The native chat test scopes transcript assertions. The quick-open test clears stale tooltips and increases retry timeouts. The terminal attention tests pass the explicit terminal-bell marker.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 618ec

The stabilized E2E setup supplies the required verified host and terminal marker values; no merge-blocking issue remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem and lists the main stabilization changes, but it omits required template sections and information. It does not include a linked issue, a dedicated Visual Proof sec… Add all required template sections. Include a valid issue reference after "Fixes #". Add a Visual Proof section with exactly "N/A" and a brief reason for the test-only changes. Complete or explicitly address AI Disclosure, Review, Agent ski…
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.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: stabilizing flaky E2E tests caused by timing races.
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.
Full details: Description check

Explanation

The description explains the problem and lists the main stabilization changes, but it omits required template sections and information. It does not include a linked issue, a dedicated Visual Proof section with the required N/A explanation, AI Disclosure, Review, Agent skill upstream boundary, or Notes content.

Resolution

Add all required template sections. Include a valid issue reference after "Fixes #". Add a Visual Proof section with exactly "N/A" and a brief reason for the test-only changes. Complete or explicitly address AI Disclosure, Review, Agent skill upstream boundary, Notes, and the remaining Testing and Checklist items.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.


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.

- Paired terminal: use stable cold activation assertion instead of
  racy one-shot read; background tabs park eagerly.
- Native chat: scope hydration assertions to transcript subtree to
  avoid false positives from UI chrome (worktree rows, tab titles).
- Onboarding: inject verified status snapshot with max sequence to
  prevent hydration from downgrading host health during skip-to-
  project-setup.
- Paired web: encode host health faults in snapshots with high
  sequence so real hydrations cannot outbid injected state.
- Quick open: clear prior tooltips and increase hover timeouts to
  handle streaming result remounting.
- Terminal attention: pass 'terminal-bell' to unread marker to match
  production contract (reads marker value, not presence).
@AmethystLiang
AmethystLiang force-pushed the auto-e2e-tests-autofix-scheduled-ci-1h-run-58-20260915T0700 branch from 0aee6e7 to 618ecae Compare September 16, 2026 07:50

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

Re-reviewed the delta since pullfrog's prior review (0aee6e7607): the branch was rebased and one new commit landed.

  • Terminal attention pane seed — markTerminalPaneUnread(paneKey, 'terminal-bell') now supplies a truthy reason, so applyTerminalPaneAttentionToManager actually sets data-terminal-attention; the prior bare call stored undefined, which the reads-value consumer ignores even though the keys-only helper still passed. This also clears the TS2554 flagged in the prior review.
  • Paired-web change removed — paired-web-add-project-unavailable-host.spec.ts is no longer in the diff; main now ships an equivalent, stricter setOnlyRuntimeHostHealth (snapshot at Number.MAX_SAFE_INTEGER, #20003), so the rebase dropped a redundant hunk rather than a live fix.

ℹ️ PR description still lists the dropped paired-web change

The PR body and the 248fe4bb8d commit message both advertise a paired-web host-health fix that is no longer in the diff. Harmless for a test-only PR, but worth correcting so the description matches the branch.

Technical details
# Stale PR description

## Affected sites
- PR #20900 body — "Paired web host health: Encode faults in status snapshot at max sequence..." bullet
- commit `248fe4bb8d` message — "Paired web: encode host health faults in snapshots with high sequence..."

## Required outcome
- Description and commit message match the actual 5-file diff (no paired-web file).

## Suggested approach (optional)
- Drop the paired-web bullet; `main` already carries the fix (#20003).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@AmethystLiang
AmethystLiang merged commit 852ee90 into main Sep 16, 2026
30 of 34 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
)

* fix(e2e): stabilize flaky E2E tests against timing races

- Paired terminal: use stable cold activation assertion instead of
  racy one-shot read; background tabs park eagerly.
- Native chat: scope hydration assertions to transcript subtree to
  avoid false positives from UI chrome (worktree rows, tab titles).
- Onboarding: inject verified status snapshot with max sequence to
  prevent hydration from downgrading host health during skip-to-
  project-setup.
- Paired web: encode host health faults in snapshots with high
  sequence so real hydrations cannot outbid injected state.
- Quick open: clear prior tooltips and increase hover timeouts to
  handle streaming result remounting.
- Terminal attention: pass 'terminal-bell' to unread marker to match
  production contract (reads marker value, not presence).

* fix one last test
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