Repository navigation
fix(wework): preserve provider active turn state - #2518
Conversation
|
Warning Review limit reached
Next review available in: 5 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. 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 (13)
📝 WalkthroughWalkthroughRuntime ChangesRuntime provider-state reconciliation
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Workbench
participant Executor
participant Codex
Workbench->>Executor: send follow-up
Executor->>Codex: thread/read
Codex-->>Executor: active turn status
Executor-->>Workbench: busy rejection
Workbench->>Workbench: queue message and preserve running state
Codex-->>Workbench: turn completion
Workbench->>Executor: retry queued message
Executor->>Codex: turn/start
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 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: 4
🤖 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 `@executor/src/runtime_work/handler/tasks.rs`:
- Around line 564-576: Serialize the active-turn check, local task reservation,
and `spawn_turn` invocation in `handler` using a per-task critical section keyed
by the task/thread identifier, so concurrent sends cannot both pass
`codex_thread_has_in_progress_turn` before starting. Keep the existing response
for an already-running task, and add a concurrent-send contract test that
verifies only one turn is started.
- Around line 646-647: Update the interrupt-and-send flow around
send_message_with_active_turn_check to support provider-only active turns
persisted without in-memory cancellation state. Ensure it detects and interrupts
the persisted provider turn before starting the new turn, and add a contract
test seeding such a task with no local execution that verifies turn/interrupt
precedes turn/start.
In `@wework/e2e/desktop/task-flow.e2e.mjs`:
- Around line 8132-8149: After reloadMainWindow in the active Goal continuation
flow, call control.command('waitFor', ...) for a stable expected post-reload UI
element before invoking waitForSnapshot. Keep awaitReadyAfter for reconnection,
and preserve the existing snapshot assertions for the running Goal state.
In `@wework/src/features/workbench/runtimeTaskLifecycle/reducer.ts`:
- Around line 81-87: Update the send_blocked_by_active_turn case in the reducer
to clear activeTurnId when transitioning turnPhase to idle, while preserving the
existing executionPhase and expectedExecutorRunning updates.
🪄 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: 6b744d1a-b631-4dec-bb48-6494330877b1
📒 Files selected for processing (17)
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/queries.rsexecutor/src/runtime_work/handler/tasks.rsexecutor/src/runtime_work/handler/tests.rsexecutor/src/runtime_work/response.rsexecutor/tests/app_runtime_work_native_update_contract.rsexecutor/tests/app_runtime_work_send_contract.rswework/e2e/desktop/task-flow.e2e.mjswework/src/components/layout/useWorkbenchPaneSession.tswework/src/features/workbench/WorkbenchProvider.test.tsxwework/src/features/workbench/runtimeTaskLifecycle/RuntimeTaskLifecycleStore.test.tswework/src/features/workbench/runtimeTaskLifecycle/RuntimeTaskLifecycleStore.tswework/src/features/workbench/runtimeTaskLifecycle/reducer.tswework/src/features/workbench/runtimeTaskLifecycle/types.tswework/src/features/workbench/useWorkbenchRuntimeMessaging.ts
…rn-state # Conflicts: # wework/src/components/layout/useWorkbenchPaneSession.ts # wework/src/features/workbench/useWorkbenchRuntimeMessaging.ts
Summary
Verification
cargo test --manifest-path executor/Cargo.toml --all-features --libpnpm --filter wework lintpnpm --filter wework typecheckSummary by CodeRabbit