deepseek-harness/packages/core/agent-loop/tests
Yichen Jiang 7e95a00c8a fix(llm): align replay state with assembled content and degrade unusable state
A max-tokens response that included a tool call persisted assembler-transformed
content next to replay metadata projected from the untransformed native message,
so the next request died in history reconstruction with INVALID_REPLAY_STATE and
the session stayed permanently stuck.

Write side: the finish chunk's replayState becomes a typed ReplayEnvelope —
opaque response-level metadata plus optional per-block entries aligned with the
emitted block sequence. BlockAssembler computes one keep/drop decision for
blocks and entries together, so stored metadata always describes stored content
and retained blocks keep their signatures. pi-ai splits its state into a
version-2 response half and per-block signature entries.

Read side: durable content is authoritative. toPiAssistant degrades any
unusable state — foreign kind, other versions (including the flat v1 form
already on disk), malformed metadata, or content/block mismatches — to the
existing provider-neutral conversion with an onReplayDegrade diagnostic instead
of failing the request, which un-bricks sessions poisoned before this change.

Covered by assembler and replay unit tests, an agent-loop continuation
regression, keyless real-composition continuation tests (native pruned-envelope
replay and legacy flat-state degrade), and the authored keyless snapshot
scenario max-tokens-continue through the assembled ACP app.
2026-08-15 16:07:30 +08:00
..
agent-initiator.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
agent.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
cancel.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
config-session-id.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
contract-regressions.spec.ts fix(llm): align replay state with assembled content and degrade unusable state 2026-08-15 16:07:30 +08:00
coverage-edges.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
interception.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
invariant.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
loop.spec.ts fix(llm): align replay state with assembled content and degrade unusable state 2026-08-15 16:07:30 +08:00
mock-adapter.ts fix(agent-loop): latch wakes landing in the cancel-convergence window 2026-08-08 19:42:42 +08:00
properties.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
request-cache.e2e.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
request-error.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
request-reconstruction.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
resume.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
runtime-context.spec.ts build(vendor): rescope the vendored Cordis packages into @deepseek-ai 2026-08-10 22:04:13 +08:00
scope-lifecycle.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
settings.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
tool-calls.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00
tool-order.spec.ts refactor: apply repository naming contract 2026-08-13 00:54:38 +08:00