Skip to content

fix(wework): replace failed turns after retry - #2246

Merged
qdaxb merged 1 commit into
mainfrom
fix/wework-failed-message-order
Jul 27, 2026
Merged

qdaxb merged 1 commit into
mainfrom
fix/wework-failed-message-order

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • remove the failed assistant turn after the executor accepts a retry, instead of only hiding the error card
  • collapse restored retry attempts so a successful retry keeps one user prompt and one assistant response
  • reconcile cached failed messages with provider transcripts in chronological order and drop stale failures
  • extend the real Wework desktop E2E to verify the result both immediately and after reopening the task
  • document the retry replacement behavior in Chinese and English

Root cause

The error card previously owned local dismissal state, while its failed assistant message remained in the workbench message list. This made a successful retry leave an empty assistant turn.

Transcript restoration also projected provider messages and cached failures independently. A stale cached failure could therefore be appended after a newer successful retry, which made the failure card reappear in the wrong position after switching conversations.

User impact

Once a retry is accepted, the failed assistant turn is removed. When the retry succeeds, the conversation shows the original user prompt followed by the successful assistant response, with no stale failure card and no empty turn. Reopening the task preserves the same result.

Validation

  • pnpm --filter wework exec vitest run src/features/workbench/runtimePaneMessages.test.ts src/components/chat/MessageList.test.tsx src/features/workbench/WorkbenchProvider.test.tsx — 285 tests passed
  • cargo test --manifest-path executor/Cargo.toml transcript_ — transcript unit and contract tests passed
  • cargo fmt --manifest-path executor/Cargo.toml --check
  • cargo clippy --manifest-path executor/Cargo.toml --all-targets -- -D warnings
  • pnpm --filter wework exec node e2e/desktop/task-flow.e2e.mjs --retry-only — real desktop retry-restoration E2E passed
  • pre-push ESLint, TypeScript, Wework unit tests, Executor library tests, formatting, and Clippy passed

E2E assertions

After retry success, and again after switching away and reopening the task:

  • assistant-error-card count is 0
  • message-assistant count is 1
  • the successful retry response remains visible

Summary by CodeRabbit

  • Bug Fixes

    • Improved task retry handling by removing outdated failure cards after a successful retry.
    • Preserved the original user message while displaying only the latest successful response.
    • Prevented stale or duplicate failed responses from reappearing when conversations are reopened.
    • Kept failed responses correctly ordered when multiple retry attempts are present.
    • Error details now remain visible until the retry process completes.
  • Documentation

    • Updated English and Chinese guides to explain conversation behavior after retries and task reopening.

@coderabbitai

coderabbitai Bot commented Jul 27, 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 Plus

Run ID: b2241bc3-e3b9-49c9-9474-7b949b42143d

📥 Commits

Reviewing files that changed from the base of the PR and between 560b589 and 1003d3f.

📒 Files selected for processing (11)
  • docs/en/wegent/user-guide/coding/managing-code-tasks.md
  • docs/zh/wegent/user-guide/coding/managing-code-tasks.md
  • executor/src/runtime_work/handler/helpers/transcript.rs
  • executor/src/runtime_work/handler/tests.rs
  • wework/e2e/desktop/task-flow.e2e.mjs
  • wework/src/components/chat/MessageList.test.tsx
  • wework/src/components/chat/MessageList.tsx
  • wework/src/components/layout/useWorkbenchPaneSession.ts
  • wework/src/features/workbench/WorkbenchProvider.test.tsx
  • wework/src/features/workbench/runtimePaneMessages.test.ts
  • wework/src/features/workbench/runtimePaneMessages.ts

📝 Walkthrough

Walkthrough

Retry handling now reconciles failed assistant turns across runtime messages, cached transcripts, pane state, and UI rendering. Tests and bilingual documentation cover successful retries, repeated failures, task reopening, ordering, and duplicate prevention.

Changes

Retry reconciliation

Layer / File(s) Summary
Runtime retry-turn collapse
wework/src/features/workbench/runtimePaneMessages.ts, wework/src/features/workbench/runtimePaneMessages.test.ts
Retried failed turns are collapsed by user message identity, retaining successful outcomes or the latest failure while preserving newer conversation turns.
Cached transcript reconciliation
executor/src/runtime_work/handler/helpers/transcript.rs, executor/src/runtime_work/handler/tests.rs
Cached failures are deduplicated by subtask and message ID and inserted according to message timestamps.
Retry UI and pane state
wework/src/components/chat/MessageList.tsx, wework/src/components/chat/MessageList.test.tsx, wework/src/components/layout/useWorkbenchPaneSession.ts, wework/src/features/workbench/WorkbenchProvider.test.tsx
Retry no longer dismisses the error card directly; successful retries remove the failed pane message and update related assertions.
Retry lifecycle validation and documentation
wework/e2e/desktop/task-flow.e2e.mjs, docs/en/wegent/user-guide/coding/managing-code-tasks.md, docs/zh/wegent/user-guide/coding/managing-code-tasks.md
End-to-end checks and English and Chinese documentation cover retry cleanup and task reopening behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant AssistantErrorCard
  participant retryFailedMessageInPane
  participant runtimeMessagesToWorkbenchMessages
  participant append_missing_cached_failed_assistant_messages
  AssistantErrorCard->>retryFailedMessageInPane: trigger retry
  retryFailedMessageInPane->>AssistantErrorCard: retain error card while retry runs
  retryFailedMessageInPane->>runtimeMessagesToWorkbenchMessages: process retry result
  runtimeMessagesToWorkbenchMessages->>AssistantErrorCard: reconcile successful or failed assistant turn
  runtimeMessagesToWorkbenchMessages->>append_missing_cached_failed_assistant_messages: restore missing cached failures
  append_missing_cached_failed_assistant_messages->>runtimeMessagesToWorkbenchMessages: return ordered, deduplicated transcript
Loading

Possibly related PRs

Suggested reviewers: 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-failed-message-order

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 27, 2026 12:08
@qdaxb
qdaxb merged commit 950cad4 into main Jul 27, 2026
29 of 31 checks passed
@qdaxb
qdaxb deleted the fix/wework-failed-message-order branch July 27, 2026 12:08
duzeng pushed a commit to duzeng/Wegent that referenced this pull request Jul 27, 2026
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