Skip to content

fix(wework): refresh environment diff stats - #1933

Merged
qdaxb merged 2 commits into
mainfrom
fix/wework-environment-diff-refresh
Jul 13, 2026
Merged

qdaxb merged 2 commits into
mainfrom
fix/wework-environment-diff-refresh

Conversation

@qdaxb

@qdaxb qdaxb commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • refresh Environment info diff statistics in the background while a runtime task is active and immediately after it finishes
  • make explicit Environment info refreshes bypass the short-lived cache so they always read the latest Git state
  • document the refresh behavior and add unit plus real desktop E2E regression coverage

Root cause

Environment info was reloaded only when the workspace target changed or when a closed floating panel was reopened. A docked panel therefore kept the initial diff statistics throughout task execution. Explicit refreshes could also reuse the 1.5-second environment cache and return the same stale values.

Impact

The change count now updates every five seconds without a loading flicker while an agent is working, refreshes once more when the task becomes idle, and always performs a fresh Git read when the user explicitly refreshes the panel.

Validation

  • pnpm --filter wework exec vitest run src/api/environment.test.ts src/components/layout/DesktopWorkbenchLayout.test.tsx (159 tests passed)
  • pnpm --filter wework typecheck
  • ESLint on all changed Wework source, test, and E2E files
  • pnpm --filter wework e2e:desktop using an isolated real Tauri app, Executor, and Codex tool execution; asserted Environment info changed from +0/-0 to +1/-0
  • pre-push Wework ESLint, TypeScript, and full unit test checks

Summary by CodeRabbit

  • Improvements

    • Environment information now refreshes periodically while tasks are running.
    • Environment changes refresh immediately when a task finishes.
    • Reopening or manually refreshing Environment info retrieves the latest workspace status instead of displaying cached results.
  • Documentation

    • Updated English and Chinese user guides to explain environment change refresh behavior.

@coderabbitai

coderabbitai Bot commented Jul 13, 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: 2c6dcd9f-872a-4423-a4a9-4df7228ba545

📥 Commits

Reviewing files that changed from the base of the PR and between c9c2849 and 57f5c27.

📒 Files selected for processing (11)
  • docs/en/user-guide/coding/git-workspace-projects.md
  • docs/zh/user-guide/coding/git-workspace-projects.md
  • wework/e2e/desktop/task-flow.e2e.mjs
  • wework/src-tauri/tauri.conf.json
  • wework/src/api/environment.test.ts
  • wework/src/api/environment.ts
  • wework/src/components/layout/DesktopWorkbenchLayout.test.tsx
  • wework/src/components/layout/DesktopWorkbenchMain.tsx
  • wework/src/components/layout/useWorkbenchPaneEnvironment.ts
  • wework/src/features/workbench/useWorkbenchProjectActions.ts
  • wework/src/features/workbench/workbenchContextTypes.ts

📝 Walkthrough

Walkthrough

Environment info loading now supports forced cache bypasses, refreshes periodically during runtime tasks and after completion, and is validated through unit, layout, and desktop E2E tests. English and Chinese documentation describe the refresh behavior.

Changes

Environment refresh behavior

Layer / File(s) Summary
Forced environment loading and API propagation
wework/src/api/environment.ts, wework/src/api/environment.test.ts, wework/src/features/workbench/...
Adds the force loading option, bypasses cached environment results when requested, propagates it through workbench APIs, and tests refreshed Git statistics.
Runtime refresh orchestration
wework/src/components/layout/useWorkbenchPaneEnvironment.ts, wework/src/components/layout/DesktopWorkbenchMain.tsx, wework/src/components/layout/DesktopWorkbenchLayout.test.tsx
Refreshes environment information on runtime activation, every five seconds while active, and after task completion; layout tests verify the forced reload.
Desktop task-flow validation and documentation
wework/e2e/desktop/task-flow.e2e.mjs, docs/en/user-guide/coding/git-workspace-projects.md, docs/zh/user-guide/coding/git-workspace-projects.md
Seeds a committed Git workspace, controls initial tool execution, verifies +0/-0 then +1/-0 counts, and documents periodic and completion refreshes.

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

Sequence Diagram(s)

sequenceDiagram
  participant RuntimeTask
  participant Workbench
  participant EnvironmentLoader
  participant WorkspaceGit
  RuntimeTask->>Workbench: Start or finish task
  Workbench->>EnvironmentLoader: Request forced environment refresh
  EnvironmentLoader->>WorkspaceGit: Read current Git state
  WorkspaceGit-->>EnvironmentLoader: Return change statistics
  EnvironmentLoader-->>Workbench: Update environment info
Loading

Possibly related PRs

✨ 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-environment-diff-refresh

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 13, 2026 14:41
@qdaxb
qdaxb merged commit 89f31fe into main Jul 13, 2026
10 of 12 checks passed
@qdaxb
qdaxb deleted the fix/wework-environment-diff-refresh branch July 13, 2026 15:31
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