Skip to content

fix(executor): stop persisting runtime running state - #2310

Merged
qdaxb merged 3 commits into
mainfrom
fix/runtime-running-state-persistence
Jul 29, 2026
Merged

qdaxb merged 3 commits into
mainfrom
fix/runtime-running-state-persistence

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • exclude RuntimeTaskLink.running from serialization and deserialization
  • ignore legacy persisted running values instead of treating them as executor state
  • update runtime task contract tests for the in-memory-only running-state boundary
  • document the rule in both Chinese and English Wework state-source guides

Why

The runtime-work index persisted the same running field that is returned by the runtime API. When a release Wework process and a dev process shared one executor home, each process had an independent active-task set but read and wrote the same runtime-work/index.json. A process that did not own another process's task could therefore rewrite its running state.

running is process-owned execution state. It must come only from the current executor's active-task set and must never be restored from disk.

Compatibility

There is intentionally no migration or fallback path. Older running fields are ignored on read, and all new writes omit the field.

Validation

  • cargo fmt --all -- --check
  • cargo test -p wegent-executor --lib runtime_task_link_does_not_persist_running_state
  • cargo test -p wegent-executor --test app_runtime_work_native_update_contract
  • pre-push cargo test --all-features --lib
  • pre-push cargo clippy
  • isolated real-Tauri startup with pnpm --filter wework ai:verify start; verified the local executor connected and the workbench loaded, then stopped and cleaned the session

Summary by CodeRabbit

  • Bug Fixes
    • Task running state is no longer persisted, so task listings now reflect the currently active executor state.
    • Legacy indexes that include a saved running flag are ignored to prevent stale “running” indicators.
    • Runtime task lists correctly show idle, missing, and unmapped tasks as not running.
  • Documentation
    • Clarified the rules for how running is determined and what runtime data is retained.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 729bb105-0efb-4315-9808-71fc755781e3

📥 Commits

Reviewing files that changed from the base of the PR and between 74ae78f and 78c5472.

📒 Files selected for processing (6)
  • docs/en/wework/developer-guide/wework-chat-state-sources.md
  • docs/zh/wework/developer-guide/wework-chat-state-sources.md
  • executor/src/runtime_work/response.rs
  • executor/tests/app_runtime_work_native_update_contract.rs
  • executor/tests/app_runtime_work_workspace_contract.rs
  • wework/e2e/desktop/task-flow.e2e.mjs
🚧 Files skipped from review as they are similar to previous changes (5)
  • docs/en/wework/developer-guide/wework-chat-state-sources.md
  • docs/zh/wework/developer-guide/wework-chat-state-sources.md
  • executor/src/runtime_work/response.rs
  • executor/tests/app_runtime_work_native_update_contract.rs
  • executor/tests/app_runtime_work_workspace_contract.rs

📝 Walkthrough

Walkthrough

RuntimeTaskLink.running is now process-local and excluded from persisted runtime-work indexes. Serialization tests, task-list contract tests, fork-flow assertions, and English and Chinese documentation verify that legacy persisted values are ignored.

Changes

Runtime running-state contract

Layer / File(s) Summary
Serialization contract and documentation
executor/src/runtime_work/response.rs, docs/*/wework/developer-guide/wework-chat-state-sources.md
RuntimeTaskLink.running is skipped by serde, with tests confirming legacy JSON values do not restore it; documentation describes the ephemeral behavior.
Task listing ignores persisted state
executor/tests/app_runtime_work_native_update_contract.rs, executor/tests/app_runtime_work_workspace_contract.rs
Runtime task-list tests verify persisted running values are ignored for idle, missing, and unmapped tasks.
Follow-up fork persistence assertion
wework/e2e/desktop/task-flow.e2e.mjs
The fork-flow test verifies persisted parent.lastTurnId instead of requiring the source task to remain marked as running.

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

Possibly related PRs

Suggested reviewers: ficohu, sdadunderscoresdad, earthalone2026

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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: stopping persistence of the executor runtime running state.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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/runtime-running-state-persistence

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 force-pushed the fix/runtime-running-state-persistence branch from c523e4d to 74ae78f Compare July 29, 2026 15:23
@qdaxb
qdaxb marked this pull request as ready for review July 29, 2026 15:28
@qdaxb
qdaxb enabled auto-merge July 29, 2026 15:32
@qdaxb
qdaxb force-pushed the fix/runtime-running-state-persistence branch from 74ae78f to 78c5472 Compare July 29, 2026 15:49
@qdaxb
qdaxb added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit cfd8708 Jul 29, 2026
38 checks passed
@qdaxb
qdaxb deleted the fix/runtime-running-state-persistence branch July 29, 2026 16:24
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