Skip to content

fix(ui): decouple barRemaining from accent, add popover dismiss monitor, and fix codex issue override - #181

Merged
jaywedgeworth22 merged 1 commit into
mainfrom
ag/fix-bars-popover-codex-resets
Oct 7, 2026
Merged

jaywedgeworth22 merged 1 commit into
mainfrom
ag/fix-bars-popover-codex-resets

Conversation

@jaywedgeworth22

Copy link
Copy Markdown
Collaborator

Summary

  • Decouple Quota Progress Bar Remaining Segment: Theme.barRemaining no longer binds to Theme.accent when the user chooses a warm or danger-adjacent accent (such as magenta or orange), which previously turned entire quota bars completely red/pink. It now preserves healthy teal (or green).
  • Popover Dismissal on Outside Click: Adopted NSPopoverDelegate and registered an NSEvent global mouse-down monitor on show (removed on close) so clicking anywhere outside the menu bar popover dismisses it immediately on the first click.
  • Codex Local Issue Override: Fixed MonitorModel.currentLocalResult() to clear issues["openai"] whenever reconciled local windows contain valid quota readings, preventing missing recent CLI session files from stamping "unavailable" over live ChatGPT API readings.
  • Reset Alarm Audibility & Unanchored Jumps: Played audible alarm sounds on any armed reset notification when the chosen tone is audible, and allowed ResetAlarmTracker to recognize jumps to 100% even if the window initially lacked an anchored reset deadline.

Verification

  • swift test: 365 tests passed, 0 failures across QuotaCoreTests and CodeCapsTests.

…or, and fix codex issue override

- Decouple Theme.barRemaining from user UI accentChoice (defaulting to healthy teal or green) so selecting magenta or orange does not turn every progress bar completely red.
- Add NSPopoverDelegate and NSEvent global mouse monitor to AppDelegate so clicking outside on another app or desktop immediately dismisses the menu bar popover.
- Clear issues["openai"] in MonitorModel whenever reconciled local windows contain valid quota data, preventing missing session files from suppressing live ChatGPT API readings.
- Play audible alarm sound on any reset event when sound is audible, and allow reset alarms to fire on unanchored jumps to 100%.
@jaywedgeworth22
jaywedgeworth22 merged commit 8c9cceb into main Oct 7, 2026
4 checks passed
@kody-ai

kody-ai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@kody-ai

kody-ai Bot commented Oct 7, 2026

Copy link
Copy Markdown

kody code-review Kody Rules medium

Markdown rendering bug: GitHub-flavored markdown collapses the two literal ASCII spaces after the period in red/pink. It now preserves healthy teal (or green)., erasing the intentional sentence gap in chat/PR render. Emit   (HTML entity plus a normal space) right after the period to preserve the gap — red/pink.  It now preserves healthy teal (or green). — and apply this fix only to the PR description, not to file content.

Kody rule violation: Use two spaces between sentences in every human-facing string and agent-written paragraph


// MARK: - Popover outside-click dismissal

private func startOutsideClickMonitor() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

kody code-review Bug medium

Race condition in AppDelegate.swift: the Task { @MainActor in } wrapper defers the self.popover.isShown check, allowing a stale mouse-down to close a freshly-reopened popover when the popover closes and reopens between scheduling and execution, after which the queued Task reads popover.isShown == true and calls performClose on the new instance. Replace the Task wrapper with MainActor.assumeIsolated so the check and performClose execute synchronously with respect to the event.

outsideClickMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.leftMouseDown, .rightMouseDown]) { [weak self] _ in
    MainActor.assumeIsolated {
        guard let self, self.popover.isShown else { return }
        self.popover.performClose(nil)
    }
}
Prompt for LLM

File Sources/CodeCaps/AppDelegate.swift:

Line 368:

Race condition in `AppDelegate.swift`: the `Task { @MainActor in }` wrapper defers the `self.popover.isShown` check, allowing a stale mouse-down to close a freshly-reopened popover when the popover closes and reopens between scheduling and execution, after which the queued Task reads `popover.isShown == true` and calls `performClose` on the new instance. Replace the Task wrapper with `MainActor.assumeIsolated` so the check and `performClose` execute synchronously with respect to the event.

Suggested Code:

outsideClickMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.leftMouseDown, .rightMouseDown]) { [weak self] _ in
    MainActor.assumeIsolated {
        guard let self, self.popover.isShown else { return }
        self.popover.performClose(nil)
    }
}

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

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