Skip to content

fix(cli): skip startup work for informational commands - #12659

Open
mjnaderi wants to merge 2 commits into
Kilo-Org:mainfrom
mjnaderi:fix/cli-startup-performance
Open

fix(cli): skip startup work for informational commands#12659
mjnaderi wants to merge 2 commits into
Kilo-Org:mainfrom
mjnaderi:fix/cli-startup-performance

Conversation

@mjnaderi

Copy link
Copy Markdown
Contributor

Issue

No linked issue. This addresses CLI startup latency and unnecessary network requests from informational commands.

Context

Commands such as kilo --help and kilo --version do not require configuration, authentication, telemetry, or shutdown lifecycle work. Running that lifecycle added latency and could contact the Kilo API and telemetry endpoint.

Additionally, disabling telemetry did not prevent updateIdentity() from requesting the authenticated Kilo profile.

Implementation

Skip Kilo-specific bootstrap and shutdown work when help or version flags are present. Arguments after -- are excluded from detection so commands such as kilo run -- --help retain their normal behavior.

Return immediately from Telemetry.updateIdentity() when telemetry is disabled, avoiding the profile request and reducing startup time (for all commands) when telemetry is disabled.

This intentionally leaves broader startup and code-splitting changes out of scope.

Screenshots / Video

N/A — no visual changes.

How to Test

Manual/local verification

Executed by the agent:

  • Ran the telemetry package tests: 17 passed.
  • Ran the focused CLI lifecycle tests: 4 passed.
  • Ran typechecks for the CLI and telemetry packages.
  • Built the release CLI and smoke-tested --help and --version.
  • Traced the built commands with strace; neither command made a connect(2) call.
  • The pre-push hook successfully typechecked all packages, including the JetBrains plugin.

Reviewer test steps

  1. Run bun test ./test/kilocode/cli-shutdown.test.ts from packages/opencode.
  2. Run bun test from packages/kilo-telemetry.
  3. Build the CLI from packages/opencode:
    bun run script/build.ts --single --skip-install
  4. Run the resulting binary with --help and --version.
  5. Optionally trace both commands with strace -f -e trace=connect and confirm there are no connection attempts.

Blocked checks and substitute verification

None.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

Comment thread packages/opencode/src/kilocode/cli/setup.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The previous WARNING (raw process.argv scan in informational() misfiring on flag-as-value) is resolved: KiloCli.bootstrap now receives yargs' parsed opts and derives the help/version decision from opts.help === true || opts.version === true, which correctly distinguishes real --help/--version usage from the same strings passed as values to other options. The decision is cached in a module-level info flag for shutdown() to reuse, which is safe for this single CLI invocation lifecycle. Tests were updated to exercise the new parsed-flag input shape.

Files Reviewed (3 files)
  • packages/opencode/src/index.ts
  • packages/opencode/src/kilocode/cli/setup.ts
  • packages/opencode/test/kilocode/cli-shutdown.test.ts
Previous Review Summary (commit 39f65ef)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 39f65ef)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/cli/setup.ts 53 informational() scans raw process.argv and can misfire when -h/-v/--help/--version appear as a value for another option, silently skipping bootstrap/shutdown lifecycle work for a real command.
Files Reviewed (5 files)
  • .changeset/faster-cli-startup.md
  • packages/kilo-telemetry/src/telemetry.ts
  • packages/kilo-telemetry/src/__tests__/telemetry.test.ts
  • packages/opencode/src/kilocode/cli/setup.ts - 1 issue
  • packages/opencode/test/kilocode/cli-shutdown.test.ts

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5 · Input: 30 · Output: 6.6K · Cached: 641K

Review guidance: REVIEW.md from base branch main

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.

1 participant