Repository navigation
feat(provider): add codebuddy as a LLM provider - #780
Merged
Merged
Conversation
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
…ider # Conflicts: # web/components/settings/ServiceConfigEditor.tsx
Merges dev and reworks this branch against what an adversarial pass found. **The administrator's subscription was grantable.** A CodeBuddy credential is one person's IDE-plugin login read from this host, exactly the shape HKUDS#690 ruled must never be lent out — but ``owner_bound`` is stamped on the *managed* profile Codex publishes, and a CodeBuddy profile is created by hand in the settings editor with nowhere to acquire it. Binding now decides too (``OWNER_BOUND_BINDINGS``), so the profile is never offered in the grant editor. **The agent sandbox failed open.** ``_build_options`` probed ten candidate kwarg sets and returned the first the SDK accepted; six of them carry no ``permission_mode`` and no turn limit. An SDK that renamed those kwargs would silently fall through to an unrestricted agent. Every candidate now carries them — both spellings — and exhausting the list raises. The extra is pinned ``<0.2`` so a minor bump cannot reintroduce the fall-through, and dropped from ``all`` (it vendors a ~130 MB headless CLI that chat does not need). **A local file chose where the token was sent.** ``cached_product_endpoint`` accepted any string starting with ``http`` out of another application's cache blob. Anything able to write under the service account's home could point the bearer token at a host of its choosing. Restricted to https on the two known deployments; an operator who needs another still sets ``CODEBUDDY_BASE_URL``, which is honoured first. **Logout ended a session DeepTutor does not own.** It called the SDK's logout against the auth file the IDE plugin and CLI share, signing the operator out of their editor. It now drops our cached clients and reports where the session actually lives. **A phone number was a display label.** ``user_label`` fell back to ``phoneNumber``, returned verbatim by the status endpoint to every admin. Also: keep the usage-extraction change from wiping real token counts when a gateway echoes a zero-filled usage object on delta chunks (it applies to every openai_compat provider, not just this one); replace the two ``binding == "codebuddy"`` tests in the chat loop and the explore capability with a ``threads_session_id`` predicate, so generic code no longer names a provider; and revert 33 files whose only change was a Prettier reformat in the opposite direction from the 3.8.3 the repo pins — they would have made the next contributor's ``pre-commit run --all-files`` touch 33 unrelated files.
pancacake
added a commit
that referenced
this pull request
Aug 12, 2026
An adversarial pass over #818 / #789 / #780 after merging. **Codex sign-ins from before this week stopped working (#789).** ``validate_runtime_profile`` compared the profile's ``codex_account_binding`` for equality, but that key is written only by ``sync_codex_catalog`` — every managed profile published by #690/#774 has none, so ``None != <hash>`` made each of them look like another account's and locked its owner out of Codex until they re-ran "Refresh models". Absent now reads as legacy; a binding that is present and different is still an account switch and still refused. **Overriding reasoning effort for one turn returned 409 (#789).** The same function also required the request's effort to be byte-equal to the value stored in the catalog. Effort is a per-request knob, not part of the identity that ties a config to a token — the check now stops at model membership. Its test asserted the old behaviour and has been rewritten around what the function is actually for. **The reasoning-effort endpoint left the runtime caches stale (#789).** It writes the catalog the runtime resolves against, like every other catalog write in this router, but skipped ``_invalidate_runtime_caches()``. **OrcaRouter claimed Anthropic prompt caching (#818).** ``supports_prompt_caching`` makes ``_build_kwargs`` inject ``cache_control`` blocks into any ``anthropic/*`` or ``claude*`` request — an OpenRouter extension. No other gateway sets it and nothing established the second one accepts it; a strict gateway would 400 every Claude turn. Also fixed ``anthropic/claude-sonnet-4.6`` in the fallback list, which the rest of the repo spells with dashes, so a user picking it from our own menu would have got "model not found". **OrcaRouter inserted itself into the curated menus (#818).** The featured lists are hand-picked and rendered as a positional numbered menu, so adding an entry shifted Ollama from [10] to [11]. The registry entry alone already makes a provider reachable via "Show all" and the Settings dropdown; which providers are featured is a maintainer decision. The README paragraph goes with it — no other provider has per-provider prose there, and it would have been translated into ten languages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds CodeBuddy/WorkBuddy as an LLM provider in DeepTutor, allowing users to use their existing CodeBuddy subscription quota.
The integration reuses the OAuth login already created by the CodeBuddy IDE plugin or CLI and sends normal chat-completion requests directly to CodeBuddy's OpenAI-compatible HTTP endpoint. The Agent SDK is optional and is retained only as a fallback for interactive login and SDK-specific agent behavior.
Screenshot
What This PR Does
Direct HTTP provider
/v2endpoint.
Local credential reuse
Related Issues
Closes #773
Module(s) Affected
agentsapiconfigcoreknowledgeloggingservicestoolsutilsweb(Frontend)docs(Documentation)scriptstests...Checklist
pre-commit run --all-filesand fixed any issues.