Skip to content

fix: prevent negative token/cost totals during message removal#5

Merged
joshellis625 merged 2 commits intomainfrom
codex/reliability-nonnegative-totals
Feb 9, 2026
Merged

fix: prevent negative token/cost totals during message removal#5
joshellis625 merged 2 commits intomainfrom
codex/reliability-nonnegative-totals

Conversation

@joshellis625
Copy link
Owner

Summary

  • add usage accounting helpers to Chat (addUsage and removeUsage)
  • clamp total prompt/completion tokens and total cost at zero when removing usage
  • update regenerate/delete paths in ChatViewModel to use safe removal accounting
  • add a unit test to verify clamp behavior
  • include pending Xcode project update so REGRESSION_CHECKLIST.md remains visible in project docs

Testing Evidence

  • local build passed (xcodebuild build ...)
  • local unit tests passed (xcodebuild test ... -only-testing:JChatTests)

Rollback Plan

  • revert this PR to restore previous usage accounting behavior

@joshellis625 joshellis625 merged commit e49455c into main Feb 9, 2026
1 check passed
@joshellis625 joshellis625 deleted the codex/reliability-nonnegative-totals branch February 9, 2026 12:51
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