Skip to content

feat(kiro): Kiro account usage tracking and status-bar integration - #23650

Open
JuanmanDev wants to merge 3 commits into
stablyai:mainfrom
JuanmanDev:kiro-usage-tracking
Open

JuanmanDev wants to merge 3 commits into
stablyai:mainfrom
JuanmanDev:kiro-usage-tracking

Conversation

@JuanmanDev

@JuanmanDev JuanmanDev commented Sep 28, 2026 •

Copy link
Copy Markdown

ELI5

Adds Kiro to Orca's account and usage features. You can now see your Kiro CLI usage in the status bar (and on mobile) and manage the Kiro account in Settings, the same way Claude, Codex, Grok, and the other providers already work.

What Changed

  • New Kiro CLI engine support (kiro-cli-engine, session option catalog, terminal-title/conversation-name derivation for Kiro rows).
  • A kiro-usage status-bar segment with a roster meter and a reset-credit indicator, gated on the kiro CLI being on PATH (mirrors how Grok is handled). Existing users receive it through the same one-shot hydration migration used for Grok/Cursor/ZCode, so it is default-on for them too, not only for fresh profiles.
  • A Kiro section in Settings → Accounts (KiroAccountsSection), always available since Kiro is CLI/SSO-auth with no persisted credential to gate on, and searchable like every other provider section.
  • A mobile Kiro usage section (MobileKiroUsageSection) and Kiro entries in the mobile accounts snapshot.
  • Usage reconciliation (kiro-usage-reconcile) and shared kiro-usage-types, wired through the preload bridge/API and the renderer store slice.
  • A pre-launch write of Kiro's chat.terminalTitle setting, on the local machine through kiro-cli settings and on an SSH execution host through the remote filesystem provider.

Before: Kiro ran as an agent but had no first-class usage visibility or account management, and a Kiro pane had no identity in the sidebar. After: Kiro appears in the status bar, Settings → Accounts, and mobile alongside the other providers, and its panes identify themselves.

Why

Kiro was already a supported agent but lacked the usage/account parity the other providers have. Because Kiro is CLI/SSO-authenticated (no persisted credential), its visibility keys off the kiro CLI on PATH plus the status-bar item toggle — the same durable-signal approach already used for Grok — rather than a credential check.

Two design choices worth calling out:

  • kiro-cli settings rather than a whole-file write. chat.terminalTitle is off by default, and that title (kiro: <session>) is the only thing Kiro emits that identifies the pane. Orca only sets the key when it is absent, so a user who turns it off is never overridden. Rewriting the whole cli.json would have erased a model or effort change another Kiro session persisted between Orca's read and its write, so the single-key CLI command is used instead. The remote half goes through the filesystem provider, the same contract the remote Codex and Copilot trust writes already use.
  • --effort is only emitted when the user picks a level. The flag is a session override that beats the effort saved in chat.modelDefaults, so an untouched picker sends nothing and Kiro's own saved preference stands.

Linked Issue

Fixes #9559
Fixes #7693

Visual Proof

Before: none of this existed. Kiro ran as an agent, but there was no Kiro row in the usage roster, no Kiro segment in the status bar, and no Kiro section in Settings → Accounts — the screens below simply had no Kiro in them.

After:

Settings → Accounts → Kiro, sitting alongside the existing providers. No credential to manage, so the section shows the plan tier, a manual refresh, and the monthly meter: 43%, 432.42 / 1000 credits, Resets 2026-10-01.

Settings Accounts pane showing the new Kiro section below Cursor, with KIRO PRO, a Refresh usage button, and a 43% / 432.42 of 1000 credits meter resetting 2026-10-01

Status bar and usage roster (detailed). Kiro appears in the footer next to Claude (43% used 2d 4h), as a roster row with its 30-day meter, and in the provider panel with the monthly window, credit count and reset countdown.

Usage roster popover in detailed mode with a Kiro row reading Kiro Pro, resets in 2d 4h, 30d 43 percent, and a Kiro provider panel showing KIRO PRO, 432.42 of 1000 credits and a monthly bar at 43 percent used; the status bar footer shows the Kiro segment beside Claude

Compact mode, which is the density the status bar collapses to.

Usage roster popover in compact mode listing Kiro Kiro Pro at 2d 4h 43 percent above Claude, with the status bar footer showing 43 percent used 2d 4h for Kiro

Testing

  • Ran the dev build locally on macOS (Electron app launches; node-pty rebuilt for this machine's toolchain).

  • pnpm typecheck passes: web, node, and cli.

  • pnpm run check:code-quality:changed passes across all 85 changed files (code quality, casting, focused plugins, type-aware, React Doctor, design system, SAFETY rationale).

  • Test suites for every touched area pass: mobile/src, src/main/kiro, src/main/kiro-usage, src/main/ipc/kiro-usage, src/main/runtime, src/preload, src/renderer/src/store/slices, src/renderer/src/components/{sidebar,status-bar,settings}, and all of src/shared.

  • Not run locally: pnpm build (native toolchain limitation on this machine) — CI covers it.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Unit tests cover the new shared logic (kiro-cli-engine, kiro-usage-reconcile, kiro-terminal-title, kiro-row-conversation-name, status-bar reset-credit-indicator, store slice, mobile account usage state) plus regressions for each review finding: the clamped/anchored usage percentage, the untouched-effort launch, the Kiro title envelope not claiming a trailing owner name, the decorated-wrapper rejection, and both the local and remote terminal-title preflights.

AI Disclosure

Claude Opus 5 (1M context) via Claude Code was used for the implementation and for applying the review feedback. All changes were reviewed before committing.

Review

Review feedback from CodeRabbit and Pullfrog has been applied in full:

Finding Resolution
usedPercent could exceed 100 and make the mobile accounts snapshot reject every provider Clamped to 0–100 in kiro-usage-parser
The % match scanned the whole stdout+stderr blob, so a stray % could become the plan percentage Anchored to the text after the credits line and only trusted when it agrees with used/limit
--effort medium was emitted for an untouched picker, discarding the user's saved Kiro effort Catalog default is now CLI default, which emits no flag
kiro: fix the pager - codex resolved to conflicting-anchored-names instead of Kiro A native title envelope no longer has its session text parsed as a second owner claim
✳ Review | kiro: usage (a Claude task title) was classified as a Kiro pane The optional wrapper segment now rejects agent status glyphs and Claude's . /* prefixes
The whole-file cli.json write could erase a concurrent Kiro settings change Switched to kiro-cli settings chat.terminalTitle true, after the same existing-key check
No remote preflight, so an SSH Kiro pane had no identity signal Added applyRemoteAgentLaunchPreflight, writing through the remote filesystem provider
kiro-usage was default-on for new profiles only Added _kiroStatusBarDefaultAdded to the one-shot hydration migration, its persisted type, and the RPC mirror
The Kiro accounts section bypassed the settings search gate Added getAccountsKiroSearchEntries and wrapped the section in matchesSettingsSearch
scripts/dev-local.sh was machine-specific Removed

Two review notes deliberately left as-is:

  • getProviderLetter returns 'Ki'. Single letters are exhausted around Kiro (K is Kimi), and ProviderLetterBadge has no fixed width, so two characters lay out correctly. It is also only reached by the icon-only narrow status bar — every screenshot above shows the Kiro glyph instead — so a single arbitrary letter would be less readable without being more visible.
  • The inline Codex reset-credit badge. It is small, self-contained and tested, and splitting it out now would mean rewriting the status-bar segment twice. Happy to pull it into its own PR if a reviewer prefers.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: the usage read runs the resolved local CLI through runProcess with an argument array, a bounded timeout and captured output — no shell, no dynamic command string. The Kiro settings write is a single-key kiro-cli settings call.
  • Cross-platform: provider gating uses PATH detection; no OS-specific assumptions added. Remote paths are built from the host-resolved home, not from local path joins.
  • Remote/SSH: usage arrives over the existing rate-limit push, and the terminal-title preflight now has a host-side branch. Remote home resolution was extracted to src/main/ssh/remote-agent-home.ts and is shared with the remote trust presets rather than duplicated.
  • Mobile: a Kiro usage section is included, and the clamped percentage keeps a bad Kiro value from invalidating the whole accounts snapshot.
  • Backwards compatibility: kiro/kiro-usage are additive to the provider unions, rate-limit records, and the shared StatusBarItem enum. The mobile snapshot decodes hosts that omit kiro entirely, which is covered by a test.
  • Performance: the /usage read is a background, deduplicated call with a freshness window; the terminal-title preflight only runs when the key is absent.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred) — pnpm build not run locally (native toolchain limitation on this machine)

🤖 Generated with Claude Code

Juan Manuel Bécares added 2 commits September 28, 2026 17:45
Add Kiro CLI engine support with account usage tracking, status-bar
provider segment, settings accounts section, and mobile usage section.
Includes reset-credit indicator, usage reconciliation, and terminal
title/conversation-name derivation for Kiro rows.
# Conflicts:
#	.gitignore
#	mobile/src/components/accounts-snapshot.ts
#	src/main/runtime/rpc/methods/client-ui-schemas.ts
#	src/main/runtime/runtime-worktree-agent-startup.ts
#	src/preload/api-types.ts
#	src/preload/index.ts
#	src/renderer/src/components/settings/AccountsPane.tsx
#	src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
#	src/renderer/src/components/status-bar/status-bar-provider-visibility.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.ts
#	src/renderer/src/components/status-bar/use-status-bar-controller.ts
#	src/shared/agent-row-conversation-name.ts
#	src/shared/agent-session-option-catalog.ts
#	src/shared/rate-limit-state-factory.ts
#	src/shared/rate-limit-types.test.ts
#	src/shared/rate-limit-types.ts
#	src/shared/terminal-title-agent-type.ts
#	src/shared/tui-agent-config.ts
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The changes add Kiro CLI usage parsing, refresh, storage, and display in renderer and mobile interfaces. They add Kiro session options, terminal-title recognition, and local and remote terminal-title setup. The status bar gains Kiro usage controls and Codex reset-credit badges. The root ignore rules now exclude .local-screenshots/.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 8a41f

Resolve the remote settings overwrite risk before merging. The local preflight should also respect KIRO_HOME so it changes the profile the user actually selected.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 8a41f

Kiro usage is integrated across desktop and mobile, while agent launch can now change settings on a remote host. A remote settings-read failure could cause existing settings to be replaced, although the write is limited to configured Kiro launches.

Retained concerns

  • Medium · reliability · inferred: A failed stat of an existing remote Kiro settings file is treated as file absence. If the later write succeeds, launch preflight can replace the user's other settings with a document containing only the terminal-title setting. This is a conditional configuration-integrity failure, not an established unauthorized access path.
Security review details

Security Blast Radius

  • inferred — The identified configuration-integrity risk is scoped to the Kiro settings of an execution host reached through an existing Kiro launch path. The inspected path does not establish independent unauthenticated reachability or exposure of other hosts.

Security Findings and Attack Paths

  • inferred — A stat error for an existing remote settings file can be mistaken for absence, bypassing inspection of that file before a whole-document write. Whether this changes a security-sensitive Kiro preference depends on the file's contents; no attacker-controlled trigger or credential exposure was established.

Trust Boundaries and Controls

  • observed — The local path delegates its setting change to Kiro CLI, whereas the remote path writes the SSH user's settings directly. Both respect an existing terminal-title property when it can be read, and remote preflight requires a resolved home and provider.

Resilience and Maintainability Implications

  • inferred — The remote read and full-document write are separate operations, with no serialization or recovery visible in the inspected helper. Concurrent settings changes or an interrupted write remain unresolved risks because the remote write contract was not established.

Hardening Proposals

  • proposed — Treat only a confirmed not-found result as an absent remote settings file; fail without writing on other stat errors. Establish the remote provider's atomic-write and concurrent-update guarantees before relying on whole-document replacement.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.03% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 71 functions across 66 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 summarizes the primary change: adding Kiro account usage tracking and status-bar integration.
Description check ✅ Passed The description covers all required sections, including user impact, implementation details, rationale, linked issues, visual proof, testing, AI disclosure, review notes, compatibility considerations,…
  • Fix all pre-merge checks with AI

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: 6


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 8fa0f45b-972c-466c-b152-dbf618e367a1

📥 Commits

Reviewing files that changed from the base of the PR and between aedb930 and f5e467f.

📒 Files selected for processing (79)
  • .gitignore
  • mobile/app/h/[hostId]/accounts.tsx
  • mobile/src/accounts-route-reset-credit.test.ts
  • mobile/src/components/AccountUsage.tsx
  • mobile/src/components/MobileKiroUsageSection.tsx
  • mobile/src/components/account-usage-state.test.ts
  • mobile/src/components/account-usage-state.ts
  • mobile/src/components/accounts-snapshot.test.ts
  • mobile/src/components/accounts-snapshot.ts
  • scripts/dev-local.sh
  • src/main/ipc/kiro-usage.test.ts
  • src/main/ipc/kiro-usage.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.ts
  • src/main/kiro-usage/kiro-usage-background-refresh.test.ts
  • src/main/kiro-usage/kiro-usage-background-refresh.ts
  • src/main/kiro-usage/kiro-usage-fetcher.test.ts
  • src/main/kiro-usage/kiro-usage-fetcher.ts
  • src/main/kiro-usage/kiro-usage-parser.test.ts
  • src/main/kiro-usage/kiro-usage-parser.ts
  • src/main/kiro-usage/kiro-usage-refresh-registry.ts
  • src/main/kiro-usage/kiro-usage-to-rate-limits.test.ts
  • src/main/kiro-usage/kiro-usage-to-rate-limits.ts
  • src/main/kiro/kiro-terminal-title-setting.test.ts
  • src/main/kiro/kiro-terminal-title-setting.ts
  • src/main/rate-limits/service/service-configuration.ts
  • src/main/rate-limits/service/service-state.ts
  • src/main/rate-limits/service/service-types.ts
  • src/main/runtime/orca-runtime-activate-managed-worktree.ts
  • src/main/runtime/runtime-account-controller.ts
  • src/main/runtime/runtime-worktree-agent-startup.ts
  • src/preload/api-types.ts
  • src/preload/api/kiro-usage-api.ts
  • src/preload/api/kiro-usage-bridge.ts
  • src/preload/index.ts
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/settings/KiroAccountsSection.tsx
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-kiro-row.test.ts
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
  • src/renderer/src/components/status-bar/StatusBarVisibilityMenu.tsx
  • src/renderer/src/components/status-bar/provider-segment-monthly-window.test.tsx
  • src/renderer/src/components/status-bar/reset-credit-indicator.test.ts
  • src/renderer/src/components/status-bar/reset-credit-indicator.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
  • src/renderer/src/components/status-bar/status-bar-provider-visibility.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.ts
  • src/renderer/src/components/status-bar/use-status-bar-controller.ts
  • src/renderer/src/store/index.ts
  • src/renderer/src/store/slices/kiro-usage.test.ts
  • src/renderer/src/store/slices/kiro-usage.ts
  • src/renderer/src/store/slices/rate-limits.test.ts
  • src/renderer/src/store/slices/store-test-helpers.ts
  • src/renderer/src/store/types.ts
  • src/shared/agent-row-conversation-name.ts
  • src/shared/agent-session-option-catalog-kiro.test.ts
  • src/shared/agent-session-option-catalog-kiro.ts
  • src/shared/agent-session-option-catalog.ts
  • src/shared/agent-title-evidence.ts
  • src/shared/agent-title-identity.ts
  • src/shared/agent-title-status.ts
  • src/shared/kiro-cli-engine.test.ts
  • src/shared/kiro-cli-engine.ts
  • src/shared/kiro-row-conversation-name.test.ts
  • src/shared/kiro-terminal-title.test.ts
  • src/shared/kiro-terminal-title.ts
  • src/shared/kiro-usage-reconcile.test.ts
  • src/shared/kiro-usage-reconcile.ts
  • src/shared/kiro-usage-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/terminal-title-agent-type.ts
  • src/shared/tui-agent-config.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/shared/agent-title-evidence.ts Resolved
Comment thread src/shared/kiro-terminal-title.ts Resolved

@pullfrog pullfrog 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.

Important

The new kiro-usage status-bar item is added to the shared defaults but not to the one-shot hydration migration, so existing users never receive it by default. Two smaller items are inline.

Reviewed changes

  • Kiro usage pipeline (src/main/kiro-usage/*, src/shared/kiro-usage-*): runs kiro-cli chat --agent-engine v2 --no-interactive /usage, parses the monthly plan meter, retries transient failures, reconciles stale reads, and converts to a monthly ProviderRateLimits.
  • State and plumbing: RateLimitState.kiro, setKiroUsage/getKiroUsage, exclusion of kiro from the actively-polled provider set, and the desktop IPC / phone RPC refresh lanes.
  • Surfaces: kiro-usage status-bar item plus visibility menu and roster segment, KiroAccountsSection in Settings, and the mobile usage section with snapshot schema additions.
  • Kiro identity: kiro: title detection, the vendor chat.terminalTitle pre-launch write, and the Kiro agent-session option catalog (models, engine, effort).
  • Bundled, unrelated: an inline Codex reset-credit badge and a committed scripts/dev-local.sh.

⚠️ kiro-usage is default-on for new profiles only, not existing users

'kiro-usage' was appended to DEFAULT_STATUS_BAR_ITEMS, but the one-shot hydration migration that delivers newly default-on items to existing users was not extended. Because migrateStatusBarItems only falls back to DEFAULT_STATUS_BAR_ITEMS when statusBarItems is undefined, a user who has ever persisted UI state will not get the Kiro segment by default — they must enable it manually, which contradicts the default-on intent and diverges from how grok/cursor/zcode were shipped.

Technical details
# Missing `_kiroStatusBarDefaultAdded` migration

## Affected sites
- `src/shared/status-bar-defaults.ts:17` — adds `'kiro-usage'` to `DEFAULT_STATUS_BAR_ITEMS`; only consulted when no persisted `statusBarItems` exists.
- `src/renderer/src/store/slices/ui/ui-slice-hydration-status-bar-items.ts:5-28` — `DEFAULT_ON_*` constants and the `defaults` loop that appends each item once its flag is stamped; has no Kiro entry.
- `src/shared/persisted-ui-state-types.ts:111-124` — declares `_ports/_kimi/_minimax/_antigravity/_grok/_cursor/_zcodeStatusBarDefaultAdded`; no `_kiroStatusBarDefaultAdded`.
- `src/shared/rpc-contract/client-ui-params.ts:182-189` — the paired `UiUpdateFields` mirror of those flags; also missing the Kiro flag.

## Required outcome
An existing user with a persisted `statusBarItems` array should receive `kiro-usage` exactly once, the same way grok/cursor/zcode do, without clobbering a user who later toggles it off.

## Suggested approach
Mirror the zcode/cursor/grok pattern in all four sites: a `DEFAULT_ON_KIRO_STATUS_BAR_ITEM` constant and `defaults` entry in `ui-slice-hydration-status-bar-items.ts`, the `_kiroStatusBarDefaultAdded?: boolean` field in `persisted-ui-state-types.ts`, and the matching optional flag in `client-ui-params.ts`.

## Open questions for the human
If keeping the segment opt-in for existing users is deliberate, then dropping it from `DEFAULT_STATUS_BAR_ITEMS` would make that intent consistent; as written the two disagree.

ℹ️ Nitpicks

  • This PR bundles an unrelated Codex reset-credit status-bar badge (reset-credit-indicator.ts, ResetCreditBadge, its tests) and a machine-specific scripts/dev-local.sh into an already large Kiro change. Splitting these would make the Kiro feature easier to review and revert independently.
  • getProviderLetter returns 'Ki' (two characters) for Kiro while every other provider is one; fine if the compact badge is sized for it, but worth a visual check.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@JuanmanDev

Copy link
Copy Markdown
Author
image image image

Resolves the CodeRabbit and Pullfrog findings on stablyai#23650.

Correctness:
- Clamp the parsed `/usage` percentage to 0-100 and read it only from the
  meter that follows the credits line, and only when it agrees with
  used/limit. An over-plan quota previously made the mobile accounts
  snapshot reject every provider, and a stray `%` in the combined
  stdout/stderr blob could be mistaken for the plan meter.
- Emit `--effort` only when the user picks a level. The catalog default now
  sends no flag, so Kiro's own saved `chat.modelDefaults` effort stands.
- Do not read a native title envelope's session text as a second owner
  claim: `kiro: fix the pager - codex` resolved to a conflict instead of
  Kiro.
- Reject a decorated wrapper segment in the Kiro title regex, so a Claude
  task title such as `✳ Review | kiro: usage` is no longer classified as a
  Kiro pane.

Launch preflight:
- Write `chat.terminalTitle` through `kiro-cli settings` instead of
  rewriting the whole settings file, which could erase a model or effort
  change another Kiro session persisted in between.
- Add the SSH-host half of the preflight. Kiro runs on the execution host,
  so a local-only write left remote panes without their identity signal.
  Remote home resolution moves to `src/main/ssh/remote-agent-home.ts` and is
  shared with the remote trust presets.

Surfaces:
- Deliver the default-on `kiro-usage` status-bar item to existing users via
  the one-shot hydration migration, not just to fresh profiles.
- Gate the Kiro accounts section behind the settings search like every other
  provider, and give it search entries so "kiro" finds it.

Housekeeping:
- Drop the machine-specific `scripts/dev-local.sh`.
- Clear the changed-code quality gate: SAFETY rationale on the remaining
  casts, no restyles of `Button`/`Badge`, and no duplicate test imports.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 5d7aa09c-c7a1-4f03-9749-04d6e37d0a2d

📥 Commits

Reviewing files that changed from the base of the PR and between f5e467f and 8a41f3b.

📒 Files selected for processing (31)
  • mobile/src/components/account-usage-state.test.ts
  • mobile/src/components/accounts-snapshot.test.ts
  • src/main/ipc/kiro-usage.test.ts
  • src/main/kiro-usage/kiro-usage-parser.test.ts
  • src/main/kiro-usage/kiro-usage-parser.ts
  • src/main/kiro-usage/kiro-usage-refresh-registry.ts
  • src/main/kiro/kiro-remote-terminal-title-setting.test.ts
  • src/main/kiro/kiro-remote-terminal-title-setting.ts
  • src/main/kiro/kiro-terminal-title-setting.test.ts
  • src/main/kiro/kiro-terminal-title-setting.ts
  • src/main/remote-agent-trust-presets.ts
  • src/main/runtime/orca-runtime-activate-managed-worktree.ts
  • src/main/runtime/runtime-worktree-agent-startup.ts
  • src/main/ssh/remote-agent-home.ts
  • src/preload/api/kiro-usage-bridge.ts
  • src/renderer/src/components/settings/AccountsPane.tsx
  • src/renderer/src/components/settings/KiroAccountsSection.tsx
  • src/renderer/src/components/settings/accounts-search.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-kiro-row.test.ts
  • src/renderer/src/components/status-bar/reset-credit-indicator.test.ts
  • src/renderer/src/store/slices/kiro-usage.test.ts
  • src/renderer/src/store/slices/kiro-usage.ts
  • 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/agent-session-option-catalog-kiro.test.ts
  • src/shared/agent-session-option-catalog-kiro.ts
  • src/shared/agent-title-evidence.ts
  • src/shared/kiro-terminal-title.test.ts
  • src/shared/kiro-terminal-title.ts
  • src/shared/persisted-ui-state-types.ts
  • src/shared/rpc-contract/client-ui-params.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/preload/api/kiro-usage-bridge.ts
  • src/main/kiro-usage/kiro-usage-refresh-registry.ts
  • src/renderer/src/store/slices/kiro-usage.ts
  • src/renderer/src/components/status-bar/reset-credit-indicator.test.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-kiro-row.test.ts
  • src/main/ipc/kiro-usage.test.ts
  • src/shared/kiro-terminal-title.test.ts
  • src/shared/agent-session-option-catalog-kiro.test.ts
  • src/renderer/src/components/settings/KiroAccountsSection.tsx
  • src/shared/kiro-terminal-title.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 on lines +63 to +65
} catch {
return ''
}

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not treat every remote stat error as a missing file.

If stat fails transiently for an existing cli.json, this helper returns an empty document. If the later write succeeds, Line 48 replaces the user’s other Kiro settings. Return the missing-file result only for a confirmed not-found error; fail without writing for other errors.

export async function enableKiroTerminalTitle(
options: EnableKiroTerminalTitleOptions = {}
): Promise<KiroTerminalTitleResult> {
const settings = readKiroSettings(options.settingsPath ?? getKiroCliSettingsPath())

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- diff stat ---'
git diff --stat aedb9305cd1b3de859b5eafc1ee0d77fa0df8963 8a41f3bba434fb3a4eb4e040389836e525e89f6a -- src/main/kiro
printf '%s\n' '--- target file outlines ---'
ast-grep outline src/main/kiro/kiro-terminal-title-setting.ts
ast-grep outline src/main/kiro/kiro-remote-terminal-title-setting.ts
printf '%s\n' '--- local helper ---'
cat -n src/main/kiro/kiro-terminal-title-setting.ts
printf '%s\n' '--- remote helper ---'
cat -n src/main/kiro/kiro-remote-terminal-title-setting.ts
printf '%s\n' '--- direct references and environment/path bindings ---'
rg -n -C 3 'enableKiroTerminalTitle|getKiroCliSettingsPath|KIRO_HOME|kiro-cli settings|remoteHome|run.*kiro|spawn.*kiro|exec.*kiro' src/main src --glob '!**/node_modules/**'
printf '%s\n' '--- changed hunks ---'
git diff --unified=30 aedb9305cd1b3de859b5eafc1ee0d77fa0df8963 8a41f3bba434fb3a4eb4e040389836e525e89f6a -- src/main/kiro/kiro-terminal-title-setting.ts src/main/kiro/kiro-remote-terminal-title-setting.ts

Repository: stablyai/orca

Length of output: 45649


🤖 get_repo_knowledge executed:

get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions

Length of output: 44350


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- all direct callers ---'
rg -n -C 8 'enableRemoteKiroTerminalTitle|enableKiroTerminalTitle' src --glob '*.ts' --glob '*.tsx'
printf '%s\n' '--- Kiro launch and environment references ---'
rg -n -C 5 'kiro|KIRO_HOME|kiro-cli' src/main src/shared --glob '*.ts' --glob '*.tsx' | rg -i -C 5 'kiro|KIRO_HOME|terminal.title|terminalTitle|environment|env|spawn|command|launch'
printf '%s\n' '--- startup context ---'
sed -n '150,215p' src/main/runtime/runtime-worktree-agent-startup.ts
printf '%s\n' '--- process runner contract ---'
cat -n src/shared/child-process/run-process.ts
printf '%s\n' '--- exact symbols in prior full log ---'
rg -n -C 10 'enableRemoteKiroTerminalTitle|enableKiroTerminalTitle|KIRO_HOME|runtime-worktree-agent-startup' /tmp/coderabbit-shell-logs/shell-output-dkkakt || true

Repository: stablyai/orca

Length of output: 42448


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- runProcess implementation ---'
cat -n src/shared/child-process/run-process.ts
printf '%s\n' '--- Kiro configuration and launch bindings ---'
rg -n -C 8 'kiro-terminal-title|kiro-cli|TUI_AGENT_CONFIG|launchPlatform|command.*kiro|kiro.*command|env:' src/shared src/main --glob '*.ts' --glob '*.tsx' | head -n 1200
printf '%s\n' '--- process option construction ---'
rg -n -C 6 'runProcess\\(|spawn\\(|execFile\\(|shell:|env:' src/main src/shared --glob '*.ts' --glob '*.tsx' | rg -C 4 'agent|launch|kiro|runProcess|spawn|execFile|env'

Repository: stablyai/orca

Length of output: 41432


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- process spec ---'
cat -n src/shared/child-process/process-spec.ts
printf '%s\n' '--- spawn resolution ---'
cat -n src/shared/child-process/spawn-resolution.ts
printf '%s\n' '--- locate TUI config and startup definitions ---'
rg -n 'export const TUI_AGENT_CONFIG|kiro:|kiro-cli|function buildAgentStartupPlan|export function buildAgentStartupPlan' src/shared --glob '*.ts'
printf '%s\n' '--- TUI config ---'
cat -n src/shared/tui-agent-config.ts
printf '%s\n' '--- startup implementation ---'
rg -n -C 12 'buildAgentStartupPlan|launchCommand|TUI_AGENT_CONFIG\[agent\]' src/shared/tui-agent-startup.ts src/main --glob '*.ts' | head -n 1000

Repository: stablyai/orca

Length of output: 42237


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- remote home resolution ---'
rg -n -C 12 'export async function resolveRemoteAgentHome|function resolveRemoteAgentHome|resolveRemoteAgentHome' src/main/ssh src/main --glob '*.ts'
printf '%s\n' '--- remote terminal launch bindings ---'
rg -n -C 8 'startup\\.command|launchConfig|startupCommandDelivery|create.*Terminal|pty|shell' src/main/runtime src/main/ssh src/main/terminal src/shared --glob '*.ts' | head -n 1600

Repository: stablyai/orca

Length of output: 42356


🌐 Web query:

site:kiro.dev/docs/cli/reference/settings KIRO_HOME cli.json settings directory

💡 Result:

Kiro CLI stores settings in `~/.kiro/settings/cli.json`. Setting `KIRO_HOME` overrides the `~/.kiro` base directory, so the settings file becomes `$KIRO_HOME/settings/cli.json`. ([kiro.dev](https://kiro.dev/docs/cli/reference/settings/?utm_source=openai))

Citations:

- 1: https://kiro.dev/docs/cli/reference/settings/?utm_source=openai

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- launch payload definitions ---'
rg -n -C 8 'type WorktreeStartupLaunch|interface WorktreeStartupLaunch|WorktreeStartupLaunch|startupCommandDelivery|launchConfig' src --glob '*.ts' --glob '*.tsx' | head -n 1800
printf '%s\n' '--- environment construction around terminal creation ---'
rg -n -C 10 'env:.*startup|startup.*env|spawn.*env|processEnv|environment:' src/main src/renderer src/shared --glob '*.ts' --glob '*.tsx' | head -n 1800

Repository: stablyai/orca

Length of output: 45660


Use the effective KIRO_HOME for the local settings preflight.

When KIRO_HOME is set, Kiro reads $KIRO_HOME/settings/cli.json. The current helper reads homedir()/.kiro/settings/cli.json, while kiro-cli settings inherits the process environment. The preflight can therefore enable the wrong profile or ignore an explicit false.

Suggested fix
 export function getKiroCliSettingsPath(): string {
-  return join(homedir(), '.kiro', 'settings', 'cli.json')
+  return join(process.env.KIRO_HOME || join(homedir(), '.kiro'), 'settings', 'cli.json')
 }
📍 Affects 2 files
  • src/main/kiro/kiro-terminal-title-setting.ts#L64-L64 (this comment)
  • src/main/kiro/kiro-remote-terminal-title-setting.ts#L21-L22

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

Re-reviewed the fix commit 8a41f3bba4 on top of the prior review at f5e467f8c5; it addresses every prior Pullfrog and CodeRabbit finding and introduces no new behavioral issues.

  • Usage percentage hardened (kiro-usage-parser.ts): the % is read only from the meter after the credits line and trusted only when it agrees with used/limit; the result is clamped to 0–100, so an over-plan quota can no longer invalidate the mobile accounts snapshot.
  • Reasoning effort left to the CLI (agent-session-option-catalog-kiro.ts): the default is now a CLI default choice that emits no --effort, preserving a saved chat.modelDefaults level.
  • Title identity tightened (kiro-terminal-title.ts, agent-title-evidence.ts): a decorated wrapper segment (status glyph, or Claude's . /* ) no longer mints a Kiro identity, and a native envelope's session text is no longer read as a second owner claim.
  • Terminal-title preflight on the execution host (kiro-remote-terminal-title-setting.ts, remote-agent-home.ts, runtime-worktree-agent-startup.ts): the local write goes through kiro-cli settings (single key, no whole-file clobber) and the SSH path gets its own filesystem-provider write; remote home resolution is shared with the trust presets.
  • Default-on migration and settings search (ui-slice-hydration-status-bar-items.ts, persisted-ui-state-types.ts, client-ui-params.ts, AccountsPane.tsx, accounts-search.ts): existing users receive kiro-usage once via the one-shot hydration flag, and the Kiro section is now gated and indexed by the settings search.
  • Housekeeping: scripts/dev-local.sh removed; test import/type cleanups.

ℹ️ Nitpicks

  • applyLocalAgentLaunchPreflight / applyRemoteAgentLaunchPreflight have no test that exercises the gate and the writer call together (the writers themselves are unit-tested). Defer-able.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

This branch has not been deployed

No deployments
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.

[Feature]: Kiro subscription [Bug]: The status of Kiro CLIs has not yet been determined.

1 participant