Skip to content

fix(wework): keep inactive task browsers available - #2513

Merged
qdaxb merged 21 commits into
mainfrom
fix/wework-inactive-task-browser-routing
Aug 9, 2026
Merged

qdaxb merged 21 commits into
mainfrom
fix/wework-inactive-task-browser-routing

Conversation

@qdaxb

@qdaxb qdaxb commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Keep mounted task workbench effects active while their top-level workspace tab is hidden.
  • Preserve task-scoped embedded-browser request routing without painting an inactive task surface.
  • Extend the real Tauri embedded-browser scenario to open, wait for, and inspect task A's browser while task B is active.
  • Document multi-task browser isolation, inactive-task background operation, and the current one-browser-host-per-task boundary in Chinese and English.

Why

Each runtime task already receives a distinct embedded-browser label, but inactive top-level task tabs were wrapped in React Activity hidden mode. That deactivated the workbench effect that consumes task-scoped browser requests, so an agent operating an inactive task timed out even though its browser label was correct.

The updated task surface remains effect-active and is hidden with the HTML hidden attribute. Non-task tabs retain the existing suspended behavior, and the native browser for an inactive task remains invisible.

User impact

Multiple Wework task tabs keep independent browser sessions. An agent can continue opening and inspecting the browser associated with its own task while another task tab is selected, and switching back reveals the updated page.

This does not add browser-internal tabs: each task still owns one embedded-browser host.

Validation

  • pnpm --filter wework test — 332 files, 3195 tests passed
  • pnpm --filter wework exec eslint src/App.tsx src/App.apps.test.tsx e2e/desktop/scenarios/embedded-browser-agent.scenario.mjs
  • pnpm --filter wework exec prettier --check ...
  • pnpm --filter wework e2e:desktop:embedded-browser — real Tauri scenario passed
  • Pre-push ESLint, TypeScript, and unit-test checks passed

Summary by CodeRabbit

  • New Features

    • Task tabs now maintain independent embedded browser pages that continue running in the background.
    • Switching between tasks preserves browser state and displays the latest page when returning.
    • Task browser sessions are isolated and each task supports one browser tab.
  • Bug Fixes

    • Improved background browser requests and routing for inactive task tabs.
    • Cache clearing on macOS now more precisely targets disk cache data while keeping cookie clearing separate.
  • Tests

    • Expanded coverage for task isolation, browser persistence, routing, visibility, and state preservation.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change keeps task workbenches mounted while hiding inactive surfaces, routes browser requests through task-specific labels, validates isolated background browser activity, and updates macOS cache clearing to target disk cache only.

Changes

Embedded browser lifecycle

Layer / File(s) Summary
Task surface routing and layout
wework/src/App.tsx, wework/src/App.apps.test.tsx, docs/en/wework/browser.md, docs/en/wework/developer-guide/wework-embedded-browser.md, docs/zh/wework/browser.md, docs/zh/wework/developer-guide/wework-embedded-browser.md
Task workbenches remain mounted while inactive surfaces are hidden and pointer-disabled. Task-specific browser labels and per-task browser isolation are documented and tested.
Task isolation and background navigation validation
wework/e2e/desktop/scenarios/embedded-browser-agent.scenario.mjs, docs/en/wework/developer-guide/wework-embedded-browser.md, docs/zh/wework/developer-guide/wework-embedded-browser.md
The E2E scenario validates inactive-task browser bootstrapping, task isolation, scoped browser controls, cookie state, cache clearing, and state restoration.
Selective cache clearing
wework/src-tauri/src/embedded_browser/data_clearing.rs
macOS selective cache clearing now targets disk cache while keeping cookie clearing separate.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ActiveTask
  participant InactiveTask
  participant BrowserBridge
  participant BrowserHost
  ActiveTask->>BrowserBridge: Keep active task browser route
  InactiveTask->>BrowserBridge: Send task-specific browser request
  BrowserBridge->>BrowserHost: Route request to inactive task host
  BrowserHost-->>InactiveTask: Complete background navigation
  ActiveTask->>ActiveTask: Switch task tabs
  ActiveTask-->>BrowserHost: Restore inactive task browser state
Loading

Possibly related PRs

  • wecode-ai/Wegent#2508: Shares embedded-browser task-scoped routing, inactive-task handling, and the same E2E scenario.
  • wecode-ai/Wegent#2447: Shares changes to embedded-browser data clearing and the desktop browser scenario.
  • wecode-ai/Wegent#1855: Shares mounted workbench content and state preservation during task-tab switching.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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 clearly and concisely describes the main change: keeping inactive task browsers available.
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-inactive-task-browser-routing

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 marked this pull request as ready for review August 9, 2026 04: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.

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/e2e/desktop/scenarios/embedded-browser-agent.scenario.mjs`:
- Around line 456-525: Extend the embedded-browser scenario after the initial
active-browser lookup to assert that activeBrowserLabel is non-empty, then after
inactiveInspect re-read the selected task tab and its active browser label.
Assert they still equal secondTaskTabTestId and activeBrowserLabel, confirming
the inactive-task bridge calls did not activate task A or change task B’s
browser host.
🪄 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: 0b2fe604-cdff-4425-a874-3705dbd236e8

📥 Commits

Reviewing files that changed from the base of the PR and between 68ebe74 and 30b904e.

📒 Files selected for processing (8)
  • docs/en/wework/browser.md
  • docs/en/wework/developer-guide/wework-embedded-browser.md
  • docs/zh/wework/browser.md
  • docs/zh/wework/developer-guide/wework-embedded-browser.md
  • wework/e2e/desktop/scenarios/embedded-browser-agent.scenario.mjs
  • wework/src-tauri/src/embedded_browser/data_clearing.rs
  • wework/src/App.apps.test.tsx
  • wework/src/App.tsx

@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/e2e/desktop/scenarios/embedded-browser-agent.scenario.mjs`:
- Around line 527-546: Extend the assertions after inactiveInspect to verify
task A’s workspace-tab-content element, identified by the first task’s
workspace-tab-content-${firstTaskTabId} selector, has the hidden attribute. Keep
the existing selected-task and active-browser-label assertions unchanged, and
assert the hidden state directly so the inactive task surface cannot become
visible unnoticed.
🪄 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: ab5a1409-79b0-4065-be14-36170da9c287

📥 Commits

Reviewing files that changed from the base of the PR and between 30b904e and cee27f5.

📒 Files selected for processing (3)
  • wework/e2e/desktop/scenarios/embedded-browser-agent.scenario.mjs
  • wework/src/App.apps.test.tsx
  • wework/src/App.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • wework/src/App.apps.test.tsx
  • wework/src/App.tsx

@qdaxb
qdaxb added this pull request to the merge queue Aug 9, 2026
Merged via the queue into main with commit 6419c4e Aug 9, 2026
47 checks passed
@qdaxb
qdaxb deleted the fix/wework-inactive-task-browser-routing branch August 9, 2026 15:20
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