Repository navigation
fix(usage): pick the /usage scrape engine from what kiro-cli offers - #25309
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: choosing the engine from what the binary offers fixes the actual cause, and neither removed name has a reader left outside the patch. Notes
[DESIGN-REVIEWED] e1dd3dc Description read[DESCRIPTION-READ] b3a775f0cf57354c1919aa45e556e0436804aac39ea0c8f5cd073d702c772318 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The change replaces an assumed version floor with a reading of the engines kiro-cli actually offers, which is the cause #25287 names. On today's binaries the scrape argv is unchanged. What this change shipsInventory (7 items) — 7 justifiedIntent: keep the dashboard's credit reading working after kiro-cli retires its v2 engine. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] e1dd3dc Description read[DESCRIPTION-READ] b68391947eadc3463b876b87dfdf9d771e1a110bda2b1b119208ae681a3f5855 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
The credit scrape always appended `--agent-engine v2` on kiro-cli 2.28+. kiro-cli moves its default to v3 and then retires v2, after which that argv fails every scrape. Pinning v3 instead does not work: v3 sends `/usage` to the model as a prompt (checked on kiro-cli 2.35.1). The scrape now reads the `--agent-engine` values from the pinned binary's own `chat --help` (cached by path and mtime). v2 listed: pin it, as before. A selector without v2: no engine answers `/usage` locally, so the scrape is not spawned, counts as no attempt, feeds no back-off, and the GetUsageLimits API reading stands alone. No selector or an unreadable probe keeps the plain argv, as before. Closes #25287
ae1fc6b to
e1dd3dc
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved on behalf of the watch holder (bolichen). Design and First Principles pass on this head, UX skipped or pass, all checks green, no conflict, no open change request.
Problem / Motivation
Goal: The dashboard's credit reading keeps working after kiro-cli retires its v2 engine.
The usage scrape appends
--agent-engine v2to itskiro-cli chatargv on every kiro-cli 2.28+ (src/kiro_crew/dashboard/handlers/sessions_parts/usage_scrape.py). kiro-cli moves its default engine to v3 on 11/2 and then retires v2. Once v2 is gone, that argv fails every scrape.Why it matters
The scrape is the fallback whenever the
GetUsageLimitsAPI read returns no plan. With v2 gone, every such refresh spawns a kiro-cli that rejects its own argv, three of them park the scrape for six hours, and the credit pill loses its fallback for every user on the kiro-cli path.Not a goal
/usagework on v3. On kiro-cli 2.35.1,kiro-cli chat --no-interactive --agent-engine v3 /usagesends/usageto the model, which answers that it "came through to me as a chat message". There is no local v3 equivalent to pin.What changed (motivation → approach → change)
Symptom: a hardcoded
v2pin fails once v2 is retired. Root cause: the engine was chosen from a version floor (USAGE_SCRAPE_ENGINE_PIN_MIN_VERSION), never from what the binary actually offers. Pinning v3 instead would spend a model turn per refresh and print no table.Change: the scrape now asks the pinned kiro-cli which engines it accepts and picks from that.
chat --helplists for--agent-enginev2--agent-engine v2, same as todayv2src/kiro_crew/kiro_cli.py:chat_agent_engines(help_text)reads the selector's own[possible values: ...]line, andchat_agent_engines_at(binary)runs one boundedchat --help, cached by path and mtime. Like the--versionprobe it replaces, it runs only on thepin_kiro_clibinary, never on a PATH hit, because it runs outside the sandbox.usage_scrape.py:_usage_scrape_argvreturnsNonewhen no offered engine answers/usage._wrap_argv_usage_scrapethen wraps nothing.sessions.py:_run_scrapereturnsNonewithout spawning. That is not counted as an attempt and feeds no back-off. The refresh ends the way a parked one does (same-identity prior reading dimmedstale, elseavailable: falsewith the API's partial fields andreason) but is not reported asscrape_parked, since nothing will lift it. The ExternalIdP corroboration scrape leavesaccount_unproven, becauseno_credentialalone never decides.docs/system-specs/modules/learn-cron-dashboard.mddescribes the new engine rule in place of the version floor.Backwards compatibility
Compatible: on every kiro-cli in use today (2.35.1 lists
v2, v1, v3) the argv is byte-for-byte what main builds.Removes
USAGE_SCRAPE_ENGINE_PIN_MIN_VERSIONand the sessions facade's re-export ofkiro_cli_version_at(the scrape no longer imports it).Reader: src/kiro_crew/dashboard/handlers/sessions_parts/usage_scrape.py:_usage_scrape_argv -- release -- the constant's only reader, rewritten here
Reader: test/test_session_usage_scrape.py:TestUsageScrapeEngineFollowsTheInstalledKiroCli -- release -- replaces the old version-floor tests
Reader: test/campaign_facade_inventories/kiro_crew.dashboard.handlers.sessions.json -- release -- both names leave the inventory deliberately;
git grepon origin/main finds no other reader of either through the facadeTests
TestUsageScrapeEngineFollowsTheInstalledKiroCli::test_v2_retired_runs_no_scrape: a kiro-cli offeringv3, v1gets no scrape argv. Goes red if v2 is pinned again.TestRefreshWithV2Retired: with v2 retired, an API plan is published with no spawn; a plan-less API spawns nothing, parks nothing and leavesavailable: falseacross four refreshes; a same-account prior reading is keptstale.TestChatAgentEnginesParse: the selector's values are read from its own block, not from a later option's[possible values]that happens to listv2.Proof: not provable -- other: prove.py's all-hunk revert removes the new kiro_cli helper, so the tests fail at import, and its per-hunk mode wrote no report on one hunk. Manual mutation instead: putting back an unconditional
argv += ["--agent-engine", "v2"]reddens 6 tests, includingtest_v2_retired_runs_no_scrapeandTestRefreshWithV2Retired::test_no_plan_spawns_nothing_and_parks_nothing(4 spawns instead of 0).Local runs: 1882 passed across the usage, kiro_cli, spawn-audit, facade-inventory and doctor suites; 995 passed / 44 skipped across the docs and spec suites.
Manual verification
On this Linux host with kiro-cli 2.35.1:
chat_agent_engines_at(<pinned kiro-cli>)returns('v2', 'v1', 'v3')and_usage_scrape_argvbuilds... chat --no-interactive --agent-engine v2 --agent kirocrew-lite /usage, same as main. The v2-retired case is covered by unit tests only; no kiro-cli build without v2 exists yet. Windows and macOS are unverified here; the probe uses the sameCREATE_NO_WINDOWand UTF-8 pinning as the existing--versionprobe.Related Issues
Closes #25287
Sibling sweep
Swept: git grep -nE "agent-engine.*v2|"v2"" -- src/
Sibling: src/kiro_crew/dashboard/handlers/sessions_parts/usage_scrape.py -- changed here
Sibling: src/kiro_crew/acp/kas_transport.py -- not affected -- pins v3 for the KAS relay, never v2
Pattern harvest
Not generalizable: the only kiro-cli spawn that pins a retiring engine is this scrape; every other engine pin is v3.
Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.