Skip to content

fix(ai): log usage polls of plan-less accounts at debug, not warn - #17057

Closed
trukhinyuri wants to merge 2 commits into
can1357:mainfrom
trukhinyuri:fix/usage-no-plan-not-warning
Closed

trukhinyuri wants to merge 2 commits into
can1357:mainfrom
trukhinyuri:fix/usage-no-plan-not-warning

Conversation

@trukhinyuri

Copy link
Copy Markdown
Contributor

What

Accounts that use Kimi Code, Z.AI, or ClinePass without an active subscription plan return a steady-state "no plan" payload on every usage poll, and each poll logged a warning (hundreds of warnings per day per session):

  • Kimi Code (packages/ai/src/usage/kimi.ts): an account without a Kimi Code plan answers {}. kimiUsageProvider.fetchUsage now logs that empty object at debug ("Kimi account has no Kimi Code plan to meter") and returns null, while non-empty malformed payloads still log "Kimi usage response invalid" at warn.
  • Z.AI (packages/ai/src/usage/zai.ts): a pay-as-you-go account without a GLM Coding Plan answers {code: 500, msg: "当前用户不存在coding plan"}. fetchZaiUsage now logs /不存在\s*coding\s*plan|no\s+coding\s+plan/i at debug and returns null, while expired plans ("您的coding plan已过期") or backend errors still log at warn.
  • ClinePass (packages/ai/src/usage/cline-pass.ts): a free/credits-only account that never subscribed to ClinePass answers HTTP 404 "no plan history found for user". fetchClinePassUsage now logs 404 responses matching /no plan history/i at debug and returns null, while other 404 or error responses still log at warn.

Verification

  • Base (origin/main 0b5c27ab24 packages/ai/src/usage/{cline-pass,kimi,zai}.ts):
    bun test test/cline-pass-usage.test.ts test/kimi-usage.test.ts test/zai-usage.test.ts -t "treats an account without a" fails all 3 tests (0 pass, 3 fail: ["ClinePass usage fetch failed"], ["Kimi usage response invalid"], ["ZAI usage response invalid"]).
  • Candidate (506b3d1e7a in packages/ai):
    bun test test/cline-pass-usage.test.ts test/kimi-usage.test.ts test/zai-usage.test.ts passes (23 pass, 0 fail, 108 expect() calls); bun run check (oxlint, oxfmt, tsgo) exits 0.

Kimi Code answers {}, Z.AI answers "当前用户不存在coding plan", and ClinePass answers 404 "no plan history found for user" for accounts that use the provider without a metered plan. Those are steady states with nothing to meter, yet every usage poll logged them as warnings. Malformed or failed responses still warn.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T00:05:07.315729Z
We couldn’t complete this review. Comment @codex review to try again.
506b3d1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@roboomp roboomp added fix providers LLM provider-specific issues review:p0 triaged ux User experience improvements labels Oct 26, 2026

@roboomp roboomp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

P0 — scoped fixes for expected plan-less responses; all three provider regression suites pass (23 tests).
Only finding: add the assigned PR link to the external-contributor changelog entry.
Thanks @trukhinyuri for the focused fix.

Comment thread packages/ai/CHANGELOG.md Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix providers LLM provider-specific issues review:p0 triaged ux User experience improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants