-
Notifications
You must be signed in to change notification settings - Fork 5
fix(kilocode): detect the installed CLI instead of assuming one (#1015) #1024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
frankbria
wants to merge
3
commits into
main
Choose a base branch
from
fix/1015-kilocode-7x
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # kilocode CLI help fixtures | ||
|
|
||
| Verbatim `kilo --help` output from the two incompatible CLIs that both answer to | ||
| `kilo`. `_detect_surface` is matched against these rather than against text | ||
| invented for the test — the same reason #914 checks in the codex app-server | ||
| schema. | ||
|
|
||
| | file | version | captured | | ||
| |---|---|---| | ||
| | `help-0.22.0.txt` | `@kilocode/cli@0.22.0` (2026-01-15) | 2026-08-01 | | ||
| | `help-7.4.17.txt` | `@kilocode/cli@7.4.17` (2026-07-29) | 2026-08-01 | | ||
|
|
||
| Regenerate with: | ||
|
|
||
| ``` | ||
| npm install -g @kilocode/cli@<version> | ||
| kilo --help > help-<version>.txt 2>&1 | ||
| ``` | ||
|
|
||
| The 7.x file contains ANSI/box-drawing characters from the banner; that is | ||
| deliberate, since the real output does too and the detector must cope with it. |
53 changes: 53 additions & 0 deletions
53
tests/core/adapters/fixtures/kilocode_help/help-0.22.0.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| Usage: kilocode [options] [command] [prompt] | ||
|
|
||
| Kilo Code Terminal User Interface - AI-powered coding assistant | ||
|
|
||
| Arguments: | ||
| prompt The prompt or command to execute | ||
|
|
||
| Options: | ||
| -V, --version output the version number | ||
| -m, --mode <mode> Set the mode of operation (architect, code, | ||
| ask, debug, orchestrator) | ||
| -w, --workspace <path> Path to the workspace directory (default: | ||
| "/home/frankbria/projects/codeframe") | ||
| -a, --auto Run in autonomous mode (non-interactive) | ||
| (default: false) | ||
| --yolo Auto-approve all tool permissions (default: | ||
| false) | ||
| -j, --json Output messages as JSON (requires --auto) | ||
| (default: false) | ||
| -i, --json-io Bidirectional JSON mode (no TUI, | ||
| stdin/stdout enabled) (default: false) | ||
| -c, --continue Resume the last conversation from this | ||
| workspace (default: false) | ||
| -t, --timeout <seconds> Timeout in seconds for autonomous mode | ||
| (requires --auto) | ||
| -p, --parallel Run in parallel mode - the agent will create | ||
| a separate git branch, unless you provide | ||
| the --existing-branch option | ||
| -eb, --existing-branch <branch> (Parallel mode only) Instructs the agent to | ||
| work on an existing branch | ||
| -pv, --provider <id> Select provider by ID (e.g., 'kilocode-1') | ||
| -mo, --model <model> Override model for the selected provider | ||
| -s, --session <sessionId> Restore a session by ID | ||
| -f, --fork <shareId> Fork a session by ID | ||
| --nosplash Disable the welcome message and update | ||
| notifications (default: false) | ||
| --append-system-prompt <text> Append custom instructions to the system | ||
| prompt | ||
| --on-task-completed <prompt> Send a custom prompt to the agent when the | ||
| task completes | ||
| --attach <path> Attach a file to the prompt (can be | ||
| repeated). Currently supports images: png, | ||
| jpg, jpeg, webp, gif, tiff (default: []) | ||
| -h, --help display help for command | ||
|
|
||
| Commands: | ||
| auth Manage authentication for the Kilo Code CLI | ||
| config Open the configuration file in your default | ||
| editor | ||
| debug [mode] Run a system compatibility check for the | ||
| Kilo Code CLI | ||
| models [options] List available models for the current | ||
| provider as JSON |
60 changes: 60 additions & 0 deletions
60
tests/core/adapters/fixtures/kilocode_help/help-7.4.17.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| ██ ██ ██🬺🬏 ██ ██ ██🬺🬏 ████ ██ ██🬺🬏 | ||
| ████🬺🬏 ~~██ ██ ~~ ██~~██ ██~~~~ ██ ~~██ | ||
| ██ ██ ██████ 🬁🬬████ 🬁🬬██~~ 🬁🬬████ 🬁🬬████ ██████ | ||
| ~~ ~~ ~~~~~~ ~~~~ ~~ ~~~~ ~~~~ ~~~~~~ | ||
|
|
||
| Commands: | ||
| kilo completion generate shell completion script | ||
| kilo acp start ACP (Agent Client Protocol) server | ||
| kilo mcp manage MCP (Model Context Protocol) servers | ||
| kilo [project] start kilo tui [default] | ||
| kilo attach <url> attach to a running kilo server | ||
| kilo run [message..] run kilo with a message | ||
| kilo debug debugging and troubleshooting tools | ||
| kilo auth manage AI providers and credentials [aliases: providers] | ||
| kilo agent manage agents | ||
| kilo upgrade [target] upgrade kilo to the latest or a specific version | ||
| kilo uninstall uninstall kilo and remove all related files | ||
| kilo serve starts a headless kilo server | ||
| kilo web start kilo server and open web interface | ||
| kilo models [provider] list all available models | ||
| kilo stats show token usage and cost statistics | ||
| kilo export [sessionID] export session data as JSON | ||
| kilo import <file> import session data from JSON file or URL | ||
| kilo github manage GitHub agent | ||
| kilo pr <number> fetch and checkout a GitHub PR branch, then run kilo | ||
| kilo session manage sessions | ||
| kilo plugin <module> install plugin and update config [aliases: plug] | ||
| kilo db database tools | ||
| kilo console open or stop the local Kilo Console | ||
| kilo cloud run Cloud Agent tasks | ||
| kilo roll-call <filter> batch-test text models matching a filter for connectivity and latency | ||
| kilo profile show Kilo account profile | ||
| kilo remote enable remote connection for real-time session relay | ||
| kilo daemon manage the local kilo daemon | ||
| kilo config configuration tools | ||
| kilo help [command] show full CLI reference | ||
|
|
||
| Positionals: | ||
| project path to start kilo in [string] | ||
|
|
||
| Options: | ||
| -h, --help show help [boolean] | ||
| -v, --version show version number [boolean] | ||
| --print-logs print logs to stderr [boolean] | ||
| --log-level log level [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"] | ||
| --pure run without external plugins [boolean] | ||
| --port port to listen on [number] [default: 0] | ||
| --hostname hostname to listen on [string] [default: "127.0.0.1"] | ||
| --mdns enable mDNS service discovery (defaults hostname to 0.0.0.0) | ||
| [boolean] [default: false] | ||
| --mdns-domain custom domain name for mDNS service (default: kilo.local) | ||
| [string] [default: "kilo.local"] | ||
| --cors additional domains to allow for CORS [array] [default: []] | ||
| -m, --model model to use in the format of provider/model [string] | ||
| -c, --continue continue the last session [boolean] | ||
| -s, --session session id to continue [string] | ||
| --fork fork the session when continuing (use with --continue or --session) [boolean] | ||
| --cloud-fork fetch session from cloud and continue locally (use with --session) [boolean] | ||
| --prompt prompt to use [string] | ||
| --agent agent to use [string] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[major]
_detect_surfacereadskilo --helpwithtext=True(strict decode), so on a POSIX /LANG=Clocale the modern 7.x banner raisesUnicodeDecodeError— which is not caught by(OSError, subprocess.SubprocessError)— and propagates out ofbuild_command/run()instead of falling back to modern.Failure scenario: CodeFrame runs under
LANG=C(the default on many Docker / slim base images, wherelocale.getpreferredencoding()isANSI_X3.4-1968= ASCII), kilocode 7.x — the supported floor — is installed, and a task starts via the kilocode engine.build_command→_detect_surface→subprocess.run([kilo, "--help"], text=True); kilo prints its Unicode banner (the first line of the checked-inhelp-7.4.17.txtis██ ██ ██🬺🬏 …), the strict ASCII decode raises on the first0xE2byte, and becausebuild_commandruns outsiderun()'stry/except(subprocess_adapter.py:145), the exception crashes the task with a traceback rather than running it. The PR's own tests miss this because_with_helpreturns an already-decodedstr, bypassing the decode step. Detection only needs the ASCII"kilo run"marker, soerrors="replace"is safe and never raises.