refactor(agent-core-v2): remove the legacy kosong request layer - #352
Merged
Merged
Conversation
…t path OpenCode Go rejects requests without a stable per-conversation session id. The header was only built in the legacy kosong requester, which the engine no longer uses, and even there it read a conversationId that turns never set. Derive the header from the session cache key in the live llm-adapter requester and give the connectivity probe a random session id.
Route every importer to llm-adapter and #human, then delete src/kosong. Port the features that only lived in the legacy copy: OpenCode billing rejections are provider errors, DSML/Hermes text tool calls are recovered on the OpenAI stream, and modelRecordProviderId. The auth and env-overlay checks now read the full provider-definition registry, so vendor API keys and base URLs in a provider env table are honored.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: Repository: PyModel/pythinker-code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (98)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
…y-kosong # Conflicts: # packages/agent-core-v2/src/kosong/model/modelRequesterImpl.ts
elkaix
enabled auto-merge (squash)
October 1, 2026 23:15
Merged
elkaix
pushed a commit
that referenced
this pull request
Oct 1, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @pymodel/pythinker-code@2.4.1 ### Patch Changes - [#352](#352) [`772e69a`](772e69a) Thanks [@elkaix](https://github.com/elkaix)! - Run tool calls that some models (such as DeepSeek) write as DSML or <tool_call> text instead of showing them as plain text. - [#352](#352) [`772e69a`](772e69a) Thanks [@elkaix](https://github.com/elkaix)! - Report an insufficient-balance response from OpenAI-compatible providers as a billing error instead of an authentication error. - [#349](#349) [`69cc714`](69cc714) Thanks [@elkaix](https://github.com/elkaix)! - Fix OpenCode Go requests failing with "Request is missing x-opencode-session". - [#352](#352) [`772e69a`](772e69a) Thanks [@elkaix](https://github.com/elkaix)! - Accept a vendor API key or base URL set in a provider's env table (for example ANTHROPIC_API_KEY or ANTHROPIC_BASE_URL) instead of ignoring it. ## @pymodel/pythinker-web@0.2.0 ### Minor Changes - [#347](#347) [`bca1910`](bca1910) Thanks [@elkaix](https://github.com/elkaix)! - Align the embedded terminal palette and workflow panel motion with the shared design token system. - [#347](#347) [`bca1910`](bca1910) Thanks [@elkaix](https://github.com/elkaix)! - Show estimated changed-line counts for large edits in session transcripts and file summaries instead of zero. - [#347](#347) [`bca1910`](bca1910) Thanks [@elkaix](https://github.com/elkaix)! - Use the shared type scale and corner radii on application surfaces. ## @pymodel/pythinker-desktop@1.5.1 ### Patch Changes - [#352](#352) [`772e69a`](772e69a) Thanks [@elkaix](https://github.com/elkaix)! - Run tool calls that some models (such as DeepSeek) write as DSML or <tool_call> text instead of showing them as plain text. - [#352](#352) [`772e69a`](772e69a) Thanks [@elkaix](https://github.com/elkaix)! - Report an insufficient-balance response from OpenAI-compatible providers as a billing error instead of an authentication error. - [#349](#349) [`69cc714`](69cc714) Thanks [@elkaix](https://github.com/elkaix)! - Fix OpenCode Go requests failing with "Request is missing x-opencode-session". - [#352](#352) [`772e69a`](772e69a) Thanks [@elkaix](https://github.com/elkaix)! - Accept a vendor API key or base URL set in a provider's env table (for example ANTHROPIC_API_KEY or ANTHROPIC_BASE_URL) instead of ignoring it. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Requirement or Bug
Remove the legacy
packages/agent-core-v2/src/kosongrequest layer. Port the features that existed only there and fix the bugs it caused. Stacked on #349.Bug Reproduction Steps
type = "openai"andenv = { OPENAI_API_KEY = "sk-..." }, with noapiKeyand no process env key.AuthTokenMissingError, even though the request path would find the key.Root Cause
20 of the 62 files under
src/kosongstill loaded at runtime throughapp/auth/*andapp/kosongConfig/*. kosong keeps its own provider-definition map, and at runtime that map held only the pythinker definitions, because the standard definitions never loaded. SoresolveModelAuthMaterial/resolveModelForReady(auth check) andenvOverlay(vendor*_BASE_URL) ignored provider-envvalues for every non-pythinker provider. Real requests usellm-adapterand find them. This is a fundamental fix: one provider-definition registry, the live one.Code Changes
src/kosong(61 files, about 11k lines). The 19 importers now import the same symbols from#/llm-adapter/*(types are identical apart from the import path).provider.auth_error. Ordinary 401s stay auth errors.modelRecordProviderIdmoved tollm-adapter/model/model.ts.apps/visimports@pymodel/agent-core-v2/llm-adapter/contract/tokensinstead of thekosongsubpath.scripts/check-identity-freeze.mjsdrops the deleted kosong path.PYTHINKER_CODE_HOME.The default-model fallback that also lived only in kosong is not restored: since #323 the gateway tests require that
default_modelis never rewritten. That is a product decision, tracked in #351.Behavior Changes and Affected Users
envtableAuthTokenMissingError*_BASE_URLin anenvprovider of non-pythinker typeenvOverlayenvprovider.auth_error("not logged in")provider.auth_errorto a re-login prompt for this casellm.streaming.finisharrives after the stream ends@pymodel/agent-core-v2/kosong/*subpath importapps/vis(updated in this PR); no other consumer found in the repo.../llm-adapter/*Affected modules and coverage:
app/auth:test/app/auth/auth.test.ts(provider-env key case, fails onmain).app/kosongConfig/envOverlay: new non-pythinker base-url case (fails onmain).human/llmopenai format and stream: billing-error tests and DSML parser/recovery tests.tscandtsgoclean; no-comments and identity-freeze checks pass.Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.