fix(wework): unify authoritative running task state - #2149
Conversation
|
Warning Review limit reached
Next review available in: 29 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe executor now owns the authoritative runtime ChangesExecutor-authoritative runtime state
WebView command long-polling
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Executor
participant Workbench
participant Tray
Executor->>Workbench: runtime task running state
Executor->>Tray: runtime task running state
Workbench-->>Workbench: render running indicator
Tray-->>Tray: build running-task menu state
sequenceDiagram
participant WebView
participant AiVerifyServer
participant CommandPolls
WebView->>AiVerifyServer: GET /commands
AiVerifyServer->>CommandPolls: hold pending response
WebView->>AiVerifyServer: POST /command
AiVerifyServer->>CommandPolls: resolve pending response
CommandPolls-->>WebView: command payload
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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/scripts/ai-verify.mjs`:
- Around line 188-195: Update the command dispatch logic around
commandPolls.shift() so stale or disconnected long-poll responses are not
consumed. Check the selected poll’s response state, such as
response.writableEnded or an equivalent close marker, before calling json; if it
is no longer writable, continue looking for a valid poll or enqueue nextCommand
instead. Preserve normal immediate dispatch for active polls.
🪄 Autofix (Beta)
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: 7b6dd423-2355-47c8-b5a2-e7c5e85a82ec
📒 Files selected for processing (15)
docs/en/wegent/developer-guide/local-device-architecture.mddocs/zh/wegent/developer-guide/local-device-architecture.mdexecutor/src/runtime_work/handler.rsexecutor/src/runtime_work/handler/collection.rsexecutor/src/runtime_work/handler/helpers/routing.rsexecutor/src/runtime_work/handler/helpers/transcript.rsexecutor/src/runtime_work/handler/queries.rsexecutor/src/runtime_work/handler/tests.rsexecutor/src/runtime_work/response.rsexecutor/tests/app_runtime_work_native_update_contract.rswework/scripts/ai-verify.mjswework/src/features/workbench/WorkbenchProvider.tsxwework/src/pages/WorkbenchPage.tsxwework/src/tauri/trayMenuState.test.tswework/src/tauri/trayMenuState.ts
💤 Files with no reviewable changes (1)
- executor/src/runtime_work/handler/helpers/transcript.rs
What changed
runningstatewait-forworks while the WebView is background-throttledRoot cause
Different surfaces inferred execution state independently. The executor task list could derive
runningfrom Codex thread metadata, the transcript used active-turn metadata, the current pane also consulted frontend optimistic state, and the tray could use a persisted reminder snapshot. Those sources settle at different times and could disagree after a turn completed or an executor restarted.Impact
The sidebar, task detail pane, stop/send controls, system tray, and sleep-related consumers now converge on the same live executor state. Historical thread metadata remains available for display but can no longer claim that a turn is currently executing.
Validation
cargo test --manifest-path executor/Cargo.toml --lib— 353 passed, 1 ignoredpnpm --filter wework test— 2003 passedcargo test --manifest-path wework/src-tauri/Cargo.toml --lib— 84 passedsleep 30turn → completed turnsleep 20turn continued after the controlled WebView was destroyed and settled tostatus=done,running=falsein executor logsSummary by CodeRabbit
Bug Fixes
Improvements