Skip to content

fix(wework): preserve runtime pane messages - #1601

Merged
qdaxb merged 1 commit into
mainfrom
codex/wework-runtime-message-sync
Jun 29, 2026
Merged

qdaxb merged 1 commit into
mainfrom
codex/wework-runtime-message-sync

Conversation

@qdaxb

@qdaxb qdaxb commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Runtime task transcripts now handle opaque runtime session identifiers, improving transcript loading for linked and optimistic tasks.
    • Workbench now preserves and restores in-progress runtime task messages more reliably during task creation and refreshes.
    • Added optional runtime debug logging for transcript and task creation flows when enabled.
  • Bug Fixes

    • Fixed cases where transcript views could appear empty or lose messages while task linking was still in progress.
    • Improved stability when runtime task addresses gain workspace information after resolution.
  • Documentation

    • Clarified how runtime task identity and session identifiers should be used.

@qdaxb
qdaxb merged commit 197e953 into main Jun 29, 2026
18 of 19 checks passed
@qdaxb
qdaxb deleted the codex/wework-runtime-message-sync branch June 29, 2026 11:44
@coderabbitai

coderabbitai Bot commented Jun 29, 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: 3a43d1ae-1e6b-434b-bdeb-ddf7857741e0

📥 Commits

Reviewing files that changed from the base of the PR and between d381069 and 7e29dfc.

📒 Files selected for processing (14)
  • docs/en/developer-guide/runtime-local-work.md
  • docs/zh/developer-guide/runtime-local-work.md
  • executor/src/runtime_work/handler.rs
  • executor/tests/app_runtime_work_contract.rs
  • executor/tests/app_runtime_work_file_changes_contract.rs
  • wework/src/api/local/localServices.ts
  • wework/src/components/layout/runtimeTaskSidebarHelpers.test.ts
  • wework/src/components/layout/runtimeTaskSidebarHelpers.ts
  • wework/src/components/layout/useWorkbenchPaneSession.ts
  • wework/src/features/workbench/WorkbenchProvider.test.tsx
  • wework/src/features/workbench/useWorkbenchRuntimeMessaging.ts
  • wework/src/features/workbench/workbenchContextTypes.ts
  • wework/src/features/workbench/workbenchReducer.ts
  • wework/src/types/api.ts

📝 Walkthrough

Walkthrough

Adds runtimeHandle as the canonical cross-session provider identity to RuntimeTaskAddress and LocalTaskSummary. The executor transcript handler now derives session/thread id from runtimeHandle instead of treating localTaskId as a provider session id, returning an empty transcript for unlinked tasks. The frontend gains optimistic task upsert/remove reducer actions, a seed/snapshot pane message system for continuity during address resolution, and conditional debug logging throughout.

Changes

runtimeHandle identity, transcript routing, and optimistic task state

Layer / File(s) Summary
Type additions and callback contract
wework/src/types/api.ts, wework/src/features/workbench/workbenchContextTypes.ts, docs/en/developer-guide/runtime-local-work.md, docs/zh/developer-guide/runtime-local-work.md
RuntimeTaskAddress and LocalTaskSummary gain optional runtimeHandle field; onRuntimeTaskOptimisticOpen gains optional context.previousAddress; docs clarify localTaskId vs provider session identity.
Executor transcript handler: runtimeHandle session id extraction
executor/src/runtime_work/handler.rs
transcript derives session/thread id from link or payload runtimeHandle fallback, gates cached-transcript path on runtime_has_provider_transcript_reader, returns empty transcript for pending-link tasks; removes thread_id_for_local_task; adds extraction helpers and two unit tests.
Executor integration tests: add runtimeHandle to payloads
executor/tests/app_runtime_work_contract.rs, executor/tests/app_runtime_work_file_changes_contract.rs
All runtime.tasks.transcript test request payloads gain runtimeHandle with threadId to match the updated handler.
getRuntimeTaskAddress propagates runtimeHandle
wework/src/components/layout/runtimeTaskSidebarHelpers.ts, wework/src/components/layout/runtimeTaskSidebarHelpers.test.ts
getRuntimeTaskAddress spreads task.runtimeHandle into the returned address; new test verifies propagation.
Workbench reducer: optimistic upsert/remove
wework/src/features/workbench/workbenchReducer.ts
WorkbenchAction gains runtime_task_optimistic_upserted and runtime_task_optimistic_removed; merge logic preserves optimistic projects/workspaces and creating-status tasks absent from backend refresh; new upsert/remove helpers recalculate totals.
useWorkbenchRuntimeMessaging: optimistic create/resolve/remove
wework/src/features/workbench/useWorkbenchRuntimeMessaging.ts
Create-task flow builds optimistic workspace, dispatches runtime_task_optimistic_upserted on resolve, conditionally navigates only when identity differs, dispatches runtime_task_optimistic_removed on error; adds builder and debug helpers.
useWorkbenchPaneSession: seed/snapshot message state
wework/src/components/layout/useWorkbenchPaneSession.ts
Replaces useReducer with useState + memoized dispatchMessages that snapshots per-pane messages; introduces seed/snapshot functions; transcript load falls back to seeds when empty; optimistic open seeds from prior snapshot; all callback deps updated.
localServices transcript debug logging
wework/src/api/local/localServices.ts
runtime.tasks.transcript path emits structured debug logs (address, handle, elapsed, message count) when wework:debug-runtime=1 is set; adds isRuntimeDebugEnabled, runtimeHandleDebug, runtimeTranscriptMessageCount.
WorkbenchProvider tests: optimistic resolution and streaming
wework/src/features/workbench/WorkbenchProvider.test.tsx
Adds RuntimePaneSendProbe, RuntimePaneStackItem, renderStrictWorkbench; adds three tests covering resolved-address workspacePath propagation, StrictMode transcript-effect replay, and streamed assistant content preservation.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~100 minutes

Possibly related PRs

  • wecode-ai/Wegent#1544: Both PRs touch end-to-end localTaskId semantics in the runtime work flow — the retrieved PR adds client-supplied localTaskId passthrough during runtime.tasks.create, while this PR enforces that localTaskId must not be used as a provider session id in transcript lookup.

Poem

🐇 A threadId is not a localTaskId, dear friend,
The rabbit knows handles must not be misread!
Optimistic tasks seed their messages with care,
Snapshots and fallbacks float soft through the air.
When the address resolves and workspacePaths bloom,
No user message vanishes into the gloom. ✨

✨ 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 codex/wework-runtime-message-sync

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.

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