Repository navigation
Conversation
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryThe PR lets the Kimi collector find global sign-ins through
The earlier test-coverage concern is addressed: Reviews (4) · Last reviewed commit: "Keep Kimi host overrides on their matchi..." · Reviewed by Greptile |
|
Looked at this today and read the diff: it makes the Kimi collector follow the oauth key in The reason is the second opinion. Every item gets a classification from two models, and the reviewer (Codex Medium) is reachable, but omabot had used up its daily review budget by the time this came up. With only one model's reading the classification is unsettled, so I stopped there rather than verify a fix whose class nobody has checked. Next: this goes round again once the budget resets. That pass classifies it with the second opinion, then reproduces the kimi.ai sign-in failure on a worker against |
Kimi Code files a global or custom-environment login under a kimi-code-env-<hash> credential slot that only the oauth key in config.toml names, so the collector looked for kimi-code.json, found nothing, and reported Kimi unavailable. Follow config.toml to the slot, lock the matching oauth/<slot>.lock, and take the OAuth and API hosts from the same login; the legacy kimi-cli home keeps the default slot and hosts. kimi.ai rejects urllib's default User-Agent with a 403, so both requests now send their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e49bc5b to
50a3517
Compare
|
Tested PR head Before the patch, the stock collector found local session statistics but returned I also verified the panel integration by installing the collector as a user-owned override and having a cloned Agents widget use it. After restarting the shell, This confirms credential discovery and live quota collection for my global sign-in. My token was still valid, so this test did not exercise the expired-token refresh path. |
volodymyrkatkalov
left a comment
There was a problem hiding this comment.
Approving after reviewing the full change at 50a35178 and verifying it against a real global Kimi sign-in.
The credential-slot validation, endpoint precedence and trust checks, legacy fallback, per-slot refresh locking, and private credential writes look sound. Live quota collection and the widget-driven refresh path both work with the environment-specific credential slot.
Focused checks passed:
agent-usage-kimi-regression-test.sh(76 assertions)agent-usage-kimi-stats-test.sh(24 assertions)kimi-agent-test.shagent-usage-update-test.shagents-panel-test.sh./test/cli(125 assertions)git diff --check quattro...HEAD
The real account had a valid access token; expired-token rotation and the per-slot lock were exercised through the new TLS regression coverage rather than against the live account.
|
Follow-up to my review: live OAuth token rotation now passes too. I invoked the collector's own refresh path against the real global Kimi service, without an HTTP fixture or changing the stored expiry. Both the access token and refresh token rotated, the new pair was persisted and reread successfully with file mode |
|
Reviewed and run at What was checked, on a disposable Omarchy worker against
The second opinion came from Codex Medium and from muse-wonder (via pi, thinking high). Neither found a defect; both read the change as proportionate and the tests as exercising the real collector rather than a stub. They agreed with what I had found, and their independence isn't guaranteed. @volodymyrkatkalov's test on a real kimi.ai login at this head, including a live token rotation, covers what a worker can't: the real service. #16431 (Pi credentials for Kimi) also edits This is now waiting on the maintainer. Nothing is needed from you. |
Adapt the credential-selection cases from omacom#19241 without inferring an active account or regional endpoints from orphaned files. The configured slot must win over leftover sign-ins; a missing slot or absent configuration must not borrow another scoped credential. Co-Authored-By: AnPod <drejc83@gmail.com> Co-Authored-By: GPT-6 (Codex) <noreply@openai.com> Co-Authored-By: Opus 5.5 High <noreply@anthropic.com> Co-Authored-By: muse-wonder High <noreply@meta.com>
A host override must select the same sign-in as Kimi Code. Keeping config.toml's global slot while overriding the API host sends that account's token to the mainland service, and a base-only override also kept the wrong OAuth host. Derive the slot from the normalized endpoint pair using Kimi Code's SHA-256 identity, and retain its default OAuth host when an override does not name one. Extend the account-selection checks to cover a missing slot beside a leftover default credential. Co-Authored-By: GPT-6 (Codex) <noreply@openai.com> Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
|
Reviewed Added account-selection tests adapted from #19241, crediting @AnPod. The configured slot wins over leftover sign-ins, and a missing configured file or an unconfigured scoped file does not borrow another account. A file alone does not identify the account's regional endpoints, so the lone-file fallback was excluded. Fixed a host-override mismatch: On the worker, The captures show the actual updater and panel using synthetic credentials and a local quota service; they establish the panel change, without claiming a live account test at this head. GPT-6 in Codex (driver effort not exposed) reviewed this, with Opus 5.5 High and muse-wonder via pi, thinking high. Opus raised the host-override mismatch; both reviewers found no blocking defects in the final head. Their final agreement is not a guarantee of independence. The global slot used as the hash oracle also appears in the real-account reports above and in #19225. The new head has a classification disagreement: I classified the reproduced failure as a |


The Kimi collector from #7274 only reads
credentials/kimi-code.json. That is where Kimi Code stores a mainland (kimi.com) login, but a global (kimi.ai) or custom-environment login is filed under akimi-code-env-<hash>slot. Only the oauth key inconfig.tomlnames that slot:For those users the collector never finds the token and the panel reports "Kimi unavailable".
Changes
config.tomlto find the credential slot (restricted tokimi-codeorkimi-code-env-<hex>, so the config can't point outsidecredentials/). Only Kimi Code's own home uses slots; a legacy kimi-cli sign-in keepskimi-code.jsonand the kimi.com hosts.oauth/<slot>.lock, the same lock Kimi Code takes for that slot, so a refresh can't race the CLI.KIMI_CODE_*,KIMI_OAUTH_HOSTandKIMI_USAGE_URLenvironment overrides still win, andALLOWED_DOMAINSstill decides whether a token is sent.api.kimi.aireturns 403 to urllib's default one (api.kimi.comaccepts it).config.tomlreading is shared withcode_routes()throughload_config(), so a config with invalid UTF-8 can't crash the collector at import.Testing
scoped_slotcase inagent-usage-kimi-regression-test.shloads a fresh collector after writing a scopedconfig.toml. It checksCREDENTIALS_PATH,USAGE_URLandTOKEN_URL, then runs a real refresh through the TLS stub with a staleoauth/<slot>.lock. The lock is taken over, held during the token request and released, and the rotated pair lands in the slot file. It also covers both sets of env overrides, a config pointing at a non-Kimi host (no token sent), a path-traversal key, and a legacy sign-in staying on the default slot. Therefreshcase now checks the User-Agent on both requests. The new checks fail against the collector onquattro.agent-usage-kimi-regression-test.sh,agent-usage-kimi-stats-test.sh,kimi-agent-test.sh,agent-usage-update-test.sh,agents-panel-test.shand./test/clipass.auth.kimi.aiunder the lock, and the rotated pair is persisted at mode 600.🤖 Generated with Claude Code
Fixes #19225