Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion menubar.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ def _refresh_in_background(self) -> None:
self.performSelectorOnMainThread_withObject_waitUntilDone_(
"_applyCodexRefreshResult:",
codex_result,
False,
True,
)
fallback_state = getattr(self, "latest_state", _empty_state(self.language))
project_rows = list(fallback_state.projects)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_menubar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,7 @@ def button(self) -> FakeButton:

def test_refresh_error_preserves_codex_quota() -> None:
captured: dict[str, object] = {}
calls: list[tuple[str, bool]] = []
session = menubar_state.QuotaRowState(
title="Session",
percent=1.0,
Expand Down Expand Up @@ -1372,6 +1373,7 @@ def _load_codex_refresh_result(self) -> dict[str, object]:
def performSelectorOnMainThread_withObject_waitUntilDone_(
self, selector: str, result: dict[str, object], wait: bool
) -> None:
calls.append((selector, wait))
captured["selector"] = selector
captured["result"] = result
captured["wait"] = wait
Expand All @@ -1389,6 +1391,10 @@ async def _fetch(self) -> PollOutcome:
assert state.codex_weekly == weekly
assert result["codex_5h_pct"] == 1.0
assert result["codex_model"] == "gpt-test"
assert calls == [
("_applyCodexRefreshResult:", True),
("_applyRefreshResult:", False),
]


def test_refresh_error_preserves_project_usage() -> None:
Expand Down