Skip to content

Add Continue (continue.dev) as a ucode harness - #428

Open
natefleming wants to merge 2 commits into
databricks:mainfrom
natefleming:feature/continue-dev-harness
Open

Add Continue (continue.dev) as a ucode harness#428
natefleming wants to merge 2 commits into
databricks:mainfrom
natefleming:feature/continue-dev-harness

Conversation

@natefleming

Copy link
Copy Markdown

Summary

Adds Continue (continue.dev) as a configurable ucode agent, so ucode configure --agents continue points it at the Databricks AI Gateway and ucode continue launches it — the same UX as the other agents. The generated ~/.continue/config.yaml is shared by the cn CLI and the Continue VS Code/JetBrains extensions, so configuring once wires up both.

The integration reuses existing patterns only — no new techniques:

  • Model config / auth mirrors the baked-token family (OpenCode/Copilot/Gemini/Pi): an OpenAI-compatible provider at the MLflow chat-completions gateway (/ai-gateway/mlflow/v1, which already serves Claude + gpt-5), chat/edit/apply roles, models drawn from the discovered Claude/GPT families, a baked bearer refreshed by a background thread, and OAUTH_TOKEN in the launch env. It is correctly excluded from GLOBAL_SETTINGS_AGENTS (Continue has no self-refresh hook; --use-pat bakes a long-lived PAT for IDE-first use).
  • MCP mirrors Cursor/OpenCode/Copilot: write_/remove_mcp_server_config register the shared ucode mcp-proxy stdio bridge into config.yaml's mcpServers list, wired into mcp.py's client registry and register/remove dispatch.
  • Revert mirrors Codex's shared-config handling: because Continue writes the user's real ~/.continue/config.yaml (read by the IDE), ucode revert surgically strips only ucode's own entries instead of whole-file restoring, so user-added models/servers are preserved.

The agent module is agents/continue_dev.py because continue is a Python keyword; the tool-name string stays continue.

Changes

  • New src/ucode/agents/continue_dev.py (model config, launch/validate, MCP hooks, surgical revert).
  • agents/__init__.py: _MODULES, aliases (continue/continue-dev/cn), configure_tool dispatch, check_gateway_endpoint, _TOOL_DISCOVERY_SOURCES.
  • cli.py: ucode continue launch command, discovery consumers, --agent help, and the surgical revert wiring.
  • databricks.py: build_continue_base_url sharing a _mlflow_chat_completions_base_url helper with Copilot.
  • mcp.py: MCP_CLIENTS entry + register/remove dispatch.
  • config_io.py: read_yaml_safe/write_yaml_file; add pyyaml dependency.
  • README: agent list, usage, --agents names, managed-files table, MCP-capable tools.
  • Tests: new tests/test_agent_continue.py; registry assertions in tests/test_agents_init.py.

Testing

  • uv run pytest green (the only failures locally are pre-existing e2e/PTY tests, unrelated to this change); ruff and ty clean.
  • Verified live against a Databricks workspace: configure discovers a Claude model and writes config.yaml; the validation step round-trips through the gateway; ucode continue launches cn; ucode revert surgically strips only ucode's entries (user models/servers preserved); and cn consumes the generated config and spawns the ucode mcp-proxy bridge.

Notes / follow-ups (out of scope)

  • IDE token durability: on an OAuth profile the baked token is short-lived and only refreshed while ucode owns the process; --use-pat addresses IDE-first use. A cleaner long-term fix is an upstream apiKeyHelper-style auth hook in Continue, or a localhost token-minting proxy.
  • autocomplete/embed/rerank roles are not wired (they need model types ucode does not discover today).

This pull request and its description were written by Isaac.

@natefleming
natefleming force-pushed the feature/continue-dev-harness branch from f8610f8 to 46d53fe Compare September 1, 2026 09:55
natefleming and others added 2 commits September 1, 2026 05:57
Configure and launch Continue's `cn` CLI (and, via the shared
~/.continue/config.yaml, the VS Code/JetBrains extensions) against the
Databricks AI Gateway, following the existing baked-token harness pattern.

- New `agents/continue_dev.py` (module name avoids the `continue` keyword;
  tool name stays "continue"): OpenAI-compatible provider at the MLflow
  chat-completions gateway, chat/edit/apply roles, discovered Claude/GPT
  models, baked bearer + background refresh + OAUTH_TOKEN env — the same
  strategy as OpenCode/Copilot/Gemini/Pi. Writes modern config.yaml.
- MCP parity: write/remove_mcp_server_config register the shared
  `ucode mcp-proxy` stdio bridge into config.yaml's mcpServers list, wired
  into mcp.py's client registry and register/remove dispatch (same pattern
  as Cursor/OpenCode/Copilot).
- Registration across the usual surfaces: _MODULES/aliases/dispatch/
  availability/discovery in agents/__init__.py, discovery consumers and
  want_claude/want_codex in cli.py, build_continue_base_url in databricks.py.
- YAML I/O helpers (read_yaml_safe/write_yaml_file) in config_io.py; add
  pyyaml dependency.
- Docs: README agent list, usage, --agents names, managed-files table, and
  MCP-capable tools list. New tests/test_agent_continue.py plus registry
  assertions in test_agents_init.py.

Verified live on FEVM: configure discovers system.ai.claude-sonnet-5, writes
config.yaml, validation round-trips through the gateway, and MCP register/
remove produce the documented schema without clobbering the models list.

Co-authored-by: Isaac <no-reply@databricks.com>
- Register the `ucode continue` launch command (was missing, so the
  documented entry point returned "No such command"); mirrors the other
  `ucode <agent>` launchers.
- Revert safety: Continue writes the user's shared ~/.continue/config.yaml
  (read by the IDE extensions), so `ucode revert` no longer whole-file
  restores it — it surgically strips only ucode's own model entries via
  continue_dev.revert_config(), mirroring Codex's shared-config handling.
  MCP entries are still removed by revert_mcp_configs.
- DRY: build_copilot_base_url and build_continue_base_url now delegate to a
  shared _mlflow_chat_completions_base_url helper (was a duplicated body).
- Remove dead render_config (only tests referenced it, risking drift); tests
  now assert on the production primitives _ucode_model_entry /
  _ensure_schema_header, and add revert_config coverage.
- Factor the ucode-model-entry match into _is_ucode_model, shared by the
  write and revert paths.

Verified: `ucode continue --help` resolves and a live headless
`ucode continue -- -p ...` launches cn on system.ai.claude-sonnet-5 through
the gateway. ruff + ty clean; 2171 unit tests pass (the 4 failures are the
pre-existing e2e/PTY tests).

Co-authored-by: Isaac <no-reply@databricks.com>
@natefleming
natefleming force-pushed the feature/continue-dev-harness branch from 46d53fe to a253e7f Compare September 1, 2026 09:57
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.

1 participant