Skip to content

Restore z.ai rate-window pace - #2802

Merged
steipete merged 4 commits into
steipete:mainfrom
kiranmagic7:kiran/restore-zai-mcp-monthly-pace-20260809
Aug 10, 2026
Merged

Restore z.ai rate-window pace#2802
steipete merged 4 commits into
steipete:mainfrom
kiranmagic7:kiran/restore-zai-mcp-monthly-pace-20260809

Conversation

@kiranmagic7

@kiranmagic7 kiranmagic7 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Addresses the remaining z.ai regression in #2431.

The JavaScript provider migration kept computing TIME_LIMIT durations but stopped exporting them. That dropped the established monthly MCP marker and left the z.ai descriptor without its verified 5-hour and weekly pace lanes.

This restores the one-minute MCP marker as the existing calendar-month sentinel, preserves explicit TIME_LIMIT durations, leaves unknown cadence unset, and enables pace only for the verified 5-hour and weekly slots. Monthly inference also requires the adapter's MCP marker, so an explicit rolling 30-day token or credit window retains its duration without being rewritten as a calendar month.

Verification:

  • CI=1 CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --disable-keychain --disable-netrc --filter "ZaiProviderTests|ProviderPaceCapabilityTests|CLISnapshotTests|ProviderPresentationPolicyCharacterizationTests|UsagePaceTextTests|ZaiMenuCardTests|MenuBarPaceTextTests" — 98 tests passed
  • CI=1 CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 ./Scripts/test-plugin-engines.sh — 76 tests passed under QuickJS and 76 under JavaScriptCore
  • make check — passed
  • CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 make test — all 833 selections passed in 70 groups; no retries or timeouts
  • git diff --check origin/main...HEAD — passed
  • Final Codex autoreview — no accepted/actionable findings
  • swift build -c release --product CodexBarCLI — passed

Real provider proof

A maintainer-owned z.ai QA credential was injected at runtime through the approved 1Password service-account path; the key value, account identity, and usage percentages were never printed or added to the PR. The same command was run before and after the patch.

  • Current-main behavior: source api; real primary window 5-hour; windowMinutes: 300; reset present; no pace object.
  • PR behavior: source api; the same 5-hour / 300-minute/reset-bearing window; pace.primary present; no provider error.

This directly exercises the reported real-provider regression while confirming that authentication and window selection remain unchanged.

Compatibility risk is low: token and credit parsing is unchanged, explicit rolling cadences are preserved, and unknown MCP cadence remains fail-closed.

Review focus: the one-minute marker mapping, the MCP-only monthly discriminator, and the exact z.ai descriptor lane rules.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 9, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 894a6ee431

ℹ️ 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".

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".

Comment thread Sources/CodexBarCore/Providers/Zai/ZaiProviderDescriptor.swift Outdated
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Aug 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed August 9, 2026, 8:21 PM ET / August 10, 2026, 00:21 UTC.

ClawSweeper review

What this changes

The PR restores z.ai time-limit durations, adds tightly scoped pace rules for five-hour, weekly, and MCP-monthly windows, and expands regression coverage.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Needs maintainer review before merge - 3 items remain

This PR fixes the verified five-hour and weekly z.ai pace path, but it does not actually render the claimed MCP-monthly pace in the menu because the extra-window renderer still rejects z.ai. A small code-and-test follow-up is needed before merge.

Priority: P2
Reviewed head: a6f15b941ac6880662413234328e6964cefba534

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The real-provider proof and focused tests are useful, but a concrete P2 menu integration gap prevents the claimed MCP-monthly behavior.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body provides redacted before/after live z.ai provider results showing the same five-hour window gains a pace object without changing authentication or window selection.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides redacted before/after live z.ai provider results showing the same five-hour window gains a pace object without changing authentication or window selection.
Evidence reviewed 6 items Duration mapping: The PR exports TIME_LIMIT durations, treating the one-minute MCP marker as the monthly sentinel while retaining other explicit durations.
Descriptor rules: The PR declares z.ai five-hour, weekly, and MCP-monthly pace capabilities with an MCP semantic discriminator.
Blocked menu path: Menu-card extra windows are hard-coded to Codex, Claude, and Antigravity, then only handle 300- and 10,080-minute windows; the z.ai MCP extra window therefore cannot display the new monthly pace.
Findings 1 actionable finding [P2] Render z.ai MCP pace in the extra-window path
Security None None.

How this fits together

The z.ai plugin converts quota API limits into normalized primary, secondary, and MCP extra usage windows. Descriptor pace rules feed CLI output and menu-card rendering, where the MCP window follows the extra-window display path.

flowchart LR
A[z.ai quota API] --> B[JavaScript adapter]
B --> C[Primary, weekly, and MCP windows]
C --> D[z.ai pace descriptor]
D --> E[CLI pace output]
C --> F[Menu extra-window renderer]
F --> G[Menu card pace detail]
Loading

Before merge

  • Render z.ai MCP pace in the extra-window path (P2) - This capability recognizes the MCP monthly sentinel, but z.ai MCP is an extraRateWindow. The menu renderer currently returns before handling z.ai and only supports 300- and 10,080-minute extras, so the advertised MCP-monthly pace never appears. Route this window through descriptor-backed reset-window pace rendering and add a menu-card regression for it.
  • Resolve merge risk (P1) - Merging now leaves the advertised MCP-monthly pace inactive in the menu card despite the new descriptor capability and duration mapping.
  • Complete next step (P2) - The remaining blocker is a narrow, mechanical menu-rendering integration and regression-test repair.

Findings

  • [P2] Render z.ai MCP pace in the extra-window path — Sources/CodexBarCore/Providers/Zai/ZaiProviderDescriptor.swift:95-104
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch surface 9 files; production +23/-1, tests +193/-23, changelog +1 Most of the change is focused regression coverage, but the untested menu integration remains a merge blocker.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #2431
Summary: This PR is a candidate fix for the z.ai portion of the canonical multi-provider missing-duration report, but its MCP menu path remains incomplete.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Route the z.ai MCP extra window through descriptor-backed reset-window pace rendering, then add a menu-card regression that proves the monthly pace appears while rolling 30-day token and credit windows remain excluded.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Route the z.ai MCP extra window through descriptor-backed reset-window pace rendering, then add a menu-card regression that proves the monthly pace appears while rolling 30-day token and credit windows remain excluded.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: a z.ai MCP extra window reaches the menu extra-window renderer, whose current provider gate excludes z.ai before its descriptor pace rule can run.

Is this the best way to solve the issue?

No; the adapter and descriptor repair is sound for five-hour and weekly windows, but it must also connect the MCP extra-window menu path to reset-window pace rendering.

Full review comments:

  • [P2] Render z.ai MCP pace in the extra-window path — Sources/CodexBarCore/Providers/Zai/ZaiProviderDescriptor.swift:95-104
    This capability recognizes the MCP monthly sentinel, but z.ai MCP is an extraRateWindow. The menu renderer currently returns before handling z.ai and only supports 300- and 10,080-minute extras, so the advertised MCP-monthly pace never appears. Route this window through descriptor-backed reset-window pace rendering and add a menu-card regression for it.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 648a948b7ab4.

Labels

Label justifications:

  • P2: The PR repairs a bounded provider display regression, but its MCP-monthly user-visible path remains incomplete.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body provides redacted before/after live z.ai provider results showing the same five-hour window gains a pace object without changing authentication or window selection.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides redacted before/after live z.ai provider results showing the same five-hour window gains a pace object without changing authentication or window selection.

Evidence

Acceptance criteria:

  • [P1] CI=1 CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --disable-keychain --disable-netrc --filter "ZaiMenuCardTests|ZaiProviderTests|ProviderPaceCapabilityTests|UsagePaceTextTests|CLISnapshotTests".
  • [P1] make check.
  • [P1] make test.

What I checked:

Likely related people:

  • steipete: Current-main blame attributes the extra-window pace gate to this contributor, who also authored the PR head’s final release-note commit. (role: recent area contributor; confidence: high; commits: 0e46d1940c35, a6f15b941ac6; files: Sources/CodexBar/MenuCardView+ModelHelpers.swift, CHANGELOG.md)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Render the z.ai MCP extra window through the reset-window pace path.
  • Add a menu-card regression proving MCP pace appears and rolling 30-day token or credit windows remain excluded.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-09T06:23:38.824Z sha 894a6ee :: needs real behavior proof before merge. :: [P2] Scope the monthly sentinel to the MCP window
  • reviewed 2026-08-09T06:49:28.655Z sha 3ab4720 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-09T07:09:37.261Z sha 3ab4720 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Aug 9, 2026
@steipete
steipete force-pushed the kiran/restore-zai-mcp-monthly-pace-20260809 branch from 3ab4720 to a6f15b9 Compare August 10, 2026 00:15
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 10, 2026
@steipete
steipete merged commit 1f0004e into steipete:main Aug 10, 2026
9 checks passed
@steipete

Copy link
Copy Markdown
Owner

Post-merge proof:

  • Focused z.ai/pace coverage: 98 tests passed.
  • Provider plugin A/B: QuickJS 76/76 passed; JavaScriptCore 76/76 passed.
  • make check: passed.
  • Full suite: 833 selections across 70 groups passed, with no retries or timeouts.
  • Real-provider before/after, using an approved 1Password-injected maintainer QA credential (usage percentages, account identity, and key redacted):
    • Before on current main: source=api; primary windowMinutes=300; reset present; pace absent.
    • After on this PR: the same source=api, primary windowMinutes=300, and reset; pace.primary present; no error.
  • CI: https://github.com/steipete/CodexBar/actions/runs/31343945858completed / success for head a6f15b941ac6880662413234328e6964cefba534, including lint, changes, Linux arm64/x64/musl, both macOS shards, aggregate, and security.
  • Squash merge: 1f0004eea73663e39ec38025071113325ba759c8.

Scope caveat: this PR fixes the remaining z.ai regression only. #2431 tracks multiple providers and remains open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants