GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(quota): correct GLM Coding Plan auth and exclude MCP allowance from model quota by lidge-jun · Pull Request #2976 · lidge-jun/opencodex Conversation
|
|
✅ Deterministic PR hygiene checks passed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughChangesThe Z.AI quota probe excludes Z.AI quota behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The PR corrects regional authentication and prevents MCP call allowances from affecting model-quota ranking. It is mergeable with owner awareness of a bounded compatibility risk: an unrecognized future quota response could temporarily clear valid quota data and affect quota-aware routing. Sequence Diagram(s)sequenceDiagram
participant fetchZaiQuota
participant ZAIQuotaEndpoint
participant parseZaiQuotaLimits
participant fetchProviderQuotaReports
fetchZaiQuota->>ZAIQuotaEndpoint: Request quota limits with host-specific Authorization
ZAIQuotaEndpoint-->>fetchZaiQuota: Return data.limits[]
fetchZaiQuota->>parseZaiQuotaLimits: Parse recognized model-limit rows
parseZaiQuotaLimits-->>fetchZaiQuota: Return quota windows or authoritative empty result
fetchZaiQuota-->>fetchProviderQuotaReports: Return quota probe result
fetchProviderQuotaReports->>fetchProviderQuotaReports: Suppress stale row when no model window exists
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes in src/providers/quota.ts, tests/provider-quota.test.ts, and docs-site/src/content/docs/guides/providers.md address issue Full details: Out of Scope Changes checkExplanation All changes are directly related to GLM Coding Plan quota support. The provider logic, quota tests, and provider documentation cover authentication, quota parsing, MCP allowance handling, stale-report clearing, and expected display behavior. No unrelated code changes are identified.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f33ddc94c
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
리뷰 · 우선순위 71 / 80설명 지금 문제는 두 갈래다. 첫째, 둘째, 검증도 맞다. typecheck, 라인 수준
메인테이너의 판단이 필요한 지점
너의 추천 merge 후 #1168을 닫아라. 인증과 ranking 오염이 이슈의 실질 본체다. MCP 전용 UI가 필요하면 새 이슈로 분리하라. 이 댓글은 grok-bot이 작성했습니다 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Reviewed exact head 1f33ddc94c73d07527997344517914f4c1bacbad.
The host-specific Authorization change and exclusion of TIME_LIMIT from model quota are both correct in isolation. The canonical-host guard and redirect: "error" keep the raw BigModel key pinned, and the focused quota/provider/GUI-row suites pass 134/134 under isolated homes after providing the existing GUI dependencies. Exact-head hosted CI is also green.
I am requesting changes because the open cache finding is valid and user-visible:
limits[] payload containing only TIME_LIMIT rows.parseZaiQuotaLimits returns null; fetchZaiQuota propagates null.fetchProviderQuotaReports treats null as a transient probe failure and preserves the previous report for up to 30 minutes.The dashboard and quota-aware routing therefore continue using stale model-token quota even though the new authoritative response says there are no model windows. Please represent a successfully parsed authoritative-empty limits[] result separately from a transient failure (whether through a dedicated sentinel/outcome or an equivalent explicit suppression path), remove the provider's last-good row for that result, and add a sequential forced-refresh regression proving token windows -> MCP-only clears the cached report. Keep malformed/transport/5xx outcomes on the existing transient-preservation path.
No repository-wide security scan was run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…obe failure Review finding on 1f33ddc: after the TIME_LIMIT exclusion, a SUCCESSFUL limits[] response carrying only MCP rows returned null, which fetchProviderQuotaReports treats as a transient probe failure and answers by preserving the last-good report for up to 30 minutes. The dashboard and quota-aware routing therefore kept using stale model-token windows even though the new authoritative response said there are none. Adds an AUTHORITATIVE_EMPTY_QUOTA sentinel beside the existing TERMINAL_QUOTA_FAILURE and routes it through the same suppression path, so the provider's last-good row is dropped. The distinction is the point: null means 'this probe told us nothing, keep the old row'; the new sentinel means 'the provider answered, and the answer is no model windows'. Malformed, transport, and 5xx outcomes stay on the transient-preservation path, and the legacy flattened Z.AI parser keeps returning null when it cannot read a payload. Regression runs two sequential forced refreshes — token windows, then MCP-only — and asserts the cached report is cleared rather than preserved.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Approved on exact head ef5377dcb720604b41db6196127d8ecf0cea7c44.
The prior cache blocker is resolved with a distinct authoritative-empty result. A successful limits[] payload containing only MCP TIME_LIMIT rows now suppresses the stale model-quota row, while transient failures still retain last-known-good data. The sequential forced-refresh regression proves token windows are removed after the later MCP-only response.
I reran tests/provider-quota.test.ts under isolated HOME, OPENCODEX_HOME, and CODEX_HOME: 110 passed, 0 failed. The exact-head cross-platform suite is green; the later dev commits are scoped Windows test fixes and do not overlap this three-file quota change.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…om model quota (lidge-jun#2976) * fix(quota): correct GLM Coding Plan auth and stop reporting MCP calls as model quota Closes lidge-jun#1168. Two defects in the BigModel Coding Plan quota probe: 1. open.bigmodel.cn expects the API key directly in Authorization with no scheme prefix and answers a Bearer header with an auth error, so BigModel Coding Plan quota never rendered at all. api.z.ai keeps Bearer. The host is already canonicalized by isCanonicalZaiBaseUrl and redirect stays 'error', so the bare key cannot reach a lookalike host. 2. TIME_LIMIT rows were mapped to monthlyPercent, but they are the shared monthly MCP *call* allowance for search-prime / web-reader / zread, not a model-token window. This was not merely a mislabelled bar: headroomOf() in src/oauth/account-quota-rank.ts takes the MAX across every window, so a user who spent their web-search allowance had that read as exhausted model capacity and a healthy account was demoted in quota-aware ranking. Row type is now gated before a percentage is derived, so an MCP row cannot contribute a value at all, and a payload carrying only TIME_LIMIT rows reports no quota rather than a fabricated one. Absent windows stay absent instead of being synthesized as 0. Tests: existing Z.AI/BigModel cases updated to assert the raw-key header and absent monthly window, plus two new regressions — a fully-spent MCP allowance yields no report, and the real V1 Lite shape keeps weekly/monthly absent rather than 0. * test(quota): keep the legacy Z.AI monthlyMCPUsage mapping intact The legacy field-name fallback is a different contract from the limits[] parser: it reads an explicit monthlyMCPUsage field from an api.z.ai payload, where mapping to monthlyPercent is the pre-existing documented behavior. Issue lidge-jun#1168 scopes the TIME_LIMIT exclusion to the limits[] parser only, so parseZaiQuotaLegacyFields stays untouched to avoid regressing older responses. * fix(quota): distinguish an authoritative-empty GLM response from a probe failure Review finding on 1f33ddc: after the TIME_LIMIT exclusion, a SUCCESSFUL limits[] response carrying only MCP rows returned null, which fetchProviderQuotaReports treats as a transient probe failure and answers by preserving the last-good report for up to 30 minutes. The dashboard and quota-aware routing therefore kept using stale model-token windows even though the new authoritative response said there are none. Adds an AUTHORITATIVE_EMPTY_QUOTA sentinel beside the existing TERMINAL_QUOTA_FAILURE and routes it through the same suppression path, so the provider's last-good row is dropped. The distinction is the point: null means 'this probe told us nothing, keep the old row'; the new sentinel means 'the provider answered, and the answer is no model windows'. Malformed, transport, and 5xx outcomes stay on the transient-preservation path, and the legacy flattened Z.AI parser keeps returning null when it cannot read a payload. Regression runs two sequential forced refreshes — token windows, then MCP-only — and asserts the cached report is cleared rather than preserved.
…om model quota (lidge-jun#2976) * fix(quota): correct GLM Coding Plan auth and stop reporting MCP calls as model quota Closes lidge-jun#1168. Two defects in the BigModel Coding Plan quota probe: 1. open.bigmodel.cn expects the API key directly in Authorization with no scheme prefix and answers a Bearer header with an auth error, so BigModel Coding Plan quota never rendered at all. api.z.ai keeps Bearer. The host is already canonicalized by isCanonicalZaiBaseUrl and redirect stays 'error', so the bare key cannot reach a lookalike host. 2. TIME_LIMIT rows were mapped to monthlyPercent, but they are the shared monthly MCP *call* allowance for search-prime / web-reader / zread, not a model-token window. This was not merely a mislabelled bar: headroomOf() in src/oauth/account-quota-rank.ts takes the MAX across every window, so a user who spent their web-search allowance had that read as exhausted model capacity and a healthy account was demoted in quota-aware ranking. Row type is now gated before a percentage is derived, so an MCP row cannot contribute a value at all, and a payload carrying only TIME_LIMIT rows reports no quota rather than a fabricated one. Absent windows stay absent instead of being synthesized as 0. Tests: existing Z.AI/BigModel cases updated to assert the raw-key header and absent monthly window, plus two new regressions — a fully-spent MCP allowance yields no report, and the real V1 Lite shape keeps weekly/monthly absent rather than 0. * test(quota): keep the legacy Z.AI monthlyMCPUsage mapping intact The legacy field-name fallback is a different contract from the limits[] parser: it reads an explicit monthlyMCPUsage field from an api.z.ai payload, where mapping to monthlyPercent is the pre-existing documented behavior. Issue lidge-jun#1168 scopes the TIME_LIMIT exclusion to the limits[] parser only, so parseZaiQuotaLegacyFields stays untouched to avoid regressing older responses. * fix(quota): distinguish an authoritative-empty GLM response from a probe failure Review finding on 1f33ddc: after the TIME_LIMIT exclusion, a SUCCESSFUL limits[] response carrying only MCP rows returned null, which fetchProviderQuotaReports treats as a transient probe failure and answers by preserving the last-good report for up to 30 minutes. The dashboard and quota-aware routing therefore kept using stale model-token windows even though the new authoritative response said there are none. Adds an AUTHORITATIVE_EMPTY_QUOTA sentinel beside the existing TERMINAL_QUOTA_FAILURE and routes it through the same suppression path, so the provider's last-good row is dropped. The distinction is the point: null means 'this probe told us nothing, keep the old row'; the new sentinel means 'the provider answered, and the answer is no model windows'. Malformed, transport, and 5xx outcomes stay on the transient-preservation path, and the legacy flattened Z.AI parser keeps returning null when it cannot read a payload. Regression runs two sequential forced refreshes — token windows, then MCP-only — and asserts the cached report is cleared rather than preserved.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.