Commit Graph
8631 Commits
Author SHA1 Message Date
Marius f336cfee0a Merge pull request #12588 from Kilo-Org/fix/provider-first-byte-timeout
fix(cli): prevent agent-loop freeze when a provider stalls after headers
2026-07-28 11:00:52 +02:00
marius-kilocode deddf0012f fix(cli): bound provider first response byte by the request timeout
A provider can accept a request, return response headers, and then never
send a byte of body data. The connection-phase request timeout was cleared
as soon as headers arrived, so nothing bounded that wait and the agent turn
hung indefinitely after a tool call completed: step-finish:tool-calls was
recorded and the next step-start never arrived, with the HTTP server still
responsive.

Extend the same configured timeout deadline to the wait for the response
body's first byte. The connection-phase timer covers the fetch up to
headers; once headers arrive, the remaining deadline is handed to a
first-byte guard that aborts the request if no data arrives. After the
first byte the guard becomes a passthrough, so idle gaps inside an already
streaming response (reasoning, buffering, slow token generation) are never
touched and remain opt-in via chunkTimeout.

This is a transport-level signal (bytes on the wire, before any content)
rather than the absence of normalized AI SDK events, so it cannot fire on
long prompt processing or reasoning the way the reverted stream watchdog
did. timeout: false still disables the bound entirely.

Adds a hermetic regression test that injects a simulated stalled socket
through the provider's own fetch option via the plugin config hook, so the
SDK, Kilo's fetch wrapper, SSE parsing, the processor and the agent loop
all stay production code. The stalled request is transient, so the test
asserts the turn recovers by retrying and completing instead of freezing.
The test goes red without the fix (no retry, frozen at step-finish) and
green with it.

Refs #8656
2026-07-28 10:35:56 +02:00
Marius a0a760e00e fix(cli): enforce permissions on shell commands the parser fails to scan (#12585)
* fix(cli): enforce permissions on shell commands the parser fails to scan

* fix(cli): fail closed on error chunks without command names, move pwsh execution test to kilo file
2026-07-28 09:50:32 +02:00
Josh HolmerandJohnny Eric Amancio c12a567f2a test(cli): cover TUI startup outside package (#12417)
* test(cli): cover TUI startup outside package

* fix(cli): use native preload path in TUI test

---------

Co-authored-by: Johnny Eric Amancio <johnnyeric@gmail.com>
2026-07-27 15:14:31 +02:00
Igor Šćekić b2735bfbc9 fix(cli): flush the session ingest tail on shutdown (#12545)
* fix(cli): drain session ingest queue on shutdown and flush terminal batches promptly

* fix(cli): drain the session ingest queue on process shutdown

* fix(cli): pin drain bound expiry, add changeset, conform to naming rule

* fix(cli): keep kilo-sessions out of the CLI startup import graph

* fix(cli): never let the ingest drain task reject the shutdown sequence

* test(cli): pin drain-before-dispose ordering on the KiloCli shutdown path

* fix(cli): make the guarded ingest drain non-rejecting and correct the lazy-import rationale

* test(cli): cover the retryable-status drain path under shutdown

* test(cli): decouple cli-shutdown drain assertions from declaration order
2026-07-27 11:12:42 +02:00
Christiaan Arnoldus 614c21ee81 Merge pull request #12544 from Kilo-Org/fix/opus-5-adaptive-thinking
fix(cli): support adaptive thinking for Claude 5+
2026-07-27 10:16:23 +02:00
Marius 17cc581129 Merge pull request #12514 from Kilo-Org/fix-cli-subprocess-timeouts
fix(cli): stabilize cross-platform subprocess tests
2026-07-27 09:16:28 +02:00
chrarnoldusandkiloconnect[bot] 8aeff4856f fix(cli): cover future sonnet adaptive versions
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
2026-07-26 20:50:52 +00:00
chrarnoldusandkiloconnect[bot] a69a7cc5c4 fix(cli): cover future opus adaptive versions
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
2026-07-26 20:03:01 +00:00
chrarnoldusandkiloconnect[bot] b8d83fb537 fix(cli): support adaptive thinking for opus 5
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
2026-07-26 19:36:51 +00:00
Igor Šćekić a19d44c3ef Advertise the instance from enableRemote and report attention status on the heartbeat (#12532)
* fix(cli): advertise the instance from enableRemote so /remote registers as a spawn target

Enabling the remote relay from the TUI `/remote` slash command connected the
socket and mirrored sessions, but never advertised the instance, so the CLI
never appeared as a spawn target in the mobile "Run on" picker. Only the
explicit `kilo remote` command called setInstanceAdvertisement.

The advertisement now runs on every successful enableRemote() entry, before the
already-connected and coalescing early returns. That ordering matters: bootstrap
auto-enable frequently connects first, so `/remote` usually hits
`if (remote) return` and an advertisement placed in the connection-setup body
would leave the defect unfixed in the common case. `ingestDisabled` returns
before the advertisement and stays unadvertised.

The ensure helper is a no-op when an advertisement is already set, so it fires no
extra heartbeat, while explicit setInstanceAdvertisement keeps its existing
replace semantics. buildInstanceAdvertisement moves to a shared module so the
command path and the enable path derive it identically.

* fix(cli): report pending question and permission on the session heartbeat

The heartbeat built each session's status from SessionStatus.Service, whose
union is idle/retry/busy/offline and which never consults Question.Service or
Permission.Service. deriveStatus() already did consult both, but only fed the
ingest session_status sync. So a session genuinely blocked on a question was
advertised as busy on the heartbeat, and the mobile app — which takes live row
status from the heartbeat — showed no needs-input badge.

Extract the precedence (permission, then question, then SessionStatus) into a
shared helper used by both deriveStatus and the heartbeat, so the two channels
cannot drift.

The heartbeat runs on a ~10s timer across every session, and deriveStatus makes
service calls per session, so the permission and question lists are fetched once
per tick and indexed by session id rather than queried per session. A test pins
the call count.

Behaviour note beyond the strict fix: sharing the derivation also means a
SessionStatus of offline now reports as retry on the wire, matching what
deriveStatus has always sent to ingest. Nothing consumes offline from the
heartbeat — the transport forwards only idle and busy, and the mobile row treats
both as non-attention — so the effect is that the two channels now agree. The
detach fence test is parameterised accordingly; its assertion that the status
clears on detach is unchanged.

* chore(cli): widen the promise-facade allowlist for the heartbeat attention tests

The DEF-3 heartbeat tests raise and reply to real Question and Permission
requests through the global AppRuntime, which took kilo-sessions.test.ts from 4
classified references to 29 and failed the allowlist check.

Bumping the count rather than restructuring the tests is deliberate: the
heartbeat resolves attention status from the global Question.Service and
Permission.Service, so asserting it requires driving those same services.
Scoped layers cannot express that — the global-runtime coupling is the thing
under test — and it is the same integration pattern this entry already
sanctioned for the detach fence. The reason string records that.
2026-07-25 15:45:43 +02:00
Joshua Lambert eab61d853a Merge pull request #12505 from Kilo-Org/fix/run-duplicate-events
fix(cli): emit run events once
2026-07-24 19:48:51 -04:00
Marius 85a5ebf3e7 Merge branch 'main' into fix-cli-subprocess-timeouts 2026-07-24 18:55:11 +02:00
kilo-maintainer[bot] f80ebff83b release: v7.4.16 2026-07-24 15:55:31 +00:00
marius-kilocode c4aebfe305 fix(cli): tolerate process signal failures in test runner 2026-07-24 17:06:49 +02:00
LCZcn96 c72817e67f fix(cli): bound skill discovery in non-git projects (#12475) 2026-07-24 16:31:31 +02:00
marius-kilocode 14934c736b fix(cli): resolve OpenTUI links across install layouts 2026-07-24 15:21:11 +02:00
marius-kilocode f3a4003356 fix(cli): resolve bundled OpenTUI native modules 2026-07-24 15:09:23 +02:00
Bruno Agatao 9c16457083 Merge remote-tracking branch 'origin/main' into feat/explain-tool-auto-approval 2026-07-24 14:27:39 +02:00
marius-kilocode a33493e722 fix(cli): stabilize cross-platform subprocess tests 2026-07-24 14:23:03 +02:00
Marius 470d78bfac Merge branch 'main' into fix/preserve-other-finish-reason 2026-07-24 14:02:52 +02:00
Johnny Eric Amancio 0fe46ecb8d fix: recover from read-only database files at startup (#12508) 2026-07-24 12:51:05 +02:00
marius-kilocode 40fd27d22a fix(cli): validate persisted Vercel request IDs 2026-07-24 12:42:15 +02:00
Bruno Agatao 0eb9face86 Merge remote-tracking branch 'origin/main' into feat/explain-tool-auto-approval 2026-07-24 12:35:42 +02:00
Bruno Agatao b36b24e827 fix(cli): track auto-approval provenance per permission pattern, not per key 2026-07-24 12:32:33 +02:00
marius-kilocode 9ecdfdc19e fix(vscode): persist both response identifiers 2026-07-24 12:27:54 +02:00
marius-kilocode d29f1bdd43 fix(vscode): show both response identifiers 2026-07-24 12:21:21 +02:00
marius-kilocode 2fcb137ebc fix: preserve unexpected provider finish reasons 2026-07-24 12:20:43 +02:00
Marius e6f4216088 Merge pull request #12497 from Kilo-Org/revert/stream-stall-watchdog
revert(cli): restore opt-in stream idle timeouts
2026-07-24 12:13:37 +02:00
Bruno Agatao 7f37d015ed fix(cli): tag permission rules by origin so auto-approval provenance is accurate 2026-07-24 12:12:58 +02:00
Christiaan Arnoldus a4177125b8 Merge pull request #12485 from rakshith1928/fix/12477-compaction-maxoutputtokens-leak
fix(core): strict OpenAI-compatible compaction failure caused by maxOutputTokens leak into provider options
2026-07-24 11:13:50 +02:00
Igor Šćekić aa22680fee refactor(cli): shared-process remote sessions with safe per-session exit (#12327)
* refactor(cli): run remote sessions in one process with safe per-session exit

Consolidate remote session handling into a single CLI process instead of
spawning one process per remote-created session (addresses the PR review):

- restore in-process create_session (accepts an absent sessionId and targets
  the connection directory); remove the session spawner, the
  KILO_REMOTE_ATTACH_SESSION attach-on-boot path, the child-advertisement gate,
  and their tests
- retain instance advertisement and fire one immediate out-of-band heartbeat on
  (re)connect when advertising, so a headless `kilo remote` host is discoverable
  without delay

Make /exit (wire command exit_cli, unchanged for compatibility) detach only the
target session instead of terminating the CLI:

- AttachedState.detach with a presence-suppression tombstone; detach also clears
  the target's SessionStatus so the negative-containment heartbeat fence resolves
  deterministically for busy/retry/offline sessions
- exit_cli handler verifies ownership, cancels the active prompt, detaches and
  awaits the detach heartbeat, then ACKs; the interactive RemoteExit callback is
  invoked only after the ACK when the last owned session exits; a headless
  `kilo remote` host stays alive and advertising at zero sessions
- add an optional canExitSession boolean to the list_commands v1 catalog
  (always true, independent of exitAvailable) so clients can detect safe
  session-exit semantics

History and stored sessions are preserved on exit.

* fix(cli): break module-load cycle in remote session prompt-cancel

The K1 in-process exit_cli seam added a static `import { SessionPrompt }`
to kilo-sessions.ts. @/session/prompt evaluates KiloSessionPrompt at module
load, so the new static edge raced that init and left the namespace in TDZ,
crashing unrelated test files with 'undefined is not an object (evaluating
KiloSessionPrompt.shouldAskPlanFollowup)'. Defer to a dynamic import at the
single call site, mirroring remote-command.ts.

* fix(cli): correct AttachedState announce/detach concurrency and rollback

Address review findings on the shared-process session lifecycle:

- announce/detach no longer join the OPPOSITE in-flight operation. Joining
  detach's negative-containment fence made announce resolve success for a
  detached id (and vice versa: detach joined announce and resolved success
  while still attached, which exit_cli treats as license to ACK/close). Each
  path now joins only a same-kind in-flight op and, when the opposite op is
  in flight, awaits it to settle and then performs the real work.
- Failed-detach rollback now releases the suppression tombstone, so a
  still-attached session is not dropped by the next setPresence (the tombstone
  loop would otherwise remove the still-present id and never clear).
- Both catch/rollback branches now honor the lifecycle generation guard
  (mirroring the success path); a stale in-flight op that rejects after
  reset() no longer mutates the new lifecycle's presence/pending/suppressed
  sets (reset clears the same Set instances).

Adds regression tests for each fix, plus AC6f covering the remote-ws
detachSessionId negative-containment waiter.
2026-07-24 09:39:07 +02:00
Josh Lambert 62f1093c6e docs(cli): clarify upstream event revert 2026-07-24 00:06:51 -04:00
Josh Lambert bcf8b8b9a8 fix(cli): emit run events once 2026-07-23 23:09:42 -04:00
marius-kilocode 8e9bdaeb24 Revert "fix(cli): prevent stalled agent streams (#12249)"
This reverts commit cd205d857a.
2026-07-23 19:09:36 +02:00
Igor Šćekić bdb9070a9e fix(cli): bound time-to-first-content by request timeout, not the idle watchdog (#12481)
* test(cli): red repro for first-content watchdog conflation

* fix(cli): bound time-to-first-content by request timeout, not the idle watchdog

* fix(cli): make the SSE chunk-idle watchdog first-content-aware

* chore(cli): changeset and upstream annotations for first-content watchdog fix

* chore(cli): address review findings (docs, AC9a assertion, comments)

* docs(cli): clarify iterableFromSchedule test comment

* refactor(cli): extract SSE first-content watchdog to kilocode mirror; bound decoder buffer

* fix(cli): raise default chunk-idle stall timeout from 60s to 5 min
2026-07-23 17:52:23 +02:00
Bruno Agatao 69960b1fd2 Merge remote-tracking branch 'origin/main' into feat/explain-tool-auto-approval 2026-07-23 17:44:50 +02:00
Bruno Agatao ff02a977c5 test(cli): cover approval-provenance metadata preservation 2026-07-23 17:27:41 +02:00
Bruno Agatao c1530a9df8 feat(cli): record tool-call approval provenance on tool metadata 2026-07-23 17:27:40 +02:00
Bruno Agatao 073df16459 feat(cli): resolve why a tool call was auto-approved 2026-07-23 17:27:39 +02:00
Bruno Agatao 4250ad9a70 feat(cli): track config scope for each permission key 2026-07-23 17:27:38 +02:00
rakshith1928andkilo-code-bot[bot] 0d830cbd32 fix: avoid write-on-read mutation of config file (#11940)
* fix: avoid write-on-read mutation of config file

* fix: update test description for schema injection case

* Apply suggestion from @kilo-code-bot[bot]

Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>

* chore: add changeset

* fix(cli): preserve  as first config property via getInsertionIndex

* fix(cli): close missing brackets in config test preventing syntax error

* Removed test for preserving environment variables when adding $schema to config.

Removed test for preserving environment variables when adding $schema to config.

* fix(cli): add  ordering assertions to existing injection tests

* docs(changeset): clarify per-load churn scope for comment-first JSONC

* test(cli): use FSUtil in config schema tests after upstream refactor

* chore: combine changeset lines

---------

Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>
2026-07-23 16:12:01 +02:00
Johnny Eric Amancio 182d18bb28 fix(cli): harden plan edit permissions (#12458) 2026-07-23 15:15:42 +02:00
Christiaan Arnoldus cbbf7d48e4 Merge pull request #12488 from Kilo-Org/fix/show-vercel-response-id
fix: show Vercel ID for incomplete responses
2026-07-23 14:29:12 +02:00
Marius bf2cf9375b Merge pull request #12456 from Kilo-Org/correct-session-scoping
feat: reference past chats with @-mentions
2026-07-23 14:15:56 +02:00
Christiaan Arnoldus c25f041eb3 fix: show Vercel ID for incomplete responses 2026-07-23 12:14:46 +02:00
b367105c8d feat(vscode): support deleting queued chat messages (#12370)
* feat(vscode): support deleting queued chat messages

* feat(vscode): support deleting queued chat messages

* fix(ui): add missing deleteQueued i18n key to all locales

Add ui.message.deleteQueued to 19 locale files so the shared
UI translation test passes. Values left untranslated.

* style(vscode): fix prettier formatting in TranscriptRow

* Add changeset

* fix(ui): translate queued delete label

* docs(cli): preserve queue transition rationale

* refactor(cli): preserve queue naming from main

* test(cli): separate queued deletion coverage

* test(cli): await queue events deterministically

* docs(cli): clarify queued slot cancellation

* Update comment

* fix(cli): handle queued deletion race

* docs(cli): clarify queued deletion result

* Update .changeset/grumpy-cougars-see.md

Co-authored-by: hdcode.dev <hdcodedev@gmail.com>

* chore: remove kilocode_change markers from i18n dictionary entries

* chore(ui): annotate deleteQueued i18n entries with kilocode_change

---------

Co-authored-by: Marius <marius@kilocode.ai>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
2026-07-23 11:59:53 +02:00
Marius fa452196bf Merge pull request #12484 from Kilo-Org/fix-aws-sso-credential-parsing-error
fix(dev): preserve AWS profile credential loading
2026-07-23 11:55:06 +02:00
dcc0d64a32 feat(opencode): show token throughput metrics (#12434)
* feat(opencode): record per-step token throughput metrics

Capture prompt-processing and text-generation tokens/sec on every
StepFinishPart. The metrics helper prefers provider-reported rates
from llama.cpp / vLLM timings and falls back to wall-clock computation.
A new kilocode tui usage route renders PP/TG inline.

chore(sdk): regenerate types for StepFinishPart.metrics
feat(tui): render PP/TG in sidebar usage panel

feat(vscode): per-message and aggregated token throughput display

Surface throughput on each AssistantMessage badge (behind the
showTokenThroughput toggle) and as a compact PP/TG row in the
expanded TaskHeader. Adds session helpers, i18n entries in 20 locales,
and StepFinishPart.metrics to extension/webview messages.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(vscode): wire token throughput toggle and drop unreachable provider branch

- Replace the dead sendThroughputSetting() private with the shared
  buildThroughputSettingMessage() helper and add validThroughputSetting
  to handleUpdateSetting so the showTokenThroughput setting has the same
  guard as the chat/indexing twins (fixes Knip regression).
- Bind the DisplayTab Switch to the local settings draft so the toggle
  flips on click instead of waiting for a Save round-trip (the user-facing
  kill switch for #6579).
- Narrow StepThroughputMetrics.source to "computed"; backend hard-codes
  computed metrics today because the upstream AI SDK drops provider
  timings. Drop the unused provider branches from AssistantMessage and
  TaskHeader so the rendering code has no dead paths.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(opencode): centralize token throughput labels and tighten type guard

- Replace inline PP/TG labels in the CLI sidebar with a throughputLabel
  constant in model-usage so a future i18n sweep is one file instead
  of every rendering site.
- Tighten isStepMetrics in sidebar-usage back to a real discriminator
  check after dropping the unreachable "provider" union member.
- Drop formatPP/formatTG exports from model-usage since callers already
  use the shared formatRateValue; mirror the swap in the TUI usage test.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* feat(token-throughput-v2): wire aggregation through DisplayProvider and test computed-only

- aggregateMetrics adopts the first non-empty computed sample per field
  across every step-finish in the session, replacing the dead provider-
  ranked last-wins strategy that shipped with the unreachable branch.
- Share the throughputVisible signal through DisplayProvider so every
  AssistantMessage and the TaskHeader row react to a single onMount
  requestThroughputSetting round-trip, instead of each message posting
  its own handshake.
- Drop the unused routes/session/usage.tsx TUI route (no remaining
  imports) and add the chat-layout badge/header pill styles it was
  gating on.
- Refresh session-utils tests to exercise only source: "computed"
  samples and follow the new first-wins rule.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(token-throughput-v2): seed settings on hydration, drop dead provider branch

Seed the DisplayTab "Show Token Throughput" Switch on initial load by
mirroring the throughputSettingLoaded message into settings() (same
pattern as chat.shiftTabCyclesVariant). Without this, a persisted-true
setting renders unchecked on first open because the Switch was bound to
settings()["showTokenThroughput"] but no handler ever populated it.

Drop the dead data-source attributes on the per-message and task-header
throughput surfaces now that StepThroughputMetrics.source is narrowed
to "computed" only — the attribute was always the literal string.

Drop the unreachable chat.throughput.badge.provider and
.chat.throughput.badge.tooltip.provider i18n keys across all 20 locales.
The badges no longer branch on source === "provider" since the
provider-source branch is removed (the AI SDK adapter upstream strips
llama.cpp timings before they reach providerMetadata).

Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(token-throughput-v2): drop PP display until llama.cpp wiring lands

PP (prompt-processing rate) has no signal in this build: the AI SDK
adapter upstream strips llama.cpp's `prompt_per_second` before it reaches
providerMetadata, and computeMetrics has nothing else to derive it from.
Ship the TG (text-generation) rate only — the UI no longer renders the
"PP –" placeholder that made the feature look broken.

CLI sidebar drops the PP row; per-message badge and aggregated header
pill both lose the "PP – ·" prefix. The wire shape keeps the optional
prompt field so the follow-up that wires the upstream metadataExtractor
can populate it without another schema bump.

The `throughputLabel` constant on the opencode side and the `formatPP`
helper on the webview side are removed; tests that fabricated prompt
values are pruned to match.

Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(token-throughput-v2): integrate TG into Tokens row, plain-text style

The standalone blue pills read as loud for what is secondary session
info. Move the aggregated TG into the existing Tokens row as another
spanned value (alongside ↑ input, ↑ cache, ↓ output) and restyle the
per-message badge as plain text in descriptionForeground so both surfaces
match the tokens family.

TaskUsage now accepts a `throughput` prop and renders `TG <rate> t/s`
inline in the Summary component when the toggle is on. TaskHeader no
longer emits a standalone [data-slot="task-header-throughput"] element;
its [data-slot="task-header-throughput"] CSS rule is removed. The
throughputText / throughputTooltip memos and the unused formatTG
import are dropped — the values flow straight into TaskUsage.

Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(token-throughput-v2): finish removing memory badge from AssistantMessage

The "Merge origin/main into feat/token-throughput-v2" resolution kept the
throughput branch's memory-badge code (already removed from main by
28d015f8fe), which broke the kilo-ui-contract test and the i18n-keys test.

Drop the dead code: `useMemory`/`MemoryMarkerMeta` imports, `mem`, the
`meta`/`recall`/`fmt`/`count`/`items`/`verbose` createMemos, the `tip`
function, and the `<Show when={mem.enabled() && recall()}>` block. The
file lands at 349 lines (down from 391), matching main + throughput only.

Verified locally:
- i18n-keys + kilo-ui-contract: 53 pass, 0 fail
- Full kilo-vscode suite: failures 138 → 136 (+2 from the two fixes)

Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(token-throughput-v2): finish removing memory badge from AssistantMessage

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* formatting fixes

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(token-throughput-v2): address Marius review comments

- Rename 'TG' to 'Generation speed' in en.ts and add a 'gauge' icon to
  packages/kilo-ui so the per-message badge and the Tokens row show
  '<icon> Generation speed <rate> t/s' instead of the cryptic 'TG <rate>'.
  Centralize the opencode sidebar label in throughputLabel.generation.
- Switch aggregateMetrics (both webview and CLI) to the latest non-empty
  step-finish snapshot so only the most recent assistant turn's generation
  rate is shown rather than a session-wide aggregate. Update tests and
  comments to match.
- Translate the throughput strings in no.ts to Norwegian; mirror the new
  key shape across the other locales (English fallback for untranslated
  strings).

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(token-throughput-v2): close unclosed CSS block and apply prettier formatting

The throughput rebases left a duplicated .vscode-session-turn-diffs
selector and let three files drift from prettier's expectations. Fix
the CSS unclosed-block (which broke the Storybook preview build) and
re-run prettier --write on the touched files.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* ci: re-run after fixing CSS unclosed-block + prettier drift

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>

* fix(token-throughput-v2): address kilo-code-bot review

Kilo:
- CRITICAL: Remove the section === '' guard in KiloProvider.ts that
  blocked persistence of every top-level setting key. The throughput
  validator is now redundant, so drop it from throughput-settings.ts.
- WARNING: Reset samples in sidebar-usage.tsx when props.session_id
  changes via a keyed createEffect, so a session switch no longer
  blends step-finish metrics from the previous session and the array
  no longer grows without bound across long-lived plugin instances.
- WARNING: Pass {speed} to language.t for the TaskUsage throughput
  tooltip and reuse the shared formatTG helper instead of reformatting
  the value inline. Drop the dead [data-component='assistant-memory-badge']
  rule whose target component no longer exists in the tree.
- SUGGESTION: Drop redundant guards in model-usage.ts (undefined check
  after Number.isFinite, and the ?? 0 on an already-required number
  field). Use typeof === 'number' for the type narrowing.

* feat(token-throughput-v2): weighted per-turn rate, plain text footer

Address Marius's review of the throughput UI:

Calculation
- Persist per-step timing (start/end/elapsed) on step-start and
  step-finish parts in the session processor.
- Add wire schemas in core/src/v1/session.ts and packages/sdk/openapi.json
  so the new time field round-trips end-to-end.
- Replace the last-wins 'latest step rate' snapshot with a weighted
  aggregate: sum(output + reasoning tokens) / sum(active generation
  duration) across the turn's step-finish parts. Tool execution and
  idle waiting are excluded.
- The CLI sidebar (model-usage.ts) gains the same weighted semantics
  when timing is available, falling back to last-wins otherwise so
  older callers keep working.

Presentation
- Strip the per-message badge to plain muted text (no icon, no label,
  no border). The chip in the upstream action row reads as metadata.
- Move throughput out of the task header Tokens row so each turn owns
  its own value (no flicker across turns, single source of truth).
- Read the throughput memo from the full message parts in the data
  store rather than the chunked row slice, so step-finish in any
  chunk produces the badge.

i18n
- Replace chat.throughput.speed.{label,row,tooltip,tooltip.missing}
  with chat.throughput.tooltip and chat.throughput.tooltip.missing
  across all 19 locale files.

Tests
- Add messageThroughput and sessionThroughput describe blocks
  exercising the weighted aggregate across multiple steps.
- Cover weighted + fallback paths in the CLI aggregateMetrics tests.

* fix(token-throughput-v2): render t/s inline beside copy/feedback buttons

Move the throughput badge from a footer line below the assistant message
into the copy/feedback action row of the text part that carries the copy
button. This avoids the extra vertical space the footer consumed.

Also apply prettier formatting to drifted PR files (i18n line wraps,
TaskHeader/session-utils/test reflows).

* fix(token-throughput-v2): correct changeset package name to @kilocode/cli

* fix(token-throughput-v2): annotate step-start time field with kilocode_change

---------

Co-authored-by: Thomas Brugman <thomas@kilocode.ai>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: marius-kilocode <marius@kilocode.ai>
2026-07-23 09:43:13 +00:00
Rakshith N 56be86ef04 fix(cli): stop leaking maxOutputTokens into provider options during compaction
Compaction writes the output budget into agent.options.maxOutputTokens.
LLMRequestPrep.prepare merges agent.options into providerOptions, and the
AI SDK serializes it verbatim into the request body; strict
OpenAI-compatible upstreams reject it with
'Unsupported parameter(s): maxOutputTokens'.

Strip the injection site. The cap is still enforced through two
independent paths: the constrained model passed downstream and the
llm.ts re-cap on prepared.params.maxOutputTokens.
2026-07-23 13:50:58 +05:30