kimi-code/packages/kosong/test
Kai e2fe62a5ef
Some checks are pending
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
CI / test-windows (push) Waiting to run
CI / build (push) Waiting to run
CI / typecheck (push) Waiting to run
Nix Build / Check flake.nix workspace sync (push) Waiting to run
Nix Build / nix build .#kimi-code (push) Blocked by required conditions
Release / Release (push) Waiting to run
Release / Deploy docs (push) Blocked by required conditions
Release / Native release artifact (push) Blocked by required conditions
Release / Desktop release artifact (push) Blocked by required conditions
Release / Publish native release assets (push) Blocked by required conditions
fix(agent-core): harden tool_use/tool_result exchange integrity (#1340)
* feat(agent-core): guide the model away from repeating denied or failed tool calls

- system.md: add a diagnose-before-retrying paragraph next to the existing
  permission-denial guidance, covering failed tool calls
- permission: when the user rejects an approval on the main agent, tell the
  model not to re-attempt the exact same call (sub agents already had an
  equivalent hint)

* fix(agent-core): close abandoned tool exchanges and dedupe duplicate tool_use ids

A turn that dies between a recorded tool.call and its paired tool.result
(e.g. a transcript write failure mid-batch) used to leave
pendingToolResultIds open forever: every later message was stranded in
deferredMessages and user input was silently swallowed.

- runOneTurn now defensively closes any dangling tool calls when a turn
  ends (completed, cancelled, or failed), synthesizing an error result
  that names the cause, with a warn log and a tool_exchange_abandoned
  telemetry event
- the projector drops assistant tool calls whose id already appeared
  earlier (first occurrence wins): a duplicate id is wire-invalid on
  strict providers and not repairable by the strict resend; reported via
  the existing projection-repair log and telemetry
- resume-side closePendingToolResults now logs what it closes (warn for
  a mid-history gap, info for the routine trailing interruption)

* chore: add changesets for tool exchange fixes

* fix(agent-core): scope duplicate tool_use id dedup to the strict resend

Unconditional dedup regressed providers that emit per-response counter
ids (e.g. call_0 in every step) and accept their own duplicates: later
tool exchanges silently vanished from the projected history, and a
duplicate call's own recorded result was left dangling.

- the dedupe pass is now opt-in via dedupeDuplicateToolCalls and enabled
  only in strictMessages, so the normal projection keeps the history the
  provider produced
- the pass also drops every tool result after the first for an id, so no
  dangling tool message survives; when the kept call has no result of
  its own, the surviving one is reattached by the adjacency repair
- kosong now classifies the Anthropic "tool_use ids must be unique" 400
  as a recoverable request-structure error so it triggers the strict
  resend
2026-07-03 14:26:57 +08:00
..
e2e feat: add KIMI_MODEL_THINKING_EFFORT to force a thinking effort (#1275) 2026-07-01 21:20:27 +08:00
fixtures refactor: resolve model capabilities via a static table lookup (#776) 2026-06-15 17:58:08 +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): retry a dropped provider stream (terminated) on the Anthropic path (#1274) 2026-07-01 22:48:57 +08:00
anthropic.test.ts feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +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(catalog): preserve reasoning fields in custom model (#70) 2026-05-26 17:32:37 +08:00
echo-provider.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
errors.test.ts fix(agent-core): harden tool_use/tool_result exchange integrity (#1340) 2026-07-03 14:26:57 +08:00
finish-reason.test.ts fix: prevent streaming tool argument CPU spikes (#29) 2026-05-25 19:49:11 +08:00
generate.test.ts feat(timing): split TTFT into api-server and client portions (#1228) 2026-06-30 19:15:02 +08:00
google-genai.test.ts fix(provider): honor base_url for google-genai and vertexai providers (#1269) 2026-07-01 19:33:35 +08:00
kimi-files.test.ts Kimi For Coding 2026-05-22 15:54:50 +08:00
kimi.test.ts feat: add KIMI_MODEL_THINKING_EFFORT to force a thinking effort (#1275) 2026-07-01 21:20:27 +08:00
message.test.ts feat: flatten tool call records (#25) 2026-05-25 23:02:25 +08:00
openai-common-errors.test.ts refactor!: overhaul thinking config and effort resolution (#1132) 2026-06-30 22:34:13 +08:00
openai-legacy.test.ts feat: cap completion tokens to remaining context window for chat-completions (#1131) 2026-06-26 19:12:04 +08:00
openai-responses.test.ts refactor!: overhaul thinking config and effort resolution (#1132) 2026-06-30 22:34:13 +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
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