Skip to content

Add oh-my-pi (omp) as a supported coding agent - #513

Open
zhulinchng wants to merge 4 commits into
databricks:mainfrom
zhulinchng:feature/omp-support
Open

zhulinchng wants to merge 4 commits into
databricks:mainfrom
zhulinchng:feature/omp-support

Conversation

@zhulinchng

@zhulinchng zhulinchng commented Sep 7, 2026 •

Copy link
Copy Markdown

What

ug can now configure, launch, validate, and register MCP servers for oh-my-pi (omp, @oh-my-pi/pi-coding-agent), alongside the existing pi entry: ug configure --agents omp, ug omp, ug doctor, ug status, and ug revert all cover it.

The branch is rebased onto current main (226 commits of drift since it was cut) with the merge conflicts resolved, and the implementation is re-laid on main's structures — see "Rebase notes".

How

  • New agents/omp.py (mirrors pi.py, no shared abstraction): isolated ~/.ucode/omp-home/.omp/agent, YAML models.yml with the three Databricks providers (anthropic-messages / openai-responses / google-generative-ai), default model pinned via modelRoles.default in config.yml (models.yml root must be providers-only per omp's schema), --print validation, and {command, args}-only MCP entries (omp's stdioServer forbids other keys).
  • Auth follows pi.py on current main: each provider's apiKey is the !ug auth-token … command value, so omp mints a token on demand and re-runs the command when the gateway answers 401. Nothing that expires is written to models.yml and no refresh thread runs.
  • Registry, discovery, launch, state, and MCP wiring; base_urls["omp"]; MCP backup restore on revert. No OAUTH_TOKEN (omp never reads it).
  • pyyaml becomes a direct dependency, with read_yaml_safe / write_yaml_file in config_io matching the JSON/TOML readers' contract. uv.lock is left as main has it: the committed lock pins Databricks' internal pypi-proxy, which the machine that produced this diff can't reach, and CI re-locks (uv lock) before installing — any local uv lock / uv run adds the pyyaml entry.
flowchart LR
    C[ug configure --agents omp] --> W[agents/omp.write_tool_config]
    W --> M["models.yml: providers + apiKey: '!ug auth-token …'"]
    W --> D[config.yml: modelRoles.default]
    L[ug omp] --> O[omp binary<br/>PI_CODING_AGENT_DIR=omp-home]
    O -->|runs apiKey command| A[ug auth-token]
    A --> G[AI Gateway<br/>anthropic/codex/gemini]
    P[ug configure mcp] --> J[omp-home mcp.json<br/>ug mcp-proxy stdio]
Loading

Rebase notes

  • Auth now matches pi.py: !ug auth-token … command value instead of a baked bearer + background refresher.
  • Validation was removed from ug (no validate_all_tools), so the branch's validation hunks and validate_env are gone; validate_cmd stays for the live e2e entry point.
  • Managed config: the PR originally excluded omp from the setup wizard. Wizard-side authoring was replaced on main, and the server's CodingAgent proto has no omp variant, so omp stays out of managed config end to end; _AGENT_MODEL_FAMILIES["omp"] mirrors pi so any residual picker path can't diverge.
  • MCP: main batches managed MCP writes per client (_MCP_CLIENT_MODULES → write_user_mcp_servers), which omp now implements; _run_mcp_list returns None for clients without a listing subcommand instead of raising KeyError.

Verification

  • just lint (ruff check + ruff format --check + ty) clean.
  • Full unit suite (pytest --ignore=tests/test_e2e.py): 3478 passed, 6 skipped; the 11
    failures are pre-existing in this sandbox and reproduce on a clean origin/main worktree
    (7 test_claude_pty_replay + 2 test_claude_smart_routing_v2 need to bind a local socket,
    2 test_e2e_user_agent need a live gateway).
  • Live against omp 18.8.0: omp models loads a ug-written agent dir and lists all three databricks-* providers with the configured model ids.
  • Live auth path against a localhost capture server: omp executes the !command apiKey and sends Authorization: Bearer <command output>; the User-Agent ug writes arrives on the openai-responses and google-generative-ai providers. For anthropic-messages omp pins its own claude-cli/<version> UA (Claude Code's client fingerprint), same as it does for the built-in anthropic provider.
  • ug omp --help, the help panel's Launch section, and ug status render with omp registered.

Non-goals

Managed-config support (server proto has no omp variant), OSS models, live e2e additions.

@rohita5l

Copy link
Copy Markdown
Collaborator

@zhulinchng could you rebase with main ?

@rohita5l

Copy link
Copy Markdown
Collaborator

/ug-review

@rohita5l

Copy link
Copy Markdown
Collaborator

/integration-test

@github-actions

Copy link
Copy Markdown

UG review

The change adds omp launch, YAML configuration, authentication commands, MCP integration, and revert handling. Key risks are configuration loss, interactive signal handling, and dependency-lock consistency.

Blocker

  • Preserve YAML contents on read failures — src/ucode/agents/omp.py:239: can we skip rewriting existing YAML when parsing fails, rather than replacing config.yml with only modelRoles.default and losing unrelated settings?

Major

  • Update the dependency lockfile — pyproject.toml:26: can we regenerate uv.lock alongside this dependency so uv sync --locked can install the checkout without rejecting the stale lockfile?
  • Use the shared terminal handoff — src/ucode/agents/omp.py:284: can we use launcher.exec_or_spawn so ctrl-c during ug omp --print isn't delivered twice, once by the terminal and again here?

Some patches were unavailable or truncated to fit the review context. Treat this as a partial review.

Automated advisory review of 0799ecda85d1 using Lilly's UG review rubric. It does not approve or block this PR.

@github-actions

Copy link
Copy Markdown

@zhulinchng

Copy link
Copy Markdown
Author

@zhulinchng could you rebase with main ?

hi @rohita5l , i've rebased

ug can configure, launch, and register MCP servers for oh-my-pi (`omp`,
@oh-my-pi/pi-coding-agent), alongside the existing pi entry.

- agents/omp.py writes a private ~/.ucode/omp-home/.omp/agent/models.yml with
  the three Databricks providers (anthropic-messages / openai-responses /
  google-generative-ai) and pins the default model via `modelRoles.default` in
  config.yml (models.yml root must stay providers-only per omp's schema).
- Each provider's apiKey is the `!ug auth-token ...` command value, so omp mints
  a token on demand and re-runs the command when the gateway answers 401 —
  nothing that expires is written to models.yml and no refresh thread runs.
- MCP servers register through omp's agent-dir mcp.json ({command, args} only,
  per omp's stdioServer schema), including the batched write_user_mcp_servers
  path that the workspace-managed MCP flow uses.
- Registry, discovery, launch (`ug omp`), state, revert, and README coverage;
  pyyaml becomes a direct dependency for config_io's YAML readers/writers.
@zhulinchng

Copy link
Copy Markdown
Author

@rohita5l - any plans to add support for omp to unity gateway?

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