Skip to content

Integrate clear context telemetry fixes / 集成清空上下文与统计面板修复#4329

Merged
esengine merged 21 commits into
esengine:main-v2from
SivanCola:fix/4186-clear-context-integrated
Jun 16, 2026
Merged

Integrate clear context telemetry fixes / 集成清空上下文与统计面板修复#4329
esengine merged 21 commits into
esengine:main-v2from
SivanCola:fix/4186-clear-context-integrated

Conversation

@SivanCola

@SivanCola SivanCola commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

This integration PR fixes #4186 and folds the related overlapping PRs into one branch so the desktop context, billing, and workspace-status changes can land together without file-level conflicts.

Integrated PRs and contributions

Integration fixes added here

Verification

  • go test ./...
  • go vet ./...
  • go build ./cmd/reasonix
  • go test . in the desktop module
  • go vet . in the desktop module
  • npm test
  • git diff --check

Co-contributors

Folded-in pricing update

  • Supersedes Default built-in pricing to CNY / 默认内置计费使用人民币 #4462 by defaulting official DeepSeek and MiMo pricing displays to RMB/CNY.
  • Runs a one-time desktop upgrade reset for official DeepSeek/MiMo price / prices, so existing installs adopt the new RMB defaults after opening the upgraded app.
  • Preserves user edits made after that upgrade reset; the reset is gated by config_version = 3 and does not run repeatedly.
  • Preserves recognition of the old official DeepSeek USD defaults so existing default-priced configs can migrate to the RMB defaults safely.

Additional superseded contributor PRs

These related PRs are being closed in favor of #4329 as the canonical integration route. Their authors are acknowledged as repository co-contributors for the cost, currency, balance, status-bar, and usage-visibility work represented by this integration effort.

Additional co-contributors acknowledged from these superseded PRs: @JesonChou, @jiaxindeyang-a11y, @Barsit, and @HUQIANTAO.

lizhengwu and others added 8 commits June 13, 2026 13:21
Fixes esengine#4186

Sub-bug (a): /clear sometimes fails to clear context (stale events
re-populate state after reset). Fix: guard usage handler with
turnActive check so stale events from the previous session are dropped
after the reset action zeros the state.

Sub-bug (b): token info and workspace context not refreshed after
/clear. Three causes:
1. Tab telemetry not reset — ClearSession() resets the executor session
   but tab.usageTelemetry/readTelemetry accumulate forever. Fix: add
   resetTelemetry() and call it from App.ClearSession().
2. ContextPanel not refreshed — dockRefreshKey only bumps on turn_done,
   so the panel keeps showing stale data. Fix: bump dockRefreshKey in
   confirmClearContext.
3. Stale info fallback — ContextPanel line 212 falls back to
   info.usedTokens when context.used is 0, which is stale. Fix: clear
   info state when context.used and sessionTokens are both 0.
…text-integrated

# Conflicts:
#	desktop/frontend/package.json
…text-integrated

# Conflicts:
#	desktop/frontend/src/lib/useController.ts
Discard stale ContextPanel responses after clear-session refreshes and let ClearSession failures surface to the caller before showing success.

Co-authored-by: ashishexee <144021866+ashishexee@users.noreply.github.com>

Co-authored-by: lizhengwu <lizhengwu@users.noreply.github.com>
@SivanCola SivanCola requested a review from esengine as a code owner June 13, 2026 19:45
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) provider Model providers & selection (internal/provider) labels Jun 13, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49894ca938

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/app.go
Comment thread desktop/frontend/src/components/ContextPanel.tsx Outdated
Comment thread internal/config/config.go
Comment thread desktop/frontend/src/lib/useController.ts
Comment thread internal/serve/serve.go
Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>
@SivanCola SivanCola enabled auto-merge June 14, 2026 13:37
@github-actions github-actions Bot added the tui Terminal UI / CLI (internal/cli, internal/control) label Jun 14, 2026
codex and others added 2 commits June 14, 2026 22:30
Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>
Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>
@SivanCola SivanCola force-pushed the fix/4186-clear-context-integrated branch from c1336ca to 5b61453 Compare June 14, 2026 15:30
@SivanCola

Copy link
Copy Markdown
Collaborator Author

Supersession note: #4327 fixed the same #4186 /clear telemetry/context-panel problem in a narrower branch; this PR is the integrated follow-up that carries the final route for that fix. Thank you @ashishexee for the original implementation and regression focus in #4327.

Authorship note: @SivanCola is the primary author of this PR. @ashishexee contributed as a repository collaborator through #4327; their work is acknowledged as part of the shared fix for #4186.

…text-integrated

# Conflicts:
#	desktop/frontend/package.json
@SivanCola

Copy link
Copy Markdown
Collaborator Author

Resolved the latest main-v2 merge conflict by merging origin/main-v2 into this PR branch.

Conflict resolution:

  • Kept both frontend test script additions in desktop/frontend/package.json: keyboard-shortcuts.test.ts from the updated base and statusbar-workspace.test.tsx from this PR.

Local verification:

  • node -e "JSON.parse(require("fs").readFileSync("desktop/frontend/package.json", "utf8"))"
  • npx tsx src/__tests__/keyboard-shortcuts.test.ts
  • npx tsx src/__tests__/statusbar-workspace.test.tsx
  • git diff --check

GitHub now reports this PR as mergeable. CI has been retriggered on the new head commit c17e0f8.

@esengine esengine merged commit 1a87cd4 into esengine:main-v2 Jun 16, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) desktop Wails desktop app (desktop/**) provider Model providers & selection (internal/provider) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: /clear 指令有时执行异常

5 participants