Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 312a31f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 193e3ba542
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b13dc2502f
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ff1633b3c
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0909f0fc1
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a8fd7e6f5
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a69fb1028
ℹ️ 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".
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ceda7776d
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48964a0fa9
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f47674eb1a
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
Port of upstream MoonshotAI/kimi-code 02d2e8f (MoonshotAI#4477), translated onto this fork's single llm tree. Retryability is now a property of the error instead of a kind/status lookup per consumer: - LlmStatusErrorInfo carries statusCode?: number and retryable; every LlmRemoteErrorMessage variant carries retryable. - toLlmStatusErrorMessage computes it from the HTTP status set, and no longer sanitizes or appends the thinking-effort hint: both belong to the display layer (llm-adapter's contract), which already applied them, so the old placement appended the hint twice on that path. - toLlmErrorMessage / toLlmTransportErrorMessage / toLlmStreamErrorMessage assign retryability per class (abort and unknown false; timeout, connection and provider true). - isRetryableError is now 'syntax? false : error.retryable'; no caller keeps its own copy of the status-code table. - ChatProviderError and its subclasses carry retryable with per-class defaults; APIStatusError takes an optional statusCode and a retryable override. errorFromLlmMessage/llmMessageFromError round-trip the flag and pass the status code through without synthesizing 429. - Serialization preserves an explicit retryability (registry default only as fallback) and strips a details.statusCode that the direct model error does not confirm; fromErrorPayload restores it for the API* class names. - The Kimi quota classifier no longer guesses from message wording: only a structured quota code counts, a missing status is accepted, and the message comes from the nested error body. - node-sdk keeps a backend message verbatim, recognizes a rate-limit class without a synthesized 429, and prefers an error's own retryability over the code registry when the class exposes one. - The OpenAI decoder reads code/type/message from the SDK's error body and classifies quota/overloaded/context-overflow by structured code before the status, so a nested body is not re-stringified into the user message. Local adaptation: upstream splits this code across human/llm-requester, human/llm/protocol/{errors,rules/status,kit/http} and human/llm/response; this fork keeps one human/llm/errors.ts plus requester/bases/*, so those pieces are folded there. The stream-source distinction in upstream's decoder has no counterpart: the fork's parsers surface mid-stream errors through the same requester catch, so the branch stops at the HTTP-status path. The other three decoders gained the retryability flags but keep their existing message parsing. Carried fixup: kap-server's workspace route reached into agent-core-v2/_base/utils/workdir-slug (introduced with 718a3ae and missed by check:boundaries); workspaceRootKey is exported from the engine root and the route imports the public surface. Verified: 852 tests across 59 affected files (human/llm, human/test/agent, _base/errors, llm-adapter, app protocol, runAgentTurn), node-sdk 307, agent-core-v2/kap-server/apps-kimi-code typechecks clean, engine build and check:boundaries clean, oxlint 0 errors, check:no-comments green. Reverse checks: forcing isRetryableError false reddens the turn retry case, and dropping the explicit retryability from serialization reddens the round-trip case. The 'executes multiple tool calls concurrently' case was red until its 500 fixture gained retryable: true - the same fixture change the port needs wherever an error literal crosses the retry policy.
Continues the MoonshotAI#4477 port with the stream-source distinction this fork lacked. A mid-stream failure carries the provider's business code in the SDK error's status field, not an HTTP status. convertOpenAIError now takes an optional source: 'stream', and the requester passes it from the stream loop: the HTTP status is dropped from the classification, a structured business code decides the kind (rate limit, overloaded, quota exhausted, context overflow, request too large), and anything left over goes through the new toLlmStreamErrorMessage, which maps 429/529/413 and derives retryability from the business code. The request-path classification is unchanged. toLlmStreamErrorMessage lives beside toLlmStatusErrorMessage in human/llm/errors.ts (upstream keeps it in human/llm/protocol/rules/status). Verified: 7 new cases (status 429/529/413 and code rate_limit_exceeded / engine_overloaded_error / insufficient_quota / context_length_exceeded, each asserting kind, retryable and the absence of an HTTP status); 847 pass across the affected trees, engine typecheck clean, oxlint 0 errors, check:no-comments green. The anthropic, openai-responses and google-genai requesters still classify stream failures on the legacy path.
…rotocols Completes the stream-source half of MoonshotAI#4477. - anthropic: convertAnthropicError takes source: 'stream'; a mid-stream failure drops the HTTP status and classifies by the body error type (quota, overloaded, rate limit, context overflow), falling back to toLlmStreamErrorMessage. The body message wins over the SDK-composed one. - openai-responses: the requester passes source: 'stream' to the shared OpenAI converter, so a responses stream failure is classified the same way as chat. - google-genai: convertGoogleGenAIError parses the JSON error body once (parseGoogleGenAIErrorBody) and reads code/message/status from it; RESOURCE_EXHAUSTED and 429, plus OVERLOADED and 529, are classified explicitly, and the retry-after detail is read from the parsed body. The stream path drops the HTTP status and uses the business code. All three requesters wrap their stream loop and report the failure with the stream source, so an SDK throw mid-stream no longer surfaces as an HTTP status error with the wrong kind. Verified: two new unit cases (anthropic body type, google business code), 855 tests across the affected trees, engine typecheck clean, import boundaries, oxlint 0 errors and check:no-comments green.
…r cases Coverage only — the source side of MoonshotAI#4477 landed earlier (d843689, 1cc9d0f, f5d3834, 2c3ed68); these cases pin behavior that had no local twin. `test/llm-adapter/contract/errors.test.ts` gains a `model error HTTP status source` block: explicit retryability beats the HTTP status class in both directions, a real model status survives `errorFromLlmMessage` and the reverse mapping, a provider error code rides the code slot with its status and trace id, and message-recovery patterns stay off when there is no real HTTP status. `src/human/test/llm/errors.test.ts` gains three stream-source cases: an initial Google HTTP 429 keeps its status while the same business 429 on the stream path drops it, a structured context code outranks the 400 HTTP fallback, and an unknown OpenAI stream business code still classifies by the numeric code, drops the status and keeps its headers. Local-form notes: - Upstream pins the registry boundary through `registry.request(...).protocol.base.decodeError(...)`. The fork's registry only exposes `resolve(model)`; the boundary lives in each base's `convert*Error(error, hook?, source)` instead, so the assertions target those. - Upstream's four-protocol stream matrix is expressed here as a seven-case requester-level `it.each` (already present) plus the three converter-level cases above, rather than the end-to-end `generateEvents` variants. - `APIStatusError` takes `traceId` and `code` in its fifth and sixth positional slots locally; upstream's fifth slot is a diagnostics object that has no local counterpart, so the provider-code case asserts the code, status and trace id only. - `ChatProviderError`'s retryability is the fourth positional argument locally, not the fifth, so the existing deterministic-validation cases keep their shape. Verified: agent-core-v2 typecheck clean; 59 pass across the two error files and 106 pass in the `app/llmProtocol` error suite.
…limit `providerRateLimitErrorFromPayload` rebuilt a rate-limit failure from its KimiErrorPayload but passed only `requestId`, so `APIProviderRateLimitError` fell back to its default status of 429. A status-less mid-stream rate limit — the shape every protocol produces once the HTTP status is dropped on the stream path — came back to the parent agent wearing an HTTP 429 that never existed, which changes how the turn reports and retries it. The rebuild now carries `details.statusCode` through, so a stream failure stays status-less and a real HTTP 429 keeps its status. A real `APIProviderRateLimitError` already passes through unchanged via `isProviderRateLimitError`, and an `Error2` carrying `statusCode: 429` is recognized there too; both are pinned now. Local-form note: the fork has two `APIProviderRateLimitError` classes — `packages/kosong/src/errors.ts` (four parameters, status hard-coded to 429) and `packages/agent-core-v2/src/llm-adapter/contract/errors.ts` (five parameters, status overridable). The engine throws the latter. `toKimiErrorPayload` in node-sdk branches on `instanceof` against the former, so an engine error handed to it directly reports `internal`; that duplicate is out of scope here and stays on the MoonshotAI#4477 gap list. Verified: agent-core-v2 typecheck clean; subagent suites 141 pass. Reverting the status pass-through reddens `does not invent HTTP 429 when rebuilding a stream rate-limit failure`; restoring it is green.
Source side is complete after d221dbc, and every upstream test file now has a local counterpart except three recorded gaps: the two duplicated APIProviderRateLimitError classes leave node-sdk's toKimiErrorPayload unable to read an engine error (needs a public-export decision), the loop-level "keeps the terminal real 503 after an earlier real 429" case is not ported, and the registry-boundary case is pinned at each base's convert*Error instead of a registry.decodeError the fork does not have. Stays in_progress until those are decided.
The row still said in_progress, pointing at a follow-up that landed as 1cc9d0f, f5d3834, 2c3ed68 and d221dbc. Checked rather than assumed: the three error suites and the human llm tree pass (106 + 39 + 248), and the source side carries every piece the row described — retryability as an error property, the status code carried through serialization, mid-stream failures classified by business code with the HTTP status dropped, and no synthesized 429 on a rebuilt stream rate limit. Ledger: closed 73 -> 74, remaining 26 -> 25.
Requirement or Bug
让模型错误展示后端返回的
error.message,并确保只有真实模型 HTTP 响应的状态才进入statusCode;KAP 与 HTTP 200 后的流式业务码不再冒充模型 HTTP 状态。Bug Reproduction Steps
error.message不同。Root Cause
协议边界把 SDK 组合后的
message当作后端原文,并把真实 HTTP、KAP 详情状态和流式业务码写入同一个statusCode。这次在 #4352 后的新请求链上修复取值和来源,不引入统一错误对象,也不改变跨 attempt 的最终错误选择。Code Changes
核心边界是“协议解码完整归一化,重试策略只消费归一化字段”。所有远程错误都在解码或旧错误构造时得到必填
retryable: boolean,不再让调度层从statusCode、错误子类或 message 反推是否重试。已合并 main(
9ce252a37),保留主线新增的diagnoseError/diagnostics机制,同时延续本 PR 的source: 'stream'和真实状态边界。当前工作树相对该基线为 42 个文件、+1858 / -465。未改 UI、turn 状态机或重试次数/退避,未新增统一LlmError或错误对象全链路直通。已按后端错误码表 revision 1306 复核:个人与企业的 5 小时、7 天、月度、余额及组织额度场景统一使用
exceeded_current_quota_error;rate_limit_reached_error与engine_overloaded_error分别走限流与过载分支。新增场景复用结构化分类,不读取业务 reason 或 message 决定配额,也不把普通 403 改为限流。Behavior Changes and Affected Users
error.message,缺失时为空,不清洗或追加文案type/code;文案不再作为配额依据statusCode缺失;保留业务分类与应有的重试语义,不重复发送终止事件retryable;策略只读该字段,statusCode仅诊断;退避、jitter、次数与retryAfterMs调度不变decodeError必须返回明确 booleanretryable由静态错误码元数据决定,可能覆盖显式值,反序列化后也会丢失retryable;无该字段的旧内部错误仍用静态元数据ChatProviderError可凭图片文案禁止重试retryable: false400 + INVALID_ARGUMENTcontext_overflowdetails.statusCode不进入模型状态;其他诊断保留文案配额分类的移除没有配置退路,需维护者在 PR 中明确批准;在批准前,下方行为变更检查项保持未勾选。
受影响模块与覆盖:
src/human/test/llm/errors.test.ts。test/llm-adapter/contract/errors.test.ts、test/agent/loop/loop.test.ts。test/llm-adapter/protocol/protocolAdapterRegistry.test.ts。test/_base/errors/serialize.test.ts。test/session/subagent/runAgentTurn.test.ts。test/app/protocol/errors.test.ts。packages/node-sdk/test/sdk-rpc-client-v2.test.ts。验证环境与结果(macOS,Node 24,pnpm 10.33.0)
retryable不被静态错误码元数据覆盖,并在往返转换中保留。pnpm -C packages/agent-core-v2 test:390/394 个测试文件通过,7838 个测试通过、2 个跳过。6 个失败包括 3 个 30 秒超时、1 个临时目录ENOTEMPTY、2 个 XState 5 秒超时。tool.test.ts中returns the spawned agent id when a foreground subagent times out的已知 30 秒超时;其余失败均未复现。pnpm typecheck:通过,包括 packages 构建、全部 package、CLI、VS Code 与 vis 类型检查。pnpm -C packages/agent-core-v2 build、pnpm -C packages/node-sdk build:通过。pnpm lint:0 errors;仓库既有 2744 个 warnings。git diff --check:通过。312a31f):全部检查通过,test-windows按预期 skipped;增量评审完成,未解决线程为 0。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.