Skip to content

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

Open
SivanCola wants to merge 9 commits into
esengine:main-v2from
SivanCola:fix/4186-clear-context-integrated
Open

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

Conversation

@SivanCola

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

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 Outdated
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) 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 指令有时执行异常

3 participants