Skip to content

fix(tui): reset displayed cost on clear#1796

Closed
LING71671 wants to merge 2 commits into
Hmbown:mainfrom
LING71671:fix/clear-reset-cost
Closed

fix(tui): reset displayed cost on clear#1796
LING71671 wants to merge 2 commits into
Hmbown:mainfrom
LING71671:fix/clear-reset-cost

Conversation

@LING71671
Copy link
Copy Markdown
Contributor

Summary

  • Reset sub-agent cost accumulators when /clear resets the conversation session.
  • Reset displayed cost high-water marks so the footer/sidebar visible total returns to zero after /clear.
  • Extend /clear telemetry coverage to assert sub-agent cost, high-water state, and displayed_session_cost() are zeroed.

Closes #1788

Verification

  • cargo fmt --all -- --check
  • git diff --check
  • cargo test -p deepseek-tui --bin deepseek-tui test_clear_resets_all_state
  • cargo test -p deepseek-tui --bin deepseek-tui clear_resets_session_telemetry

Notes

  • cargo clippy --workspace --all-targets --all-features -- -D warnings was attempted, but current upstream/main fails on pre-existing warnings unrelated to this change: dead-code warnings in crates/tui/src/schema_migration.rs and clippy::needless_return in crates/tui/src/tui/ui.rs.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request expands the session clearing logic in the TUI to include subagent costs and cost high-water marks, along with updated test coverage. The review feedback points out that certain telemetry fields are still missing from the reset process and suggests including them. Furthermore, it recommends replacing manual field assignments with Default::default() to ensure the session state is fully and maintainably reset.

Comment thread crates/tui/src/commands/core.rs
Comment thread crates/tui/src/commands/core.rs
Comment thread crates/tui/src/commands/core.rs
@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 21, 2026

Thanks for the /clear cost-display fix. This was harvested into v0.8.40 release PR #1823 as commit d065241, and #1823 is now CI-green. Closing as superseded by the release branch; thank you for the clear polish fix.

@Hmbown Hmbown closed this May 21, 2026
@LING71671
Copy link
Copy Markdown
Contributor Author

Thanks for harvesting this into v0.8.40 and for the release-branch closeout.

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.

/clear command does not reset cost display to zero

2 participants