Commit Graph

4646 Commits

Author SHA1 Message Date
Alex Alecu 2dba685256 refactor(cli): extract helpers to reduce duplication 2026-03-26 17:13:19 +02:00
Alex Alecu a2151478ee fix(cli): check movePath in apply_patch config guard 2026-03-26 17:03:58 +02:00
Alex Alecu 6105e356a9 fix(cli): detect nested config dirs in isRelative 2026-03-26 17:03:39 +02:00
Marian Alexandru Alecu ed03c64710 Merge branch 'main' into feat/config-permission-protection 2026-03-26 17:01:41 +02:00
Marius f2dcafc2c5 fix(cli): strip bloated file contents from tool metadata to fix session loading perf (#7706)
Edit, apply_patch, and user message summary were storing full before/after
file contents in metadata — causing sessions to balloon to 90+ MB and crash
the VS Code extension on load.

Strip before/after from edit filediff, apply_patch files[], and
summary.diffs both at write time (new data) and read time (existing data).
2026-03-26 15:47:04 +01:00
Evgeny Shurakov b63a9393dc Merge pull request #7689 from Kilo-Org/eshurakov/retry-limit
Cli - Add configurable session retry limit
2026-03-26 15:23:59 +01:00
Christiaan Arnoldus 091a9e048c Merge pull request #7653 from Kilo-Org/christiaan/ai-sdk
Update Vercel AI SDK OpenAI Provider for phase support
2026-03-26 15:14:15 +01:00
Evgeny Shurakov b7fdbe63ea fix(cli): use load-time constant for KILO_SESSION_RETRY_LIMIT 2026-03-26 14:54:27 +01:00
Marius 79d2567e6c fix(cli): hide commit-message git windows on Windows (#7692)
Prevent cmd.exe flashes when commit message generation shells out to git on Windows and add a regression test for the subprocess flags.
2026-03-26 13:59:04 +01:00
Marian Alexandru Alecu ab66954f4d Merge pull request #7617 from Kilo-Org/fix/session-diff-memory-leak
fix(cli): prevent CLI memory leaks from oversized diffs and session accumulation
2026-03-26 14:24:32 +02:00
Alex Alecu 1cb4b5c8c0 refactor(cli): clean up code quality issues 2026-03-26 14:11:54 +02:00
Alex Alecu 664ceecc32 refactor(cli): reuse MAX_DIFF_SIZE constant 2026-03-26 14:06:16 +02:00
Alex Alecu 721b3d0630 chore(cli): add missing kilocode_change markers 2026-03-26 13:59:08 +02:00
Evgeny Shurakov 435d82ca08 fix(cli): add configurable session retry limit 2026-03-26 12:54:28 +01:00
Alex Alecu bfbfbb967c chore(cli): add kilocode_change markers 2026-03-26 13:52:48 +02:00
Alex Alecu 3ed648d566 refactor(cli): extract max diff size constant 2026-03-26 13:51:24 +02:00
kilo-maintainer[bot] 18c5fc3f22 release: v7.1.5 2026-03-26 09:56:13 +00:00
Marian Alexandru Alecu 8b676f8961 Merge branch 'main' into fix/session-diff-memory-leak 2026-03-26 11:41:40 +02:00
Alex Alecu 5d611d6da6 revert: remove /new worker/subprocess restart
The subprocess restart approach did not solve the underlying Bun native
memory retention issue (oven-sh/bun#28318). Remove all restart plumbing
from rpc.ts, thread.ts, worker.ts, app.tsx, and sdk.tsx to keep the
diff clean. The diff-size and store-eviction fixes remain.
2026-03-26 11:40:49 +02:00
Christiaan Arnoldus 9bde551331 Update Vercel AI SDK OpenAI Provider for phase support 2026-03-26 10:38:20 +01:00
Alex Alecu 1596cae383 fix(cli): use subprocess instead of Worker thread for actual memory reclamation
Bun Workers are threads within the same OS process — terminate() frees
the JSC context but mimalloc retains every page process-wide, so the
previous Worker-restart approach had zero effect on RSS.

Switch to Bun.spawn() with IPC which creates a separate child process.
Killing that process returns all its native memory to the OS.

The IPC relay pattern means the RPC client persists across subprocess
restarts — event listeners, fetch proxy, and SDK all continue working
without getter-indirection or rebinding.

Workaround for https://github.com/oven-sh/bun/issues/28318
2026-03-26 11:28:14 +02:00
Marian Alexandru Alecu 4a2d979395 Merge pull request #7056 from Githubguy132010/fix/block-subagents-spawning-subagents
fix: block subagents from spawning subagents
2026-03-26 11:18:14 +02:00
Alex Alecu a7d37318cb fix(cli): replay workspace after restart 2026-03-26 10:46:45 +02:00
Alex Alecu 1a0536daf3 fix(cli): detach RPC listener on cleanup 2026-03-26 10:46:23 +02:00
Alex Alecu 10e3b12b13 fix(cli): evict child sessions recursively 2026-03-26 10:46:09 +02:00
Alex Alecu 6819ee7580 fix(cli): restart worker on /new to reclaim native memory
Bun's JSC does not return freed native heap pages to the OS within a
single Worker lifetime. After large sessions, the only way to reclaim
that 2-3 GB of native allocator retention is to terminate the worker
and spawn a fresh one.

Workaround for https://github.com/oven-sh/bun/issues/28318

- Add getter-indirection layer so fetch/events transparently follow
  worker replacement without rebuilding the TUI
- Add rejectAll() to RPC client to fail in-flight calls on termination
- Add rebindable event source that re-registers handlers on new client
- Wire /new command to fire-and-forget restart; sync layer re-bootstraps
  via server.instance.disposed event from the new worker
- Guard against re-entry and skip in external server mode
2026-03-26 10:28:20 +02:00
Marian Alexandru Alecu 1c4918cef0 Merge branch 'main' into fix/session-diff-memory-leak 2026-03-25 21:54:48 +02:00
kilo-maintainer[bot] fd5fee9ec3 release: v7.1.4 2026-03-25 16:32:24 +00:00
Alex Alecu 6878ddb03d fix(cli): strip summary.diffs from messages in TUI store
User messages carry summary.diffs with full before/after file content
(the same giant strings as session_diff). The TUI never reads this
field. Strip it at both entry points (SSE handler + full sync) to
prevent multi-MB strings from accumulating in the Solid store.
2026-03-25 17:52:05 +02:00
Alex Alecu a3c8340401 fix(cli): keep permission and question on evict 2026-03-25 17:40:22 +02:00
Alex Alecu 1a07ad1a56 fix(cli): evict per-session data from TUI store on navigation
The Solid store accumulated messages, parts, diffs, todos, status, and
permissions for every session visited during a TUI lifetime. Navigating
away via /new or the session list never freed the old session's data.

Add an evict() function that deletes all per-session entries from the
store maps and clears the fullSyncedSessions cache. Wire it into:
- A createEffect in app.tsx that fires when the route changes away
  from a session (on() tracks prev vs current sessionID)
- The session.deleted SSE handler, which previously only removed the
  session list entry but left orphaned per-session data
2026-03-25 17:33:05 +02:00
Marian Alexandru Alecu f0892bfe37 Merge pull request #7151 from shssoichiro/issue-6906
fix(cli): use configured Code model when implementing a plan
2026-03-25 17:30:19 +02:00
Alex Alecu d7f73a162e fix(cli): use byte length for size check 2026-03-25 17:16:38 +02:00
Alex Alecu 24517648bd fix(cli): scrub oversized diffs from stored session_diff on read
Existing sessions may have multi-GB before/after strings persisted in
session_diff JSON files. The read path in Summary.diff() now checks each
entry against the 256 KB cap and replaces oversized content with empty
strings, then rewrites the file so subsequent loads are fast. This follows
the existing unquoteGitPath migration pattern.
2026-03-25 17:11:37 +02:00
Mark IJbema d31f3c3693 Merge pull request #7517 from Kilo-Org/mark/bash-default-ask-new-users
feat(cli): change default bash permission to ask for new users only
2026-03-25 15:59:42 +01:00
Alex Alecu 59d1bbb6af perf(cli): use git cat-file -s to pre-check size before reading file content
Avoids allocating multi-MB strings in the JS heap for oversized files.
Previously the full content was read then discarded; now the object size
is checked first via cat-file -s and the git show is skipped entirely
when either side exceeds 256 KB.
2026-03-25 16:56:19 +02:00
Alex Alecu 7f57983c14 fix(cli): strip before/after from TUI session_diff store
Defense-in-depth: destructure away before/after content from FileDiff
objects at both TUI store entry points (SSE handler + full sync). The
sidebar only reads file, additions, deletions — carrying full file content
in the Solid store is unnecessary and risks memory bloat.
2026-03-25 15:32:33 +02:00
Alex Alecu 54105335f3 fix(cli): cap file content at 256 KB in Snapshot.diffFull()
When diffFull() reads file contents via git show, files exceeding 256 KB
(e.g. .heapsnapshot JSON) are now treated like binary files — before/after
are replaced with empty strings. This prevents multi-GB strings from
accumulating in downstream consumers (storage, SSE, TUI, VS Code, sharing).
2026-03-25 15:32:25 +02:00
Evgeny Shurakov 508378464a Merge pull request #7446 from Kilo-Org/eshurakov/ingest-stream
Remote - add real-time session relay and remote control over WebSocket
2026-03-25 13:43:17 +01:00
Mark IJbema e63e514e69 fix(cli): remove commands that can execute arbitrary code from bash allowlist
Remove find (-exec), env (runs commands), git (hooks/aliases),
npm/yarn/pnpm/bun (postinstall scripts, run subcommand), and make
(executes Makefile recipes). Keep only commands that cannot spawn
subprocesses or execute arbitrary code.
2026-03-25 13:23:49 +01:00
Mark IJbema 365c3bf708 fix(cli): check legacy TOML config for bash permission in migration
Prevents overwriting an explicit bash permission set in the legacy
TOML config file when a higher-precedence JSON/JSONC file exists.
2026-03-25 12:28:52 +01:00
Mark IJbema b73963578d fix(cli): trim bash allowlist to safe commands, handle legacy config
- Remove commands that can execute arbitrary code (node, python, curl,
  docker, etc.) from the default bash allowlist
- Keep only read-only/informational commands, text processing, file
  operations, git, package managers, compilers, and archive tools
- Handle legacy TOML config file in bash migration to detect existing
  users who only have the old config format
2026-03-25 12:22:41 +01:00
Mark IJbema 87fab14e94 fix(cli): correct bash permission type annotation for typecheck 2026-03-25 12:13:04 +01:00
Mark IJbema f5b85f15ee fix: move bash migration to config loading, add safe command defaults
- Move bash permission migration from storage.ts to Config.global() so
  it runs before config is consumed (fixes timing issue)
- Check all 5 global config files (config.json, kilo.json, kilo.jsonc,
  opencode.json, opencode.jsonc) for existing bash permission before
  migrating, and write to the highest-precedence existing file
- Add default allow-list of safe bash commands (ls, git, npm, etc.) so
  users aren't prompted for common development commands
2026-03-25 12:11:21 +01:00
Mark IJbema 6d7a04a33a feat(cli): change default bash permission to ask for new users only
Add bash:ask to hardcoded permission defaults so new users are prompted
before shell commands execute. A storage migration preserves the existing
bash:allow behavior for existing users by writing it to their global config
if they haven't explicitly set a bash permission.
2026-03-25 12:10:44 +01:00
Mark IJbema 94ed2ee73f Merge pull request #7576 from Kilo-Org/fix/orchestrator-remove-bash-access
fix(cli): remove bash access from orchestrator mode
2026-03-25 11:54:54 +01:00
Mark IJbema afe5df0449 fix(cli): enforce bash deny after user config in orchestrator permissions
Instead of placing user before the orchestrator allowlist (which prevents
users from restricting allowed tools), keep user in the normal position
but add an explicit bash deny after user. This way:
- User can still deny orchestrator-allowed tools (e.g. webfetch)
- User cannot re-enable bash since the post-user deny wins via findLast
2026-03-25 11:53:03 +01:00
Christiaan Arnoldus 9f985dda1a Merge pull request #7579 from Kilo-Org/christiaan/api-variants
Convert Kilo/OpenRouter variants to OpenAI/Anthropic format if necessary
2026-03-25 11:23:39 +01:00
Mark IJbema b1542bbd78 fix(cli): restore commented-out bash line for upstream merge compatibility 2026-03-25 11:22:40 +01:00
Christiaan Arnoldus 0f76380a2d Add openaiCompatible settings 2026-03-25 11:19:03 +01:00