kimi-code/packages/agent-core
Kimi Agent d96b4a0149
fix: fail fast on provider-filtered empty responses (#3101)
* fix: fail fast on provider-filtered empty responses

An APIEmptyResponseError carrying finishReason 'filtered' (OpenAI
content_filter, Anthropic refusal) is deterministic: replaying the same
request re-triggers the provider safety filter. Both isRetryableGenerateError
implementations (kosong, agent-core-v2) treated every empty response as
retryable, so step retry replayed the doomed request the full 10 attempts
before the filter notice surfaced. Return non-retryable for filtered empty
responses in both engines; the error already carries the provider.filtered
code, so the turn fails immediately with the existing filter notice.

* fix: skip the compaction shrink-retry for filtered empty responses

Both full-compaction loops routed every APIEmptyResponseError into the
shrink-and-continue branch before isRetryableGenerateError was consulted,
so a filtered response was retried with shrinking input instead of failing
fast. Exclude finishReason 'filtered' from the shrink branch in both
engines; it now falls through to the retryability check and throws
immediately. Add end-to-end tests (real kosong generate over a filtered
think-only stream) asserting a single attempt with the history untouched.

---------

Co-authored-by: kimi-agent-bot <kimi-agent-bot@users.noreply.github.com>
2026-08-20 11:55:26 +08:00
..
scripts feat: keep image-heavy sessions within provider request-size limits (#1508) 2026-07-09 18:05:14 +08:00
src fix: fail fast on provider-filtered empty responses (#3101) 2026-08-20 11:55:26 +08:00
test fix: fail fast on provider-filtered empty responses (#3101) 2026-08-20 11:55:26 +08:00
AGENTS.md feat(agent-core): unify the v1 MCP management plane (#2858) 2026-08-17 13:19:51 +08:00
CHANGELOG.md ci: release packages (#2881) 2026-08-14 20:51:17 +08:00
package.json ci: release packages (#2881) 2026-08-14 20:51:17 +08:00
README.md Kimi For Coding 2026-05-22 15:54:50 +08:00
tsconfig.json feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
tsdown.config.ts feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
vitest.config.ts fix(agent-core): strip the no-op subagent model parameter while the secondary-model experiment is off (#2449) 2026-07-31 13:09:56 +08:00

@moonshot-ai/agent-core

The unified agent engine for Kimi Code.

Part of the Kimi Code monorepo.

See the main repository for documentation, issues, and contribution guidelines.

License

MIT