6 Commits

Author SHA1 Message Date
AleFlyX
b1ea6c02fb fix(llm): name a reason when a local SDK turn fails with no text
The Claude Code and CodeBuddy providers report failure as
finish_reason="error" with the reason carried in the result message's
text. The CLI only fills that text when the turn produced assistant
output, so a turn that dies on a rejected tool call or on max_turns ended
empty and reached the operator as a bare "Error calling Claude Code: "
with nothing after the colon (#2539).

- sdk_bridge: render a blank result through a new _result_detail(), which
  keeps the CLI's own wording when present, maps the SDK's subtype
  (error_max_turns / error_during_execution / error_max_budget_usd) to a
  sentence, and never returns an empty string.
- claude_code / codebuddy providers: _friendly_error() names the exception
  type for a blank exception instead of echoing nothing.

Both SDK backends share the bridge, so one fix covers both.
2026-11-09 16:20:28 +08:00
RRFZ
f50d2ff4b9 fix(llm): sync CodeBuddy models when the CLI path has a space on Windows
On Windows, fetch_codebuddy_models ran the CLI as
["cmd.exe", "/d", "/s", "/c", list2cmdline(cli_args)]. The inner
list2cmdline quotes a path with a space, and the outer one (asyncio
joining the argv) escapes those quotes as \", which cmd.exe does not
understand. With the npm shim under C:\Users\John Smith\AppData\Roaming
the sync failed with "is not recognized as an internal or external
command".

Run the shim directly, as on POSIX; Windows starts a .cmd through
cmd.exe itself. The creation flags are kept.
2026-10-31 21:46:01 -04:00
Bingxi Zhao (Frank)
ebcec14c1d fix(llm): bound Claude session lifecycle and share SDK wire adaptation 2026-10-29 01:09:09 +08:00
Bingxi Zhao (Frank)
d967457e69 fix(codebuddy): omit SDK exception bodies from warning logs 2026-10-07 20:39:30 +08:00
evan188199-tech
0802510450 fix: log silently swallowed failures in five services (#1707)
* fix(codex): log a warning when token revocation fails during logout

Logout previously swallowed revocation failures silently, leaving the
remote token possibly valid with no operator trace. Log only the error
kind and HTTP status (never credential material) and keep clearing the
local credentials as before.

* fix(llm): warn when CodeBuddy tool-call interrupt or drain fails

A silent except-pass after receiving tool_calls let the SDK keep
generating in the background when interrupt() failed, quietly draining
quota. Log a warning (exception type + short reason) for interrupt and
drain failures; return value semantics unchanged.

* fix(memory): log corrupt snapshot files instead of skipping silently

read_notebook_entities / read_cowriter_entities / read_book_entities
swallowed (OSError, json.JSONDecodeError) with a bare continue, so a
corrupt notebook file or manifest silently dropped content from the
memory snapshot. Each skip now logs a warning with the file path and
reason (no file content); snapshot results are otherwise unchanged.

* fix(notebook): log unreadable files instead of skipping them silently during index rebuild

* fix(question): log failed error-event delivery in mimic websocket

The mimic generation error handler swallowed secondary failures of the
error send_json with a bare 'except Exception: pass', so a delivery
failure left the frontend without any reason and nothing in the logs.
Split the handler: closed/disconnecting clients (RuntimeError,
WebSocketDisconnect) stay debug-level, any other send failure is logged
as a warning with traceback. Cleanup paths keep their best-effort
narrow handling. Focused tests cover both branches.

* test(codebuddy): make credential fixture expiry relative to now

test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.

Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-10-07 20:37:27 +08:00
Ching Wing Kwok
8297fc7b7e feat(provider): add codebuddy as a LLM provider (#780)
* feat: add codebuddy provider

* fix: treat codebuddy as login-backed provider

* feat: sync codebuddy account models

* fix: ignore no-key placeholder for codebuddy

* feat: add codebuddy web login

* fix: streamline codebuddy settings and latency

* fix: support switching codebuddy accounts

* fix: preserve codebuddy sessions and tool calls

* feat: use CodeBuddy HTTP provider over Agent SDK

Chat with CodeBuddy over plain HTTP by reusing the login state that the
IDE plugin / CLI stores on disk, instead of bundling the ~130MB Agent SDK.

- add codebuddy_http_provider (OpenAI-compatible /chat/completions on
  <endpoint>/v2) with codebuddy_credentials for local OAuth session reuse
- provider_factory picks HTTP transport whenever a login state or API key
  is available; Agent SDK stays as fallback for CLI agent features
- demote codebuddy-agent-sdk from core deps to optional codebuddy extra
- default model codebuddy/default -> codebuddy/hy3
- update auth card UX and locales for SDK-less sign-in flow

* chore: label codebuddy provider as codebuddy/workbuddy in the dashboard

* style: apply pre-commit formatting after upstream merge

* chore: capitalise codebuddy provider label as CodeBuddy/WorkBuddy

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-13 00:02:42 +08:00