Skip to content

fix: Kiro polls spend credits and time out on the v3 engine (/usage is sent to the model) #520

Closed

Description

@gus-bn

Bug Description

With chat.agentEngine set to v3, the Kiro card shows "Couldn't read usage — no response", and every poll spends real Kiro credits.

KiroCLI.arguments is ["chat", "--no-interactive", "/usage"]. On the v3 engine, /usage is not handled as a local slash command in non-interactive mode. It is sent to the model as a prompt. The agent then tries to work out what /usage means (subagents, web fetches, file reads) until Codenotch's 20s timeout kills it, so the UI never gets a card.

Measured on one Mac over 7 days, from usage_summary entries in Kiro's session files:

  • 1,381 agent sessions with cwd $TMPDIR (Codenotch's working directory)
  • 807 credits in total, about 0.58 per poll
  • Polls ran on the configured default model, here Opus 5 at high effort in autopilot
  • Almost all ended aborted; the partial turns were still billed

This is separate from #220 (stderr capture) and #367 (Windows report). PR #517 does not change the arguments, so it won't fix this.

Steps to Reproduce

Each hanging run spends credits.

  1. Install kiro-cli 2.37.1 and run kiro-cli settings chat.agentEngine v3.
  2. Run Codenotch's exact call:
cd "$TMPDIR"
TERM=dumb KIRO_CHAT_UI=classic kiro-cli chat --no-interactive /usage < /dev/null

Result: no card, the model starts working, and the process does not exit by itself within 90s.

Same call with the engine pinned: exit 0 in 2-4s, card on stdout:

TERM=dumb KIRO_CHAT_UI=classic kiro-cli chat --agent-engine v2 --no-interactive /usage < /dev/null
Estimated Usage | resets on <date> | <PLAN>
Credits (<used> of <total> covered in plan), <n>%
Overages: Disabled

Expected Behavior

Reading usage shows the card and never starts a billed model turn, whichever engine is the user's default.

Affected Provider (if applicable)

Kiro

Environment & macOS Version

macOS 27.0.1, kiro-cli 2.37.1 (KAS 0.66.70)

Codenotch Version

1.24.0

Relevant Logs (Unified Log)

kiro-cli stderr during a poll, on v3:

[INFO] kas.server.starting {"product":"KAS (Kiro Agent Server)","version":"0.66.70"}
[INFO] [KRS] <-- GenerateAssistantResponseCommand done totalEvents=9
[tool] Inspect workspace layout and cost data files
[denied] tool permission approval is not supported in non-interactive mode. Use --trust-all-tools to auto-approve.

Additional Context

Suggested fix

  1. Short term: add --agent-engine v2 to KiroCLI.arguments. I tested this flag from the command line; the Swift change itself is untested. --v2 also works, but placed before chat.
  2. Longer term: stop depending on /usage through chat. kiro-cli's own strings say Classic is being deprecated with the 3.0 release, so the v2 pin may not last, and if v3 becomes the default this hits every Kiro user. GetUsageLimits is already called for enrichment in KiroProvider.enrich() and could become the primary source, with no model involved.

What did not work as a user-side override

  • KIRO_AGENT_ENGINE=v2 in the environment: still ran v3 and hung.
  • kiro-cli settings --workspace chat.agentEngine v2: rejected with "Setting 'chat.agentEngine' cannot be overridden at workspace level".

Workaround without changing the global engine

Point KIRO_CLI_PATH at a wrapper script that adds --agent-engine v2 to this one call. To stop the spend immediately, disable the Kiro provider.

Related: orphaned processes after a timeout

acp-server.js runs in its own process group, so killpg on the kiro-cli pid does not reach it. After each timed-out poll it was reparented to PID 1 and stayed around for several minutes. With a poll every 30s, I saw 3-5 at once, 20-200 MB each.

Separately, quitting Codenotch mid-poll leaves the child running with no timeout. One such v3 poll ran about 60s and cost 2.51 credits before it ended.

Activity

  1. added 2 commits that reference this issue on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions