Commit Graph

570 Commits

Author SHA1 Message Date
Evgeny Shurakov eb4e5705ac Merge pull request #7941 from Kilo-Org/eshurakov/eshurakov/websocket-hearbeat-monitor
KiloSessions - Add WebSocket activity watchdog with heartbeat ack
2026-03-31 11:13:29 +02:00
Evgeny Shurakov 23c7d053f2 feat(cli): add WebSocket activity watchdog with heartbeat_ack support
Add an inactivity watchdog to RemoteWS that force-closes and
reconnects the WebSocket when no inbound messages arrive within
a configurable timeout window (default 30s). Introduce a
heartbeat_ack inbound message type so the server can respond
to heartbeat pings, resetting the activity timer.
2026-03-30 16:39:33 +02:00
Alex Alecu 6fadd9de99 fix(cli): user denies override MCP ask rules
Re-apply user deny rules after the ask-specific config so explicit
user denies for MCP servers are not overridden by the generated
mcpRules 'ask' defaults.
2026-03-30 15:31:47 +03:00
Alex Alecu a68cf47dac fix(cli): remove find from Ask allowlist, add git write denials
find has -exec/-execdir/-delete flags that execute arbitrary commands
or delete files, bypassing the prefix-based permission check. Also add
missing git write subcommand denials: config, clone, pull, init,
worktree, submodule, revert, bisect, filter-branch, fetch, restore.
2026-03-30 15:21:55 +03:00
Alex Alecu e64aba0b23 test(cli): add Ask agent permission tests
Verify readOnlyBash allowlist, git write denials, gh ask rules,
disabled() behavior for edit/task/bash tools, and dynamic MCP
permission generation with server name sanitization.
2026-03-30 15:06:36 +03:00
Marius 9cf83d8122 fix(cli): make FreeUsageLimitError non-retryable to prevent unrecoverable backoff loop (#7809)
* fix(cli): make FreeUsageLimitError non-retryable to prevent unrecoverable backoff loop

When a free model hits its usage cap, the retry loop would endlessly
retry with the same stale model reference. Switching models in the chat
selector could not break the loop because the processor captures the
model once at creation time. Making FreeUsageLimitError non-retryable
surfaces the error immediately so users can switch models and continue.

* chore(kilo-docs): update source links after removing FreeUsageLimitError URL
2026-03-27 17:19:30 +01:00
Evgeny Shurakov 49bb16ca31 Merge pull request #7733 from Kilo-Org/eshurakov/actually-afterthought
Cli - Include parentSessionId in heartbeat session info
2026-03-27 14:17:55 +01:00
Alex Alecu a84edc3267 test(cli): add failing test for empty tool-calls loop (#7756)
Reproduces the infinite loop when the model returns finish_reason: "tool-calls"
but emits zero actual tool call parts. Test 1 asserts the processor converts
finish to "stop" (currently fails). Test 2 verifies valid tool-calls flows
are preserved (passes).
2026-03-27 11:59:55 +02:00
Evgeny Shurakov 4f5466d086 feat(cli): include parentSessionId in heartbeat session info 2026-03-26 21:58:37 +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
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
Evgeny Shurakov 435d82ca08 fix(cli): add configurable session retry limit 2026-03-26 12:54:28 +01: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
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
Evgeny Shurakov ac898b5c32 fix(cli): address remote relay review feedback — race, leak, and stuck-state fixes
Fix .finally() clearing a newer enabling promise on disable→re-enable,
grandchild entries leaking in the children map on unsubscribe, and
permanent WS close codes leaving remote stuck enabled forever.
2026-03-24 15:51:09 +01:00
Evgeny Shurakov 37b866f1ef feat(cli): add remote session relay over WebSocket
Introduce WebSocket-based remote session relay so external clients can
subscribe to sessions, send messages, answer questions, and respond to
permissions in real time.

- RemoteWS manages the authenticated WebSocket lifecycle with reconnect
- RemoteSender dispatches inbound commands and forwards server events
- Backfill pending questions/permissions when a client subscribes
- Add question_reject command for dismissing questions remotely
- Consolidate /remote TUI command into kilo-commands
- Add session.viewed endpoint to the generated SDK
- RemoteProtocol.Preview schema for diagnostic logging
2026-03-24 13:54:30 +01:00
Mark IJbema 9f8079058a fix(cli): always use kilo.db regardless of channel
The upstream merge in PR #7240 introduced channel-based database path
separation, causing non-latest/beta channels (including local dev) to
open a different DB file (e.g. kilo-local.db) instead of kilo.db. This
made all existing sessions invisible.

Remove the channel-based path logic and always use kilo.db. Also remove
the now-unused KILO_DISABLE_CHANNEL_DB flag.

Closes #7472
2026-03-23 18:33:21 +01:00
Imanol Maiztegui 64442519b4 Improved subagent permissions handling (#7348)
* feat(vscode): handle subagent permissions

* fix(vscode): formatting

* fix(permission): preserve original ruleset in pending requests for drainCovered evaluation

* style(permission): shorten inline comments on kilocode_change markers

* refactor(permission): extract drainCovered into dedicated module
2026-03-20 18:08:11 +01:00
Catriel Müller d7b9f51962 refactor: replace x-opencode-* headers with x-kilo-* across codebase and upstream scripts
Update upstream merge scripts to use a generic x-opencode- → x-kilo- regex
that catches all current and future headers automatically. Apply the same
replacement to all source files so the codebase is ready for the next
upstream merge.
2026-03-20 09:10:57 -03:00
Johnny Amancio a49820192d resolve merge conflicts 2026-03-20 12:18:26 +01:00
Johnny Amancio f3a327d265 refactor: kilo compat for v1.2.24 2026-03-20 11:56:07 +01:00
Imanol Maiztegui f336949a08 Save changes on Settings update (#7312)
* feat(vscode): track session status for busy-session warnings

* feat(vscode): warn before saving settings when sessions are running

* feat(vscode): add draft state and save/discard to config context

* feat(vscode): Save button on Settings panel

* fix(vscode): pass remove permission commands correctly to backend

* feat(vscode): handle permission removals

* fix(vscode): detect other sessions in settings panel

* feat(vscode): translations

* feat(vscode): refresh config state on auto-approve tab

* fix(vscode): formatting and unit tests

* fix: reset Config.state cache on no-dispose config write

* fix(vscode): Detect sessions opened before Settings tab is opened

* fix(vscode): Removed previous fix changes
2026-03-19 22:12:09 +01:00
Josh Holmer b74d4b4481 fix(cli): improve agent handling 2026-03-19 10:47:05 -04:00
Josh Holmer 040284034a fix(cli): preserve selected variant as well 2026-03-19 10:44:56 -04:00
Josh Holmer 1fc0e644dd fix(cli): use configured Code model when implementing a plan 2026-03-19 10:44:56 -04:00
Catriel Müller 30d39649aa refactor: merge main 2026-03-18 18:18:38 -03:00
Catriel Müller 7edd3f6fc2 Merge branch 'main' into catrielmuller/kilo-opencode-v1.2.21 2026-03-18 17:10:56 -03:00
Alex Alecu 773212863c fix(cli): delay paste summary 2026-03-18 16:09:37 +02:00
Catriel Müller b8f07d8070 resolve merge conflicts 2026-03-18 08:21:52 -03:00
Catriel Müller 660328cfad refactor: kilo compat for v1.2.22 2026-03-18 08:11:10 -03:00
Catriel Müller 95af221084 refactor: fix test 2026-03-17 18:10:43 -03:00
Catriel Müller 7ff4983aec Merge branch 'main' into catrielmuller/kilo-opencode-v1.2.21 2026-03-17 17:52:56 -03:00
Imanol Maiztegui 0adb514da4 Remove allow always button (#7159)
* feat: save permissions to config

* fix: preserve wildcard default in jsonc scalar promotion and skip dispose for permission saves

* fix: update CLI permission hint to reflect permanent persistence

* fix: avoid mutating input in mergeConfig permission normalization

* chore: update kilo-vscode visual regression baselines

* fix(vscode): remove Allow Always button from PermissionDock

* fix(kilo-vscode): removed unreachable onDecide option

* chore: update kilo-vscode visual regression baselines

* fix: scope patchJsonc scalar promotion to permission keys only

* fix: toConfig always uses object format to preserve existing granular rules

* fix: preserve metadata.rules order in saveAlwaysRules for correct precedence

* feat:show non-bash tool permissions on dropdown

* fix: include always patterns in saveAlwaysRules validation loop

* test(kilo-vscode): remove write mixed-decisions screenshot test for single-rule dropdown

* test: updated visual tests

* fix: formatting

* chore: update kilo-vscode visual regression baselines

* fix: use scalar format in toConfig for PermissionAction-only permissions

* fix: serialize scalar-only permissions as scalars for all patterns

* fix: skip non-wildcard patterns for scalar-only permissions in toConfig

* fix: promote doom_loop to PermissionRule for per-tool persistence

* fix: keep doom_loop as PermissionAction and skip non-wildcard scalar-only patterns in toConfig

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-17 18:44:04 +01:00
Imanol Maiztegui 28330ea765 Save permission rules to config (#7143)
* feat: save permissions to config

* fix: preserve wildcard default in jsonc scalar promotion and skip dispose for permission saves

* fix: update CLI permission hint to reflect permanent persistence

* fix: avoid mutating input in mergeConfig permission normalization

* chore: update kilo-vscode visual regression baselines

* chore: update kilo-vscode visual regression baselines

* fix: scope patchJsonc scalar promotion to permission keys only

* fix: toConfig always uses object format to preserve existing granular rules

* fix: preserve metadata.rules order in saveAlwaysRules for correct precedence

* fix: remove unnecessary dispose con config global update

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-17 15:59:52 +01:00
Catriel Müller 426521468f resolve merge conflicts 2026-03-17 11:37:03 -03:00
Catriel Müller 266ceca646 refactor: kilo compat for v1.2.21 2026-03-17 08:50:30 -03:00
Catriel Müller 36210fa6d1 resolve merge conflicts 2026-03-16 20:33:36 -03:00
Catriel Müller e6b29e3ead feat: merge opencode v1.2.19 2026-03-16 19:37:22 -03:00
Imanol Maiztegui 0484318191 Granular bash permission rules (#7091)
* fix: renamed pattern arrays used for permission rules

* fix: rename savePatternRules to saveAlwaysRules

* feat: generate hierarchical always patterns in bash tool

* feat: validate saveAlwaysRules against always array only

* feat: pass always field through extension bridge to webview

* feat: show hierarchical always patterns in PermissionDock dropdown

* fix: rename pattern to rule in PermissionDock translations, styles, and data-slots

* fix(vscode): correct auto-run comment in PermissionDock

* feat(kilo-vscode): strip trailing wildcard from permission rule labels

* fix: deduplicate permission rules and strip wildcards from display labels

* refactor: move hierarchy to metadata.rules, restore always to arity prefix

* feat: pass always field to permission dock for non-bash tool rules

* fix: correct bash test assertion to check metadata.rules and fix indentation

* fix: hide permission rules dropdown for non-bash tools

* fix: align always-rules route descriptions, whitespace, and restore multi-command tests
2026-03-16 17:43:16 +01:00
Kevin van Dijk 83cef06f0d Merge pull request #6989 from Kilo-Org/kevinvandijk/kilo-opencode-v1.2.17
OpenCode v1.2.17
2026-03-13 14:06:54 +01:00
Imanol Maiztegui a913731700 Permission toggles per-pattern in permission dock (#6977)
* feat(kilo-vscode): Granular permission layout

* formatting

* chore: update kilo-vscode visual regression baselines

* fix: Make sure pattern permissions are correctly saved

* fix: Only save patterns originally sent

* chore: Moved pattern permission logic to its own endpoint

* tests: Unit tests for pattern permissions handling

* fix: Avoid race conditions on permission reply messages

* fix: Handle missing requestId on pattern permission request

* fix: Return NotFoundError when input.requestID missing

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-13 13:56:57 +01:00
Kevin van Dijk 4e227ca318 Merge branch 'main' into kevinvandijk/kilo-opencode-v1.2.17 2026-03-13 13:55:22 +01:00
marius-kiloclaw 7473015ef9 fix(mcp-migrator): handle malformed JSON in legacy .kilocode/mcp.json (#7012)
readMcpSettings() called JSON.parse() without try/catch. In migrate(),
if .kilocode/mcp.json existed but contained malformed JSON, the uncaught
exception propagated out of the dual-read loop, preventing .kilo/mcp.json
from ever being read. The outer loadMcpConfig() catch returned {} instead
of the valid config — silently losing MCP server configuration.

Wrap the file read + parse in try/catch, log a warning, and return null
so the loop continues to the next config directory.

Regression tests added for both readMcpSettings (unit) and migrate
(integration) to prove the bug and verify the fix.

Refs: #6881

Co-authored-by: marius-kiloclaw <marius-kiloclaw@users.noreply.github.com>
2026-03-13 13:26:37 +01:00
Christiaan Arnoldus 24ff41a268 Apply suggestions from code review
Co-authored-by: Christiaan Arnoldus <christiaan.arnoldus@outlook.com>
2026-03-13 09:45:16 +01:00
Apoorv Saxena f24df95fee Merge branch 'main' into feat/inception-mercury2-reasoning-effort 2026-03-12 23:09:42 +05:30
Evgeny Shurakov 57dd8f8c25 fix(cli): restore Kilo share URL support in import command
The upstream merge (v1.1.54) overwrote Kilo-specific URL handling with
the opencode ShareNext flow, breaking import for app.kilo.ai/s/ URLs.

Restore parsing of https://app.kilo.ai/s/<id> and fetching from
ingest.kilosessions.ai instead of the opncd.ai share API.
2026-03-12 13:54:34 +01:00
Kevin van Dijk 6498fdaaa2 Merge branch 'main' into kevinvandijk/kilo-opencode-v1.2.17 2026-03-12 13:21:08 +01:00
Marius 466644eb25 fix: use .kilo instead of .kilocode for config directories (#6881)
* fix: use .kilo instead of .kilocode for config directories

* fix: keep global ~/.kilocode untouched for legacy CLI compat

Only rename project-level .kilocode/ to .kilo/. The global ~/.kilocode
directory must stay because legacy CLI instances and legacy-migration.ts
in kilo-gateway still read from it.

* test: update VS Code extension tests to use .kilo directory paths

* fix: correct paths.ts comment and use specific git exclude entries

- Fix comment referencing ~/.kilo when globalDir() returns ~/.kilocode
- Revert to specific .kilo/ git exclude entries instead of blanket .kilo/
  to avoid hiding user-authored rules/workflows/config from git status

* fix: handle legacy per-worktree metadata and stale paths in state

- readMetadata() falls back to .kilocode/ inside worktrees since the
  per-worktree metadata dirs aren't renamed by the top-level migration
- Rewrite stale .kilocode/ paths in agent-manager.json on load

* fix: run .kilocode migration at extension activation, not just Agent Manager

Move migration call to the top of activate() so it runs for all users
on every extension startup, before kilo serve is spawned or any code
reads from the .kilo directory.

* fix: update git worktree refs after .kilocode → .kilo rename

After renaming the directory, git's internal .git/worktrees/*/gitdir
files still reference the old .kilocode path. This causes git to lose
track of worktrees, leading to crashes. Both the CLI and extension
migration now rewrite these gitdir files after a successful rename.

* fix: read from both .kilo and .kilocode, write to .kilo

Replace the one-time directory rename migration with a dual-read strategy:

- CLI config (rules, workflows, skills, MCP, project-id): read from both
  .kilo/ and .kilocode/ directories, with .kilo taking precedence
- Agent Manager data (worktrees, state, setup scripts): migrate from
  .kilocode/ to .kilo/ at startup since the extension exclusively owns these
- Config discovery (paths.ts, config.ts): include .kilocode in directory
  and agent/command pattern matching

Key decisions:
- .kilo/ is the new canonical write location for all new data
- .kilocode/ is read as a legacy fallback (no data loss for existing users)
- No directory rename: both dirs can coexist safely
- Agent Manager migration is item-level (moves individual files), not a
  full directory rename, so it handles both-dirs-exist gracefully
- Windows path rewrite in WorktreeStateManager handles both / and \ separators
- Workflow/MCP load order: .kilocode first, .kilo second (last wins)
- Rules dedup via seen-set with .kilo checked first (first wins)
- Delete migrate-kilo-dir.ts (no longer needed)

* fix: resolve .git file when fixing worktree refs during migration

When the project root is itself a worktree, .git is a file pointing
at the shared git dir, not a directory. Follow the gitdir pointer to
find the actual .git/worktrees/ location.

* fix: recover partial .kilo migrations and global dirs

Always repair stale git worktree refs when .kilo worktrees already exist so partially migrated repos recover on startup. Also dual-read global skills, rules, and workflows from both legacy and new home directories.

* fix: keep .kilo ahead of legacy config dirs

* fix: narrow legacy agent manager excludes

* chore: link migration cleanup follow-up
2026-03-12 12:50:28 +01:00
Kevin van Dijk b83c848909 Resolve merge conflicts 2026-03-12 12:42:48 +01:00