Skip to content

fix: complete warmup streams and prefer Luna - #103

Merged
xjoker merged 2 commits into
xjoker:devfrom
futuer-szd:fix/warmup-complete-response
Sep 30, 2026
Merged

xjoker merged 2 commits into
xjoker:devfrom
futuer-szd:fix/warmup-complete-response

Conversation

@futuer-szd

@futuer-szd futuer-szd commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Warmup could receive HTTP 200, read only the first SSE chunk, close the connection before generation finished, and report success while the five-hour reset timer kept moving. Its mini preference can also fall through to a high-priority larger model when an account's current Codex catalog offers Luna but no mini. Fixes #99.

Changes

  • Consume the complete warmup response and require a well-formed response.completed event with a completed response status. Empty, truncated, incomplete, failed, and errored streams now fail instead of reporting a successful warmup. Apply the same check to the main request, model retry, auth retry, and additional model pools.
  • Prefer an available Luna model for the minimal main request, retain mini for older model catalogs, then fall back to the highest API priority. Add a regression test for all three branches.
  • Recognize a fixed five-hour reset even when a tiny completed request still rounds to 0% usage. Evaluate elapsed window time at the usage sample, so an old cold-window cache entry cannot become active just by aging.
  • Refresh expired CLI usage data before deciding to skip warmup, and document the behavior.
  • Apply a one-line, behavior-preserving TUI Clippy fix required by the current stable Rust toolchain's -D warnings gate.

Verification

  • Added http_200_without_completed_event_is_not_warmed; it failed on the unmodified dev branch and passed after the fix.
  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, and cargo test --all — passed on the preceding warmup-stream revision (9b6b186). The Luna selection rule was separately verified with the local build before the Rust toolchain was removed. The new dev-branch Luna regression test has not been rerun locally after that cleanup.
  • bash -n scripts/install.sh — passed.
  • Parsed scripts/install.ps1 with PowerShell's parser — no errors.
  • cargo audit — not run because cargo-audit is unavailable locally.

The updated dev binary has not been exercised against a fresh real-account window. The HTTP mock and SSE parser tests cover the completion contract; cross-platform CI remains the release gate and is awaiting upstream maintainer approval for this fork PR.

@futuer-szd

futuer-szd commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

committed by codex

@futuer-szd futuer-szd changed the title fix: wait for completed warmup response fix: complete warmup streams and prefer Luna Sep 24, 2026
xjoker added a commit that referenced this pull request Sep 30, 2026
fix: complete warmup streams and prefer Luna

# Conflicts:
#	src/tui/app.rs
@xjoker
xjoker merged commit 8fa072d into xjoker:dev Sep 30, 2026
@xjoker

xjoker commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Sorry for the late reply — I've been busy lately and couldn't respond sooner.

Thanks for the fix! Merged into dev (merge commit 3393338).

  • Warmup now reads the full stream and requires a completed response.completed event, so an HTTP 200 that closes early is no longer reported as a successful warmup.
  • Luna is preferred for the minimal request, with mini and then API priority as fallbacks.
  • The one-line Clippy fix in src/tui/app.rs conflicted with an equivalent fix already on dev; I kept the dev version. No behavior difference.

Verified on Windows: cargo fmt --check, cargo clippy --all-targets -- -D warnings, and cargo test --all all pass. It will ship in the next release.

@futuer-szd

Copy link
Copy Markdown
Contributor Author

Hi, I got it. Thanks for your reply.

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.

2 participants