Skip to content

fix(wework): recover guidance turn races - #1961

Merged
qdaxb merged 1 commit into
mainfrom
fix/wework-guidance-send-failure
Jul 15, 2026
Merged

qdaxb merged 1 commit into
mainfrom
fix/wework-guidance-send-failure

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • classify Codex active-turn completion and turn-switch races as no_active_turn
  • let Wework reuse its existing normal follow-up fallback instead of marking guidance as failed
  • document the recoverable guidance behavior in the local device architecture guides

Root cause

Codex app-server can reject turn/steer with no active turn to steer or an active turn ID mismatch when a turn finishes or changes while guidance is being sent. The executor previously exposed every steer error as guidance_failed, so Wework displayed a false failure instead of preserving the message as a follow-up.

Verification

  • cargo fmt --check
  • cargo test --lib runtime_work::handler::tests::codex_guidance_turn_races_are_reported_as_no_active_turn
  • cargo test --test app_runtime_work_send_contract runtime_tasks_guidance_steers_running_codex_turn
  • vitest run src/features/workbench/WorkbenchProvider.test.tsx (91 passed)
  • tsc -b
  • focused Prettier and ESLint checks
  • pre-push cargo test --all-features --lib and cargo clippy

Manual verification note

The isolated Tauri verification app built and launched, but the machine had other Wework verification instances holding the single-instance runtime, so the automation bridge could not complete a reliable snapshot-driven flow. The protocol integration test and Wework fallback test cover the affected boundary directly.

Summary by CodeRabbit

  • Bug Fixes

    • Improved guidance delivery when the active task ends or changes during sending.
    • Automatically sends guidance as a regular follow-up message when no active task is available, preventing lost input and misleading failures.
  • Documentation

    • Documented active-task routing, race conditions, and fallback behavior in English and Chinese developer guides.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4e1450b6-e751-4f29-b0d6-cc53ed5e462d

📥 Commits

Reviewing files that changed from the base of the PR and between 4a3df6e and 6ad4ebb.

📒 Files selected for processing (4)
  • docs/en/developer-guide/local-device-architecture.md
  • docs/zh/developer-guide/local-device-architecture.md
  • executor/src/runtime_work/handler.rs
  • wework/src/features/workbench/WorkbenchProvider.test.tsx

📝 Walkthrough

Walkthrough

Codex guidance steering errors now identify active-turn races as no_active_turn, allowing Wework to use its follow-up path. Tests cover executor classification and unavailable-turn guidance behavior, while English and Chinese documentation describe the routing and fallback.

Changes

Codex guidance handling

Layer / File(s) Summary
Runtime guidance error classification
executor/src/runtime_work/handler.rs
send_guidance maps active-turn race errors to no_active_turn, retains guidance_failed for other errors, and tests both mappings.
Wework unavailable-turn follow-up validation
wework/src/features/workbench/WorkbenchProvider.test.tsx
The queued-guidance test exercises an unavailable active turn and verifies guideRuntimeTask invocation.
Guidance routing documentation
docs/en/developer-guide/local-device-architecture.md, docs/zh/developer-guide/local-device-architecture.md
Both architecture guides document shared active-turn routing, race reporting, and follow-up-message handling.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: ficohu, icycrystal4

✨ Finishing Touches
📝 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-guidance-send-failure

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 July 15, 2026 01:03
@qdaxb
qdaxb merged commit 14f4319 into main Jul 15, 2026
18 of 20 checks passed
@qdaxb
qdaxb deleted the fix/wework-guidance-send-failure branch July 15, 2026 01:03
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