Skip to content

feat(usage): show Kiro subscription credits in the status bar - #26390

Closed
w-felipe360 wants to merge 20 commits into
stablyai:mainfrom
w-felipe360:fix/kiro-pr-14001-main-conflicts
Closed

w-felipe360 wants to merge 20 commits into
stablyai:mainfrom
w-felipe360:fix/kiro-pr-14001-main-conflicts

Conversation

@w-felipe360

@w-felipe360 w-felipe360 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca now shows Kiro subscription credits in the status bar. A Kiro CLI configured outside the usual install paths is also detected, so its usage meter remains available.

What Changed

  • Added a Kiro usage fetcher for the CLI's local /usage command and integrated its plan, percentage, and reset description with rate-limit refresh and the status bar.
  • Added the Kiro visibility setting, compact Q label, and preference migration for existing profiles.
  • Made local Kiro detection validate KIRO_CLI_PATH with the same command resolution used by the usage fetcher. An invalid configured command does not count as an installed agent.
  • Routed the usage command through Orca's shared child-process runner, including Windows .cmd handling, cancellation, timeout, and bounded output.
  • Accepts CLI reset descriptions such as 01/01 without inventing a reset time.
  • Merged current main and resolved the Kiro integration conflicts.

Why

Kiro already exposes subscription usage through its CLI. Reading that command avoids storing credentials or depending on a private API. Checking the configured executable in local detection keeps the meter and its menu toggle available when Kiro lives outside PATH, while WSL and SSH continue detecting agents on their own execution hosts.

Linked Issue

Related to #9559 (Kiro subscription). This PR builds on #14001.

Visual Proof

These screenshots were captured for #14001 on an earlier visual baseline. The current merge was verified with automated tests and typechecks.

Before After
Appearance settings before Kiro usage Appearance settings with Kiro usage

Testing

  • Manually tested in the Electron UI on this update.
  • Automated tests added and updated: 55 focused tests across Kiro fetching, agent detection, refresh orchestration, status-bar settings, and reset labels passed on Windows.
  • pnpm tc passed on Windows.
  • pnpm run check:code-quality:changed -- e3639ef8d69209b8278b41c0e722811960ea7ec0 passed on Windows.

AI Disclosure

OpenAI Codex assisted with the review fix, merge resolution, and validation.

Review

The configured path affects local Kiro detection only. WSL and SSH use their own host detection. The fetcher runs a fixed argument list with bounded output and does not read or store credentials.

Agent skill upstream boundary

  • This change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The screenshots reflect #14001's earlier visual baseline. macOS, Linux, SSH, mobile, and a visible Electron window were not manually tested for this update.

Checklist

  • The user-facing change, mechanism, and reason are described above.
  • Before and after UI screenshots are linked above.
  • Reviewed correctness, security, performance, and host-specific execution.
  • Cross-platform and SSH/remote behavior considered; the path override remains local.
  • Focused tests, typecheck, and changed-file quality gate passed locally; The full build and platform test matrix were not run locally.

guanbear and others added 17 commits September 28, 2026 10:02
formatRateLimitResetLabel returned null for human-readable
resetDescription values such as "Thu" or "2:30 PM" because only ISO
dates were recognized. Return non-date descriptions unchanged so the
status bar keeps a valid reset label.
execFile cannot launch configured .cmd/.bat paths directly on Windows.
Route the Kiro usage command through getSpawnArgsForWindows like the
other usage fetchers; native binaries keep the direct execFile path.
The Antigravity coverage landed upstream after this branch last
rebased. Its test file predates the Kiro provider, so the shared
resetRateLimitProviderMocks harness now fails on the unmocked
fetchKiroRateLimits import. Declare the same vi.mock the other service
test files use.
Upstream now feeds a ticking `now` into ProviderRateLimitWindowSection;
`formatRateLimitResetLabel` gains an optional `now` (default Date.now())
so the label keeps re-rendering on the clock without inventing reset times.
Signed-off-by: guanbear <123guan@gmail.com>
# Conflicts:
#	src/main/rate-limits/rate-limit-service-test-harness.ts
#	src/main/rate-limits/service-account-target-selection.test.ts
#	src/main/rate-limits/service-inactive-account-previews.test.ts
#	src/main/rate-limits/service-live-claude-usage.test.ts
#	src/main/rate-limits/service-minimax-usage.test.ts
#	src/main/rate-limits/service-refresh-orchestration.test.ts
#	src/main/rate-limits/service-window-activation.test.ts
#	src/main/rate-limits/service/service-full-cycle-application.ts
#	src/main/rate-limits/service/service-full-cycle-preparation.ts
#	src/main/rate-limits/service/service-polling.ts
#	src/main/rate-limits/service/service-state.ts
#	src/main/rate-limits/service/service-types.ts
#	src/renderer/src/components/settings/appearance-status-bar-search.ts
#	src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
#	src/renderer/src/components/status-bar/StatusBarVisibilityMenu.tsx
#	src/renderer/src/components/status-bar/status-bar-agent-gating.test.ts
#	src/renderer/src/components/status-bar/status-bar-agent-gating.ts
#	src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
#	src/renderer/src/components/status-bar/usage-provider-settings-target.ts
#	src/renderer/src/components/status-bar/use-status-bar-controller.ts
#	src/renderer/src/i18n/locales/en.json
#	src/renderer/src/store/slices/ui-hydration-workspace-preferences.test.ts
#	src/renderer/src/store/slices/ui/ui-slice-hydration-status-bar-items.ts
#	src/shared/persisted-ui-state-types.ts
#	src/shared/rate-limit-state-factory.ts
#	src/shared/rate-limit-types.test.ts
#	src/shared/rate-limit-types.ts
#	src/shared/rpc-contract/client-ui-params.ts
#	src/shared/status-bar-defaults.ts
#	src/shared/ui-chrome-types.ts
# Conflicts:
#	src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
#	src/renderer/src/i18n/locales/en.json
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2d804246-a9f6-4ae3-8382-1a6eef2c752e
📥 Commits

Reviewing files that changed from the base of the PR and between 92add40 and b850900.

📒 Files selected for processing (2)
  • src/main/rate-limits/kiro-usage-fetcher.test.ts
  • src/main/rate-limits/kiro-usage-fetcher.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/rate-limits/kiro-usage-fetcher.test.ts
  • src/main/rate-limits/kiro-usage-fetcher.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change adds Kiro CLI usage fetching and integrates Kiro rate-limit state into refresh cycles and installed-agent detection. The fetcher parses usage and reset-date information and returns unavailable or error results for command failures. The status bar now supports Kiro visibility, provider details, reset labels, and settings. Kiro is added to default status-bar items through a persisted migration flag.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to b8509

No actionable merge-blocking issue is established for the reviewed changes. Complete the normal checks before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 43 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main user-facing change: showing Kiro subscription credits in the status bar.
Description check ✅ Passed The description covers the required sections, user impact, implementation, rationale, issue references, visual proof, testing, AI disclosure, compatibility notes, and checklist. It also clearly record…
  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4275e641-29f2-42be-ba78-4957faf6b8d7
📥 Commits

Reviewing files that changed from the base of the PR and between 7c88ab7 and 2ef26e2.

📒 Files selected for processing (42)
  • src/main/rate-limits/kiro-usage-fetcher.test.ts
  • src/main/rate-limits/kiro-usage-fetcher.ts
  • src/main/rate-limits/rate-limit-service-test-harness.ts
  • src/main/rate-limits/service-account-target-selection.test.ts
  • src/main/rate-limits/service-antigravity-usage.test.ts
  • src/main/rate-limits/service-cursor-usage.test.ts
  • src/main/rate-limits/service-inactive-account-previews.test.ts
  • src/main/rate-limits/service-live-claude-usage.test.ts
  • src/main/rate-limits/service-minimax-usage.test.ts
  • src/main/rate-limits/service-opencode-go-credentials.test.ts
  • src/main/rate-limits/service-refresh-orchestration.test.ts
  • src/main/rate-limits/service-window-activation.test.ts
  • src/main/rate-limits/service-zcode-usage.test.ts
  • src/main/rate-limits/service/service-full-cycle-application.ts
  • src/main/rate-limits/service/service-full-cycle-preparation.ts
  • src/main/rate-limits/service/service-polling.ts
  • src/main/rate-limits/service/service-state.ts
  • src/main/rate-limits/service/service-types.ts
  • src/renderer/src/components/settings/appearance-status-bar-kiro-toggle-search.ts
  • src/renderer/src/components/settings/appearance-status-bar-search.ts
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
  • src/renderer/src/components/status-bar/StatusBarVisibilityMenu.tsx
  • src/renderer/src/components/status-bar/status-bar-agent-gating.test.ts
  • src/renderer/src/components/status-bar/status-bar-agent-gating.ts
  • src/renderer/src/components/status-bar/status-bar-provider-letter.test.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • src/renderer/src/components/status-bar/tooltip-reset-label.test.ts
  • src/renderer/src/components/status-bar/tooltip.tsx
  • src/renderer/src/components/status-bar/usage-error-copy.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.test.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.ts
  • src/renderer/src/components/status-bar/use-status-bar-controller.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/store/slices/ui-hydration-workspace-preferences.test.ts
  • src/renderer/src/store/slices/ui/ui-slice-hydration-status-bar-items.ts
  • src/shared/persisted-ui-state-types.ts
  • src/shared/rate-limit-state-factory.ts
  • src/shared/rate-limit-types.ts
  • src/shared/rpc-contract/client-ui-params.ts
  • src/shared/status-bar-defaults.ts
  • src/shared/ui-chrome-types.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread src/renderer/src/components/status-bar/use-status-bar-controller.ts
@w-felipe360 w-felipe360 changed the title Fix/kiro pr 14001 main conflicts feat(usage): show Kiro subscription credits in the status bar Oct 8, 2026
@w-felipe360

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7087be14-9a27-4ccb-8e9a-88493a17fd30
📥 Commits

Reviewing files that changed from the base of the PR and between 2ef26e2 and 92add40.

📒 Files selected for processing (11)
  • src/main/ipc/preflight-agent-detection.test.ts
  • src/main/preflight/agent-detection.ts
  • src/main/rate-limits/kiro-usage-fetcher.test.ts
  • src/main/rate-limits/kiro-usage-fetcher.ts
  • src/main/rate-limits/service-live-claude-usage.test.ts
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
  • src/renderer/src/components/status-bar/usage-provider-settings-target.test.ts
  • src/renderer/src/components/status-bar/usage-provider-settings-target.ts
  • src/renderer/src/components/status-bar/use-status-bar-controller.ts
  • src/renderer/src/i18n/locales/en.json
  • src/shared/rate-limit-types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/i18n/locales/en.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread src/main/rate-limits/kiro-usage-fetcher.ts Outdated
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@w-felipe360

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

w-felipe360 added a commit to w-felipe360/orca that referenced this pull request Oct 8, 2026
Carries forward the fixes from stablyai#26390 that the stablyai#14001 head does not have:

- Local agent detection validates a configured KIRO_CLI_PATH with the same
  resolution the usage fetcher uses, so a Kiro CLI outside PATH keeps its
  meter and menu toggle; an invalid configured command is not detected,
  and WSL detection is unaffected.
- The usage command is killed at the 1 MiB output cap and truncated output
  is rejected instead of being parsed as a valid total.
- Reset descriptions that are not ISO dates (for example "01/01") are kept
  as display text instead of failing to parse.
@w-felipe360

Copy link
Copy Markdown
Contributor Author

Closing in favor of #26639, which now carries everything from this PR so reviewers only need to look at one.

#26639 builds on @guanbear's current #14001 head. The fixes from here that #14001 does not have are ported in 9cc7e7c:

  • KIRO_CLI_PATH detection in local agent detection
  • killing the usage command at the output cap and rejecting truncated output
  • non-ISO reset descriptions

Each comes with its tests. #26639 also adds Kiro agent status (pets, sidebar, completion notifications) and Kiro conversations in Agent session history.

@w-felipe360 w-felipe360 closed this Oct 8, 2026
guanbear pushed a commit to guanbear/orca that referenced this pull request Oct 12, 2026
Carries forward the fixes from stablyai#26390 that the stablyai#14001 head does not have:

- Local agent detection validates a configured KIRO_CLI_PATH with the same
  resolution the usage fetcher uses, so a Kiro CLI outside PATH keeps its
  meter and menu toggle; an invalid configured command is not detected,
  and WSL detection is unaffected.
- The usage command is killed at the 1 MiB output cap and truncated output
  is rejected instead of being parsed as a valid total.
- Reset descriptions that are not ISO dates (for example "01/01") are kept
  as display text instead of failing to parse.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants