Skip to content

fix(wework): restore historical tool records - #2075

Merged
qdaxb merged 4 commits into
mainfrom
fix/wework-history-tool-records
Jul 20, 2026
Merged

qdaxb merged 4 commits into
mainfrom
fix/wework-history-tool-records

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • normalize both subtaskId and subtask_id when restoring runtime transcript messages
  • preserve historical tool-call and file-change blocks that depend on the subtask identity
  • add parser-level and WorkbenchProvider regression coverage
  • document the transcript identity compatibility contract in Chinese and English

Root cause

Historical transcript payloads can use snake_case subtask_id, while Wework only read camelCase subtaskId. Without a recognized subtask identity, Wework intentionally dropped the assistant message's processing blocks, hiding both historical tool calls and file-edit records. Live events were unaffected because they use camelCase.

Validation

  • pnpm --filter wework exec prettier --check ...
  • pnpm --filter wework exec eslint ...
  • pnpm --filter wework test — 183 files, 1847 tests passed
  • pre-commit and pre-push Wework quality checks passed
  • isolated real-Tauri flow: run a command and file edit, leave the conversation, reopen it from history, expand processing details, and open file-change review; tool and edit records remained visible

Summary by CodeRabbit

  • Bug Fixes
    • Improved restoration of historical runtime transcripts by normalizing subtask identifiers (now supports numeric IDs by converting them to strings) for consistent message-to-block matching.
    • Ensured tool-call and file-change blocks are preserved even when their fields arrive in snake_case.
  • Documentation
    • Updated developer docs (local-runtime transcript restoration) to reflect subtask identifier format and field-transport differences.
  • Tests
    • Added coverage for numeric subtask IDs and snake_case block fields, and updated fixtures to match expected types.
    • Adjusted an end-to-end UI interaction step in the project flow.

@coderabbitai

coderabbitai Bot commented Jul 20, 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: 8a1ce322-6cb1-4326-8410-46465b19c955

📥 Commits

Reviewing files that changed from the base of the PR and between 43d32c0 and cd16173.

📒 Files selected for processing (1)
  • wework/e2e/desktop/task-flow.e2e.mjs

📝 Walkthrough

Walkthrough

Runtime transcript restoration now accepts numeric assistant subtask identifiers, normalizes them to strings, and updates related typing, tests, and documentation. The desktop cloud project E2E flow now opens projects through the enabled new-conversation control.

Changes

Runtime transcript compatibility

Layer / File(s) Summary
Subtask ID contract and restoration
wework/src/types/api.ts, wework/src/features/workbench/runtimePaneMessages.ts
NormalizedRuntimeMessage.subtaskId accepts numbers, and restoration converts valid numeric identifiers to strings while rejecting invalid or empty values.
Compatibility validation and documentation
wework/src/features/workbench/runtimePaneMessages.test.ts, wework/src/features/workbench/WorkbenchProvider.test.tsx, docs/en/..., docs/zh/...
Tests cover numeric subtask IDs with tool and file-change blocks, while both language guides document transcript identifier normalization.

Desktop project flow

Layer / File(s) Summary
Project conversation entry
wework/e2e/desktop/task-flow.e2e.mjs
The cloud project flow clicks the enabled new-conversation button within the target project row before continuing with workspace and composer readiness checks.

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

Possibly related PRs

  • wecode-ai/Wegent#1925: Updates related desktop project-opening interactions to use clickWhenEnabled.
  • wecode-ai/Wegent#2022: Updates related runtime transcript file_changes handling keyed by subtask identifiers.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 matches the main change: restoring historical runtime/tool records in Wework.
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
📝 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-history-tool-records

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 20, 2026 09:42

@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/src/features/workbench/runtimePaneMessages.ts`:
- Around line 587-588: Update the subtask ID resolution logic around the visible
subtaskId selection so each camelCase and snake_case alias is validated for a
non-empty, non-whitespace string before choosing it; fall back to
message.subtask_id when message.subtaskId is invalid, and add a regression test
covering both fields being present with an empty or whitespace camelCase value
and a valid snake_case value.
🪄 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

Run ID: 28d93b46-5d3d-4e31-a503-0ee6baa3ba0f

📥 Commits

Reviewing files that changed from the base of the PR and between 53266da and 0688bbb.

📒 Files selected for processing (6)
  • docs/en/developer-guide/runtime-local-work.md
  • docs/zh/developer-guide/runtime-local-work.md
  • wework/src/features/workbench/WorkbenchProvider.test.tsx
  • wework/src/features/workbench/runtimePaneMessages.test.ts
  • wework/src/features/workbench/runtimePaneMessages.ts
  • wework/src/types/api.ts

@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: 2

🤖 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/src/features/workbench/runtimePaneMessages.test.ts`:
- Around line 544-550: Expand the historical block restoration test around
runtimeMessagesToWorkbenchMessages to cover messages using snake_case
subtask_id, plus a message with an invalid or blank subtaskId alongside a valid
subtask_id. Assert both cases restore their blocks, preserving the existing
numeric subtaskId regression coverage.

In `@wework/src/features/workbench/runtimePaneMessages.ts`:
- Around line 587-589: Preserve both subtask ID aliases in the restoration
contract: update the resolver in runtimePaneMessages.ts to validate subtaskId
first and fall back to a non-empty subtask_id value, retain subtask_id?: string
| number | null in the input type in api.ts, and add regression fixtures in
runtimePaneMessages.test.ts covering snake_case-only and mixed-alias messages.
🪄 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

Run ID: 6081deb8-19bd-4e5a-98ac-5af6ab1ae316

📥 Commits

Reviewing files that changed from the base of the PR and between 0688bbb and 43d32c0.

📒 Files selected for processing (6)
  • docs/en/developer-guide/runtime-local-work.md
  • docs/zh/developer-guide/runtime-local-work.md
  • wework/src/features/workbench/WorkbenchProvider.test.tsx
  • wework/src/features/workbench/runtimePaneMessages.test.ts
  • wework/src/features/workbench/runtimePaneMessages.ts
  • wework/src/types/api.ts

@qdaxb
qdaxb merged commit b3e7292 into main Jul 20, 2026
19 of 21 checks passed
@qdaxb
qdaxb deleted the fix/wework-history-tool-records branch July 20, 2026 10:05
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