Skip to content

feat(daemon): add Codebuddy Code CLI agent adapter#3961

Merged
Siri-Ray merged 5 commits into
nexu-io:mainfrom
aleexjiang:feat/codebuddy-adapter
Jun 11, 2026
Merged

feat(daemon): add Codebuddy Code CLI agent adapter#3961
Siri-Ray merged 5 commits into
nexu-io:mainfrom
aleexjiang:feat/codebuddy-adapter

Conversation

@aleexjiang

@aleexjiang aleexjiang commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Why

Codebuddy Code (https://www.codebuddy.cn) is a coding agent CLI with a stream-json interface compatible with Claude Code. Adding it as an agent adapter lets Open Design users choose Codebuddy as their runtime — useful for teams already on the Codebuddy platform or who want access to its multi-provider model roster (GLM, Claude, GPT, Gemini, DeepSeek, Kimi, MiniMax).

What users will see

  • Codebuddy Code appears as an available agent in the agent picker (Web / Desktop / CLI)
  • Selecting it spawns codebuddy -p with stream-json I/O, just like Claude Code
  • 16 model options are listed (default + 15 provider-specific)
  • --effort flag is supported for reasoning level control (minimal / low / medium / high / xhigh / max)

Surface area

  • CLI / env var — new CODEBUDDY_BIN env var for overriding the codebuddy binary path
  • None — no UI, API, i18n, or default behavior changes

Validation

  • pnpm -F @open-design/daemon test — 21 test files, 274 tests passed, 0 regressions
  • tsc -p tsconfig.json --noEmit — 0 errors
  • Manual: pnpm tools-dev start — Codebuddy Code shows as available agent with version: 2.103.1, available: true
  • Daemon API confirms: curl http://127.0.0.1:7456/api/agents returns the codebuddy entry with correct streamFormat, models, and path detection

@lefarcen lefarcen requested a review from mrcfps June 9, 2026 05:20
@lefarcen lefarcen added size/M PR changes 100-300 lines risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps type/feature New feature labels Jun 9, 2026
@lefarcen

lefarcen commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Hey @LikewindANDcloud! 👋 Thanks for putting this together — the adapter structure mirrors the established pattern cleanly, the test suite covers the important cases (session resume, --effort, --add-dir filtering, stream-format consistency), and the CODEBUDDY_BIN env var wiring in executables.ts slots in correctly alongside the other agents.

Heads-up — related open PR: PR #2022 (by @whinc) is also open and targets the same area — both PRs add Codebuddy Code support by touching defs/codebuddy.ts, registry.ts, executables.ts, and metadata.ts. The two have different scopes: #2022 is broader (also adds a UI icon + web app changes); this one is focused on the daemon layer. The maintainer team will decide which approach lands — sharing this so neither effort gets wasted. You two may want to compare notes.

Related feature request: This addresses the ask in #1138.

I've tagged size/M, risk/high, type/feature and requested a review from @mrcfps.

💡 To drive this PR to merge hands-free, paste this to your AI coding agent (Claude Code / Codex / opencode / Cursor …):
Take over nexu-io/open-design#3961 until it merges — read https://raw.githubusercontent.com/nexu-io/looper/main/skills/pr-takeover/SKILL.md and follow it.

@mrcfps mrcfps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@LikewindANDcloud Thanks for wiring Codebuddy into the runtime registry — the Claude-compatible adapter shape and coverage look solid overall. I found one merge-safe issue where the advertised reasoning control is implemented in buildArgs but not exposed end-to-end, so I left the concrete fix inline below.

🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.

Comment thread apps/daemon/src/runtimes/defs/codebuddy.ts Outdated
@lefarcen

lefarcen commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@LikewindANDcloud — @mrcfps has left a review with one concrete item to address before merge: the --effort forwarding in buildArgs needs a matching reasoningOptions declaration on the adapter def so that effort controls surface in the UI and the selected level survives API sanitization. The exact fix is in the inline comment. Patching that (plus the suggested round-trip test) should close out this review round.

@lefarcen lefarcen added size/L PR changes 300-700 lines and removed size/M PR changes 100-300 lines labels Jun 9, 2026
@lefarcen

lefarcen commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@LikewindANDcloud — the reasoningOptions declaration is in the new push, addressing @mrcfps's comment. The updated size label is size/L (+57 lines for the fix + round-trip tests). @mrcfps will need to re-review the new head — the prior review was against the old commit.

@mrcfps mrcfps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@LikewindANDcloud Thanks for the follow-up pass — the new reasoningOptions declaration fixes the original sanitization gap, and I re-checked the updated Codebuddy adapter/test coverage on this head. I found one merge-safe follow-up around how the new effort list maps into the existing picker UX, so I left it inline below.

🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.

Comment thread apps/daemon/src/runtimes/defs/codebuddy.ts Outdated
@lefarcen

lefarcen commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@LikewindANDcloud — @mrcfps confirmed the reasoningOptions fix from the last push looks correct. One more inline comment to address: without a synthetic default sentinel, UI pickers fall back to reasoningOptions[0] (= minimal) when nothing is saved, and there's no way to clear back to "omit --effort" from normal flows. Two paths @mrcfps suggests: (a) add {id: 'default', label: 'Default'} to the reasoningOptions list and continue suppressing --effort in buildArgs when options.reasoning === 'default' — same pattern as the model picker; or (b) update AvatarMenu + SettingsDialog to expose an explicit "Default / use Codebuddy default" entry that round-trips to null. The details with the exact file references are in the inline comment.

@mrcfps mrcfps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@LikewindANDcloud I re-checked the updated Codebuddy adapter end-to-end: the runtime is registered, executable override/install metadata are wired, and the new reasoning sentinel/tests cover the picker fallback so --effort round-trips without forcing a value by default. I also inspected the changed daemon/test ranges on this head and did not find any actionable correctness or maintainability issues. Thanks for the careful follow-up here 🚀

🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.

@lefarcen

lefarcen commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@LikewindANDcloud — @mrcfps has approved this head 🎉 Both review threads are resolved: reasoningOptions is declared with the default sentinel in place, and the round-trip tests verify the full flow. Waiting on CI to go green — once that clears, this is in the merge queue. Good work iterating through the feedback rounds cleanly.

@lefarcen

lefarcen commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Hey @LikewindANDcloud — quick update: CI just came back with two failures on the current head, so it's blocking merge even though @mrcfps's approval is in. 🔴

Failing checks:

Worth opening the Preflight log first — it usually surfaces the root cause, and the Validate workspace failure often follows from the same issue. Once both are green, this is in the merge queue.

@mrcfps mrcfps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@aleexjiang I re-checked the new Codebuddy adapter head across the changed daemon/test ranges: the runtime is registered, the CODEBUDDY_BIN override and install/docs metadata are wired, and the default reasoning sentinel keeps the picker/default-path behavior aligned with buildArgs so --effort only appears for real effort levels. I also reviewed the added Codebuddy-focused test coverage and did not find any actionable correctness, safety, or maintainability issues in the scoped diff. Thanks for iterating through the follow-ups cleanly 🚀

🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.

@lefarcen

lefarcen commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Hey @aleexjiang — new push landed and @mrcfps has already reviewed this head (APPROVED ✅). CI is still running; once that turns green, this is in the merge queue with nothing else blocking. Hang tight!

aleexjiang added 5 commits June 10, 2026 10:41
Add Codebuddy Code (codebuddy/cbc) as a supported agent runtime.

- New adapter def in runtimes/defs/codebuddy.ts based on the Claude Code
  adapter pattern (compatible stream-json format, stdin prompt, MCP
  injection via .mcp.json, session resume)
- Supports --effort flag for reasoning level control (minimal..max)
- 16 model options across GLM, Claude, GPT, Gemini, DeepSeek, Kimi,
  MiniMax providers
- Registered in daemon agent registry
- Added CODEBUDDY_BIN env var override in executables
- Added install/docs URLs in metadata
- Full test suite (19 tests) in codebuddy.test.ts

All 274 runtime tests pass with 0 regressions.
…nd-trip

The buildArgs handler accepted options.reasoning but the adapter never
declared reasoningOptions, causing the daemon API sanitizer to drop the
effort level before spawn and the web UI to hide reasoning controls.

- Add reasoningOptions (default/minimal/low/medium/high/xhigh/max) to
  the adapter definition, matching the Codebuddy CLI --effort flag.
- Add round-trip tests: valid reasoning survives sanitization and lands
  in argv; every declared option maps to a correct --effort flag.

All 279 runtime tests pass (279 passed | 1 skipped).
The previous commit incorrectly included a "default" level in
reasoningOptions. Codebuddy CLI --effort actually supports exactly
6 levels: minimal, low, medium, high, xhigh, max. Omitting --effort
entirely is how you get the default behavior — there is no
"--effort default" flag.

- Remove "default" from reasoningOptions (was never a valid --effort value)
- Update tests: list now matches [minimal, low, medium, high, xhigh, max]
- Round-trip test no longer skips any declared option

All 279 runtime tests pass.
The previous push removed the synthetic "default" entry, but the web
pickers (AvatarMenu / SettingsDialog) fall back to reasoningOptions[0]
when no value is saved yet. Without a default sentinel:

- The implicit selection became "minimal" instead of "let Codebuddy decide"
- Users had no way to clear back to omit-the-flag (the <select> had no
  empty/default entry)

Restore "default" as the FIRST option and treat it as a sentinel in
buildArgs: any value !== "default" gets passed via --effort, while
"default" (and unset) means no --effort flag.

- Adapter: re-add { id: default, label: Default } at the head of the list
- Adapter: buildArgs guards with options.reasoning && options.reasoning !== "default"
- Tests: round-trip suite now covers both branches; new test asserts the
  default sentinel does NOT emit --effort and that it is the first option.

281 runtime tests pass (was 279).
The Preflight CI step runs tsc -p tsconfig.tests.json --noEmit which
has stricter undefined narrowing than tsconfig.json. The expression
`codebuddyAgentDef.reasoningOptions![0].id` triggered TS2532
("Object is possibly undefined") because the non-null assertion only
covers the property access, not the array indexing result.

Split the chain into a local variable with an explicit toBeDefined()
assertion before the .id access. Same runtime semantics, no more
TS2532 in strict mode.

26 codebuddy tests still pass.
@aleexjiang aleexjiang force-pushed the feat/codebuddy-adapter branch from de906f4 to 7b3d277 Compare June 10, 2026 02:43
@lefarcen lefarcen added needs-validation Runtime change detected; needs human or /explore agent validation. and removed needs-validation Runtime change detected; needs human or /explore agent validation. labels Jun 11, 2026
Merged via the queue into nexu-io:main with commit 3ec8f8f Jun 11, 2026
17 checks passed
@open-design-bot

Copy link
Copy Markdown
Contributor

🎉 📡 You just leveled up to Giotto

Giotto card for @aleexjiang

📡 ✨ Sending steady signals.

🙌 Your contributions send a clear signal across the network: you care about making Open Design better.

💛 Thanks for helping Open Design move forward. Keep building in the open. 🚀


📊 Rank #198 among 198 contributors.

🔗 Share on X (English) · 分享到 X(中文)

@lefarcen lefarcen mentioned this pull request Jun 11, 2026
@kokisanai

Copy link
Copy Markdown
Contributor

Hi @aleexjiang!

Your first Open Design PR has been merged! Huge thanks for jumping in and improving the project!

You contributed:

Merged PR: #3961 feat(daemon): add Codebuddy Code CLI agent adapter
#3961

Your first contribution added a new CLI agent adapter, so we picked follow-up issues that stay close to runtime and local-tooling behavior.

For your next contribution, we picked two issues that look like a good follow-up:

  1. Hide raw local executable paths from Live Artifact running status UI #2874 Hide raw local executable paths from Live Artifact running status UI
    Hide raw local executable paths from Live Artifact running status UI #2874

This fits well because it stays in the local-agent/runtime surface and improves how local tooling details are presented.

  1. Feature request: allow users to configure artifact storage directory #1772 Feature request: allow users to configure artifact storage directory
    Feature request: allow users to configure artifact storage directory #1772

This is a good follow-up if you want to keep working on the local runtime and artifact-management path.

If one of these looks interesting, feel free to comment /claim on the issue and we will help you get started!

Once your second PR gets merged, you will move into our Continuous Contributor tier. We are also starting to highlight repeat contributors more actively in the community, so this is a great time to keep going!

Thanks again for the first PR, and welcome to the Open Design contributor community!

The Open Design team

P.S. We hang out in Discord — come say hi: https://discord.gg/3C6EWXbdQQ
There's a #contributors channel where folks share what they're working on.\n

@lefarcen

Copy link
Copy Markdown
Contributor

Hey @aleexjiang — huge thanks again for landing this. The Codebuddy adapter ended up nicely scoped: runtime registration, CODEBUDDY_BIN override wiring, and the reasoning/default-path round-trip all came through cleanly by the end.

And the follow-up suggestions above are on-point: if you feel like staying in the same local-runtime lane, #2874 and #1772 are both good next areas to explore.

Really appreciate the contribution 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps size/L PR changes 300-700 lines type/feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants