Repository navigation
refactor(agent-core-v2): port the agent-core llm core into human/llm - #4352
Conversation
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
afef6fb to
f2abbc4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2abbc4abd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (efforts.length === 0) return 'on'; | ||
| if (effort !== 'on' && efforts.includes(effort)) return effort; | ||
| const declared = meta?.defaultEffort?.trim(); | ||
| return declared !== undefined && efforts.includes(declared) | ||
| ? declared | ||
| : efforts[Math.floor(efforts.length / 2)]!; |
There was a problem hiding this comment.
Restore rejection of unsupported strict thinking efforts
For a Kimi model declaring supportEfforts: ['low', 'high'], a caller requesting max previously received an llm.failed.syntax thinking-config error, but strictEffort now silently substitutes the default or midpoint effort and sends the request as high. This ignores an explicit caller setting without any signal and contradicts the PR's claim that strict thinking validation is preserved; retain the previous validation failure rather than rewriting unsupported values.
AGENTS.md reference: AGENTS.md:L110-L112
Useful? React with 👍 / 👎.
| anthropic: { | ||
| base: anthropicBetaBase, | ||
| trait: kimiAnthropicTrait, | ||
| base: kimiAnthropicBase, |
There was a problem hiding this comment.
Preserve the Kimi Anthropic beta requester default
When callers use kimiProvider.createRequester('anthropic') with the normal kimiProvider.resolveModel(...) result, this binding no longer forces the beta API: the old binding used anthropicBetaBase, while kimiAnthropicBase now reaches createKimiAnthropicRequester with neither options.betaApi nor model.betaApi, so requests switch from client.beta.messages.create to client.messages.create. This silently drops the provider's previous beta transport for Kimi Anthropic users and can break the beta features that this protocol still emits; make this provider binding opt into betaApi: true as before.
AGENTS.md reference: AGENTS.md:L126-L128
Useful? React with 👍 / 👎.
| let fetchFn: typeof fetch; | ||
| try { | ||
| fetchFn = createLlmHeadersTimeoutFetch(); | ||
| } catch (error) { | ||
| onEvent?.({ type: 'llm.failed.remote', error: base.decodeError(error), rawError: error }); |
There was a problem hiding this comment.
Parse the headers-timeout setting only for transports that use it
When KIMI_CODE_LLM_HEADERS_TIMEOUT_MS is invalid, this unconditional call now rejects Google GenAI requests and requests using an injected clientFactory before sending, even though those transports never consume endpoint.fetch. The old Google requester and injected clients did not parse this setting, and the PR explicitly says Google remains excluded from headers-timeout handling; defer construction to the default OpenAI/Responses/Anthropic clients so an irrelevant environment variable cannot break these callers.
AGENTS.md reference: AGENTS.md:L110-L112
Useful? React with 👍 / 👎.
f2abbc4 to
c7f4d5d
Compare
|
❌ Nix build failed Hash mismatch in
Please update |
- relocate requester, media, and built-in protocol modules - update imports, exports, and module path references - sync llm guides and the state manifest
Port the LLM protocols, policies, requester composition, and native message flow. Align endpoint, capability, tool-call, media, persistence, and public client compatibility. Update dependent packages, manifests, and existing tests.
Hydrate blob-backed media in cold transcript snapshots. Restore non-assistant tool calls in spliced websocket events. Cover durable records and live media compatibility paths.
e1fd314 to
34d5752
Compare
--refresh adds the 148 upstream commits that were missing from the ledger; the true open count is now 149, not 1. The refresh keeps the existing MoonshotAI#4820/MoonshotAI#4831/MoonshotAI#4352 corrections.
Requirement or Bug
Internal refactor task (refact-301): port the agent-core (237) llm core into agent-core-v2's
human/llm, wholesale-replacing the protocol cores and requester internals ofhuman/llm/+llm-adapter/while keeping the outward contracts (theLlmRequestEventvocabulary, thellm-adapter/contractthrow classes, and the DI service surface) unchanged. Non-streaming (stream: false) request capability comes with the replacement, per the accepted feat-242/#3872 design.Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
human/llm— request/response/endpoint contracts, the attempt drivergenerate.ts, the policy loop (runLlmRequestwith single-attempt wiring:maxAttemptsPerStep: 1, no recoveries; turn-level retry/recovery unchanged), the settle stage (accumulation, timing, outcome synthesis with empty-response judgment at the source), and the protocol pipeline (defineProtocol,PipelineSpec, legalize passes, rules, kit).human/llm/requester/run.ts): mapsLlmRequestConfig + LlmRequestContentonto the core, wires the headers-timeout fetch per attempt, translates run-loop events into the unchanged 10-eventLlmRequestEventunion, and synthesizes terminal events (done / failed / abort-as-llm.failed.remote).create*Requesterseam factory. Main-line wire behavior is preserved per protocol (media wire shapes, tool-result conversion modes and texts, reasoning/thinking encoding, usage/finish/error mapping, id normalization, beta/header rules, abort handling)..with(patch)compositions inllm-kimi/protocol.ts(keep_parts, kimi thinking kwargs, builtin_function tools, usage hoist, extra_body flattening, x-trace-id, kimi image mimes, strict thinking efforts); the trait hook mechanism is removed and the adapter registry routes via per-provider requester factories.LlmRequestConfig.stream(default streaming) selects the non-streaming send+replay path with an isomorphic event sequence;ModelRequestParamsgains the same additive pass-through.docs/en/llm.mdanddocs/zh/llm.mdrewritten for the pipeline architecture.llm-adapter/contract/is byte-identical (verified empty diff); the DI tokens and service registrations are unchanged.Behavior Changes and Affected Users
llm.donefired, then the turn re-raised it asllm.failed.remote(empty_response)llm.failed.remotedirectly, no precedingllm.donestream: truehardcoded)stream: falsehonored atLlmRequestConfig/ModelRequestParams, isomorphic events; default unchangedllm.failed.remotekindabortfetchOptions.dispatcher(openai/anthropic/responses only)fetchbuilt from the same dispatcher creation code; google-genai still excludedKIMI_CODE_LLM_HEADERS_TIMEOUT_MSand HTTP(S)/SOCKS proxy envs — same env parsing, warnings, and dispatcher injection (pinned by headers-timeout.test.ts)reasoning_content; explicit override via catalogreasoningKeypreserved)llm.failed.remote.rawError.with(patch); trait types deletedTest coverage: the 12+13 llm suites (
src/human/test/llm,test/llm-adapter) are green with a conserved test count (338 tests); media wiring test and state manifest refreshed; full monorepo suite green on m0-dev (17381 passed, 1 unrelated remote-fs flake that passes in isolation).Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.