Skip to content

fix(wework): stabilize cloud e2e shards - #2643

Merged
qdaxb merged 4 commits into
mainfrom
fix/wework-e2e-shard-balance
Aug 12, 2026
Merged

qdaxb merged 4 commits into
mainfrom
fix/wework-e2e-shard-balance

Conversation

@qdaxb

@qdaxb qdaxb commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • replace round-robin Cloud E2E shard assignment with a duration-weighted static five-shard layout
  • isolate the three longest checkpoints and order the two multi-checkpoint shards by observed CI runtime
  • keep explicitly removed remote workspaces filtered by stable deviceId + workspacePath, even when a stale cloud response assigns a different project id
  • settle completed OpenCode, Claude Code, and Kimi Code turns from the local executor authoritative idle snapshot when a terminal frontend event is missed
  • avoid a duplicate navigation when a bridge request creates a new built-in browser tab; the creation request already carries the target URL
  • add regression coverage for the lifecycle races and browser open routing

Why

The old round-robin layout produced uneven Cloud E2E runtimes. The first merge-queue run then exposed a real product race: project removal completed, a replacement project was created, and an in-flight cloud refresh restored the deleted workspace under another project identity. The previous tombstone filter only matched project id, which is not stable across refreshes.

A later CI run exposed a second product race in local-harness: the local process completed, the assistant reply was persisted and rendered, and the executor reported running=false, but the UI stayed in the awaiting state after missing the terminal frontend event. Local harness snapshots are authoritative after send acceptance, so they now close a non-streaming turn. Active streaming turns and Codex optimistic sends retain the existing stale-snapshot protection.

The next CI run exposed a built-in browser race introduced by navigation-completion waiting: opening a new browser tab navigated to the requested URL during native webview creation, then immediately navigated to the same URL again. On Linux the duplicate navigation could suppress the second tab’s finished-load callback even though the fixture request completed. New tabs now use their creation URL as the single navigation; existing tabs still navigate explicitly.

Impact

All 15 Cloud desktop checkpoints still run exactly once across five shards. Removed cloud projects remain removed while stale refreshes converge, and completed local harness turns no longer remain stuck on “thinking”, and newly created built-in browser tabs no longer receive duplicate navigation. No E2E scenario was weakened or skipped.

Validation

  • pnpm --dir wework test src/features/workbench/runtimeTaskLifecycle/RuntimeTaskLifecycleStore.test.ts src/features/workbench/WorkbenchProvider.test.tsx (196 passed)
  • pnpm --dir wework typecheck
  • related Wework ESLint checks
  • bash .github/scripts/test-classify-ci-changes.sh
  • git diff --check
  • pre-push Wework ESLint, TypeScript, and full unit tests
  • cargo test --manifest-path wework/src-tauri/Cargo.toml embedded_browser::tests:: (34 passed)
  • local real-Tauri browser-multi-tabs checkpoint passed in 2m54s with no assertion errors
  • Cloud shard 1 passed the real-Tauri PR run after the remote-project fix

Summary by CodeRabbit

  • Bug Fixes
    • Prevented removed workspaces from reappearing after delayed cloud refreshes.
    • Improved workspace and chat removal handling across projects and devices.
    • Ensured stopped local coding sessions correctly return to an idle state.
    • Improved recognition of executor status updates, including Claude Code, OpenCode, and Kimi Code.
    • Prevented unnecessary browser navigation when opening a new browser request.
  • Tests
    • Updated cloud end-to-end coverage for more balanced test distribution.
    • Added regression coverage for workspace removal, task lifecycle updates, and browser navigation behavior.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR replaces modulo-based cloud E2E sharding with explicit balanced groups. It filters removed runtime workspaces during refresh, settles stopped local harness snapshots, and prevents duplicate embedded-browser navigation.

Changes

Cloud E2E shard balancing

Layer / File(s) Summary
Explicit cloud shard generation
.github/scripts/classify-wework-desktop-e2e.sh, .github/scripts/test-classify-ci-changes.sh
The classifier defines five explicit cloud shard groups and generates one matrix entry per group. Tests update expected assignments for full-coverage and cloud-only runs.

Workbench runtime reconciliation

Layer / File(s) Summary
Workspace removal filtering
wework/src/features/workbench/useWorkbenchDataRefresh.ts, wework/src/features/workbench/WorkbenchProvider.test.tsx
removeRuntimeProject removes matching device workspaces and chats. Regression coverage verifies that stale data from another project identity does not restore a removed workspace.
Local harness snapshot settlement
wework/src/features/workbench/runtimeTaskLifecycle/reducer.ts, wework/src/features/workbench/runtimeTaskLifecycle/RuntimeTaskLifecycleStore.test.ts
Stopped non-streaming opencode, claude_code, and kimi_code snapshots can settle accepted turns. The test verifies idle execution and turn phases with thinking disabled.

Embedded-browser navigation

Layer / File(s) Summary
Open-action navigation handling
wework/src-tauri/src/embedded_browser.rs, wework/src-tauri/src/embedded_browser/tests.rs
Browser-open requests return an EmbeddedBrowserOpenAction. The bridge navigates explicitly only for WaitForReady and Ready actions. Tests cover all navigation decisions.

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

Possibly related PRs

Suggested labels: ci:all

Suggested reviewers: lvmowei

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the Cloud E2E shard changes, but it does not mention the additional lifecycle, workspace, and browser race fixes.
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.
✨ 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/wework-e2e-shard-balance

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.

@qdaxb
qdaxb enabled auto-merge August 12, 2026 16:19
@qdaxb
qdaxb added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
@qdaxb
qdaxb added this pull request to the merge queue Aug 12, 2026
@qdaxb
qdaxb removed this pull request from the merge queue due to a manual request Aug 12, 2026
@qdaxb qdaxb changed the title fix(wework): balance cloud e2e shards fix(wework): stabilize cloud e2e shards Aug 12, 2026
@qdaxb
qdaxb force-pushed the fix/wework-e2e-shard-balance branch from 9d88854 to 17bc2cd Compare August 12, 2026 17:33

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@wework/src/features/workbench/runtimeTaskLifecycle/reducer.ts`:
- Around line 13-22: Update the stale-snapshot settlement logic around
shouldIgnoreStaleSnapshot and the following executionPhase update so
state.goalStatus === 'active' cannot be forced from running to idle when the
local harness reports running: false. Preserve the active Goal execution phase
and pause control consistently with the existing turn_settled branch, or exclude
active Goal turns from this settlement bypass. Add a regression case covering
goalStatus: 'active' during the inter-turn gap.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 09135230-8651-4c7d-b635-918157a8d16f

📥 Commits

Reviewing files that changed from the base of the PR and between 5ed1422 and 17bc2cd.

📒 Files selected for processing (6)
  • .github/scripts/classify-wework-desktop-e2e.sh
  • .github/scripts/test-classify-ci-changes.sh
  • wework/src/features/workbench/WorkbenchProvider.test.tsx
  • wework/src/features/workbench/runtimeTaskLifecycle/RuntimeTaskLifecycleStore.test.ts
  • wework/src/features/workbench/runtimeTaskLifecycle/reducer.ts
  • wework/src/features/workbench/useWorkbenchDataRefresh.ts

Comment on lines +13 to +22
const settledLocalHarness =
snapshotRunning === false &&
state.turnPhase !== 'streaming' &&
isLocalHarnessRuntime(event.task.runtime)
const shouldIgnoreStaleSnapshot =
snapshotRunning !== null &&
expectedRunning !== null &&
snapshotRunning !== expectedRunning &&
(!terminalStatus || hasIdentifiedActiveTurn)
(!terminalStatus || hasIdentifiedActiveTurn) &&
!settledLocalHarness

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve active-Goal execution state during settlement.

When state.goalStatus === 'active', the existing turn_settled branch keeps executionPhase running while the turn becomes idle. This new bypass also matches that state, but Lines 25-31 then force executionPhase to idle when the local harness reports running: false.

The workbench can lose the active Goal pause state during its inter-turn gap. Preserve the active-Goal execution phase, or restrict this settlement path to non-goal turns. Add a regression case with goalStatus: 'active'.

Based on learnings, the active Goal inter-turn gap must keep the pause control visible. The existing turn_settled branch in this file also preserves executionPhase for an active Goal.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/features/workbench/runtimeTaskLifecycle/reducer.ts` around lines
13 - 22, Update the stale-snapshot settlement logic around
shouldIgnoreStaleSnapshot and the following executionPhase update so
state.goalStatus === 'active' cannot be forced from running to idle when the
local harness reports running: false. Preserve the active Goal execution phase
and pause control consistently with the existing turn_settled branch, or exclude
active Goal turns from this settlement bypass. Add a regression case covering
goalStatus: 'active' during the inter-turn gap.

Source: Learnings

@qdaxb
qdaxb enabled auto-merge August 12, 2026 18:26
@qdaxb
qdaxb force-pushed the fix/wework-e2e-shard-balance branch from 7e7c4bd to 1515ecd Compare August 12, 2026 18:34

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

🧹 Nitpick comments (1)
wework/src-tauri/src/embedded_browser/tests.rs (1)

409-420: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Cover the caller-level navigation behavior.

This test validates browser_open_action_requires_navigation only. It does not open a tab, inspect the URL, or verify the number of navigation calls. A regression in handle_bridge_request could still pass. Add caller-level coverage, or confirm that the separate real-Tauri checkpoint verifies one navigation for a fast local URL.

As per coding guidelines, “Any Wework UI, Tauri command, local-runtime, IPC, or desktop integration behavior change requires isolated real-Tauri verification in addition to unit and E2E tests; browser-only or mocked verification is insufficient.”
The PR objective lists a real-Tauri browser checkpoint. Confirm that it executes this route.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src-tauri/src/embedded_browser/tests.rs` around lines 409 - 420,
Extend coverage beyond browser_open_action_requires_navigation by exercising
handle_bridge_request with a newly created tab, asserting it uses the creation
URL and performs exactly one navigation; alternatively, confirm the isolated
real-Tauri browser checkpoint executes this fast local-URL route and records
that single navigation.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@wework/src-tauri/src/embedded_browser/tests.rs`:
- Around line 409-420: Extend coverage beyond
browser_open_action_requires_navigation by exercising handle_bridge_request with
a newly created tab, asserting it uses the creation URL and performs exactly one
navigation; alternatively, confirm the isolated real-Tauri browser checkpoint
executes this fast local-URL route and records that single navigation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e603104-5a11-494f-8b1b-2e96499872de

📥 Commits

Reviewing files that changed from the base of the PR and between 17bc2cd and 1515ecd.

📒 Files selected for processing (6)
  • wework/src-tauri/src/embedded_browser.rs
  • wework/src-tauri/src/embedded_browser/tests.rs
  • wework/src/features/workbench/WorkbenchProvider.test.tsx
  • wework/src/features/workbench/runtimeTaskLifecycle/RuntimeTaskLifecycleStore.test.ts
  • wework/src/features/workbench/runtimeTaskLifecycle/reducer.ts
  • wework/src/features/workbench/useWorkbenchDataRefresh.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • wework/src/features/workbench/WorkbenchProvider.test.tsx
  • wework/src/features/workbench/useWorkbenchDataRefresh.ts
  • wework/src/features/workbench/runtimeTaskLifecycle/RuntimeTaskLifecycleStore.test.ts
  • wework/src/features/workbench/runtimeTaskLifecycle/reducer.ts

@qdaxb
qdaxb added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
@qdaxb
qdaxb added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit fbef1a7 Aug 12, 2026
59 checks passed
@qdaxb
qdaxb deleted the fix/wework-e2e-shard-balance branch August 12, 2026 19:28
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