kimi-code/packages/kosong/test
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
..
e2e fix: replay empty thinking verbatim on preserved-thinking endpoints (#1773) 2026-07-16 17:00:06 +08:00
fixtures feat: attach trace_id to telemetry events (#1724) 2026-07-16 09:14:12 +08:00
providers fix(kosong): repair mismatched schema types from Xcode 26.5 MCP (#343) 2026-06-15 20:47:15 +08:00
anthropic-errors.test.ts fix(kosong): fail fast on quota-exhausted 429 instead of retrying (#1857) 2026-07-28 14:35:12 +08:00
anthropic.test.ts fix: consume the model metadata declared by the models.dev catalog (#2015) 2026-07-22 01:23:31 +08:00
capability-providers.test.ts refactor: resolve model capabilities via a static table lookup (#776) 2026-06-15 17:58:08 +08:00
capability.test.ts refactor: resolve model capabilities via a static table lookup (#776) 2026-06-15 17:58:08 +08:00
catalog.test.ts fix: gate always-thinking inference to OpenAI wires, plus catalog review follow-ups (#2036) 2026-07-22 13:43:10 +08:00
echo-provider.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
errors.test.ts fix: fail fast on provider-filtered empty responses (#3101) 2026-08-20 11:55:26 +08:00
finish-reason.test.ts feat: attach trace_id to telemetry events (#1724) 2026-07-16 09:14:12 +08:00
generate.test.ts fix: fail fast on provider-filtered empty responses (#3101) 2026-08-20 11:55:26 +08:00
google-genai.test.ts chore: remove internal-network references from comments and test fixtures (#3029) 2026-08-18 14:14:56 +08:00
kimi-files.test.ts fix(kosong): fail fast on quota-exhausted 429 instead of retrying (#1857) 2026-07-28 14:35:12 +08:00
kimi.test.ts fix(kosong): fail fast on quota-exhausted 429 instead of retrying (#1857) 2026-07-28 14:35:12 +08:00
message.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
openai-common-errors.test.ts fix(kosong): fail fast on quota-exhausted 429 instead of retrying (#1857) 2026-07-28 14:35:12 +08:00
openai-legacy.test.ts fix(kosong): emit null content for assistant messages with no text in chat completions (#3052) 2026-08-19 11:39:32 +08:00
openai-responses.test.ts fix(kosong): fail fast on quota-exhausted 429 instead of retrying (#1857) 2026-07-28 14:35:12 +08:00
provider.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
regression.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
scripted-echo-provider.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
select-tools.test.ts feat: attach trace_id to telemetry events (#1724) 2026-07-16 09:14:12 +08:00
simple-toolset.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
step.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
stress.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
strict-role-alternation.test.ts feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +08:00
tool-message-conversion.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
type-safety-negative.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
type-safety.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
typed-tool.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
usage.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00