Skip to content

Add Kilo CLI as an agent provider - #901

Open
djcelis wants to merge 4 commits into
databricks:mainfrom
djcelis:add-kilo-agent
Open

djcelis wants to merge 4 commits into
databricks:mainfrom
djcelis:add-kilo-agent

Conversation

@djcelis

@djcelis djcelis commented Sep 29, 2026

Copy link
Copy Markdown

Adds Kilo CLI (@kilocode/cli) as a first-class coding agent, run with ug kilo and configurable with ug configure --agent kilo. Kilo is a fork of OpenCode (already supported), so this reuses the existing discovery pipeline and mirrors agents/opencode.py.

Couple notes:

  • shared discovery, consuming the existing opencode_models
  • minimum version was pinned to 7.3.1, tested empirically - 7.2.1 does not fire the plugin hook, 7.2.25 works, but I decided to skip the 7.2.x series because it looks like a noisy patch series.
  • config is isolated via KILO_CONFIG so a user's own Kilo config never bleeds into a ug-launched session.

Verification done:

  • tested against a real databricks workspace with ug configure --agent kilo, followed by ug kilo which picks up the workspace url, connects to unity gateway and launches kilo ("Launching Kilo with Unity Gateway" -> "Starting Kilo").
  • new unit tests in tests/test_agent_kilo.py — 61 passed.

@rohita5l rohita5l left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Launch works and the Kilo module is a clean copy of the OpenCode one, but the PR only covers configure and launch. The main gaps are MCP not connected (Kilo sessions get no MCP servers because of KILO_CONFIG isolation) and ug status showing no models. The inline comments also cover a small OpenCode default leaking into Kilo, plus test and comment cleanups.

Locally, all 61 tests in test_agent_kilo.py pass. test_cli.py, test_agents_init.py and test_agent_opencode.py show the same failures on this branch as on its base commit, so the PR doesn't add any.

Comment thread src/ucode/agents/kilo.py
Comment thread src/ucode/cli.py
Comment thread src/ucode/agents/kilo.py Outdated
Comment thread src/ucode/cli.py
Comment thread src/ucode/agents/kilo.py Outdated
Comment thread tests/test_agent_kilo.py Outdated
Comment thread tests/test_agent_kilo.py Outdated
Comment thread src/ucode/agents/kilo.py Outdated
Comment thread src/ucode/agents/kilo.py
Comment thread src/ucode/agents/kilo.py Outdated
@djcelis
djcelis force-pushed the add-kilo-agent branch 2 times, most recently from 2283133 to b942310 Compare October 2, 2026 15:38
@djcelis

djcelis commented Oct 2, 2026

Copy link
Copy Markdown
Author

@rohita5l Force-pushed to fold the review fixes into a single commit (b942310), replacing the earlier one — apologies for the rewrite. Will provide replies to each of the comments.

Kilo (@kilocode/cli) is an OpenCode fork sharing config schema, provider
model, and plugin system. This adds a kilo agent module that reuses the
shared opencode_models discovery, isolates config via KILO_CONFIG, gates
on kilo >= 7.3.1, and spawns via subprocess_cross_os.popen for Windows
npm-binary resolution.
…w models

Isolation (core fix): switch Kilo config isolation from KILO_CONFIG to
XDG_CONFIG_HOME. Re-probing kilo 7.3.1 showed KILO_CONFIG is NOT exclusive —
it merely merges on top of the user's real ~/.config/kilo. XDG_CONFIG_HOME is
true isolation: Kilo reads only $XDG_CONFIG_HOME/kilo/, ignores the user's
real config, still discovers the plugin, and fires the config() hook (token
refresh works). Verified on 7.3.1/7.4.1.

MCP: wire Kilo into mcp.py (import, MCP_CLIENTS table, configure/remove
dispatch, _MCP_CLIENT_MODULES, and _managed_mcp_entry), mirroring OpenCode.
Live testing then surfaced two further gaps, now fixed:
  - `ug mcp list` ran `kilo mcp list` without the isolation env, so Kilo read
    the empty ~/.config/kilo and every server showed "missing". Added
    _kilo_cli_env() pinning XDG_CONFIG_HOME (mirrors _gemini_cli_env).
  - _parse_health_mcp_list did not understand Kilo's `●  ✓ name connected`
    tree output. Added a Kilo-scoped _parse_kilo_mcp_list. (The same gap
    affects OpenCode today; should be tracked as a separate follow-up.)
Verified end-to-end: `ug mcp add --agents kilo` registers servers in the
isolated config, `ug mcp list --agents kilo` reports connected/failed
status, and a `ug kilo run` invoked system.ai.dbsql.execute_sql successfully.

Status: _status_models/_status_default_model surface Kilo's models,
which it shares with OpenCode under opencode_models.

Cleanups:  collapse the duplicate KILO_CONFIG_INNER_DIR constant; remove the
dead opencode_default_model branch in default_model(); add an actionable hint
when no models are discovered; add Kilo to the --agent help text, help
command order, and token-refresh launch note. Remove inaccurate comments;
correct the version-floor comment.

Tests: assert XDG isolation (XDG_CONFIG_HOME set; KILO_CONFIG not set), add
Kilo MCP dispatch + status-env + tree-parse coverage, fix the shared
base_urls key to "opencode", use 7.3.1 version, drop the oc_mod
alias, and correct the default-model test to the bucketed-derivation behavior.
Pzharyuk pushed a commit to Pzharyuk/unity-gateway that referenced this pull request Oct 8, 2026
`Windows installation tests` logs in to JFrog with a GitHub OIDC token
(`id-token: write`). Pull requests from forks never get one, so the job
failed on every fork PR (for example databricks#901: "Unable to get
ACTIONS_ID_TOKEN_REQUEST_URL env variable").

- Add the same fork guard the other credentialed integration jobs use.
- Make the fork rule explicit in `tests/test_integration_contract.py`.
It lists `SKIPPED_ON_FORK_PRS` and derives each job's real fork behavior
from the workflow, through its own guard or a skipped `needs`. The test
fails if:
  - the list drifts from the workflow;
  - any job that runs on forks uses secrets or OIDC.

  Dropping the new guard fails the test.

Follow-up from the same thread, not in this PR: a way for fork PRs to
run the credentialed suites after a team member approves or adds a
label.

This pull request and its description were written by Isaac.

Co-authored-by: Isaac <no-reply@databricks.com>
@rohita5l
rohita5l enabled auto-merge October 9, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants