kimi-code/packages/transcript/test
Haozhe 67325c1b25
Some checks are pending
CI / release-workflow-tests (push) Waiting to run
CI / build (push) Waiting to run
CI / test (1) (push) Waiting to run
CI / test (2) (push) Waiting to run
CI / test (3) (push) Waiting to run
CI / test (4) (push) Waiting to run
CI / test (5) (push) Waiting to run
CI / test-pi-tui (push) Waiting to run
CI / test-vscode-legacy (push) Waiting to run
CI / test-windows (push) Waiting to run
CI / lint (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
fix(transcript): realign rebuilt turn ordinals to wire ids and mark wedged turns (#4280)
* fix(transcript): realign rebuilt turn ordinals to wire ids and mark wedged turns

Cold transcript rebuilds numbered materialized turns 0..N while the live
projector assigns ordinal=wireId, so a session rebuilt after a restart got a
shifted axis that no longer aligned with what clients had cached live, and a
turn whose loop died before writing a terminal event was rebuilt as a fake
completed turn with no timestamps.

foldWireRecordFacts now reassigns every matched rebuilt turn to its wire turn
id (leaving holes for folded turns), restores startedAt from the
agent.turn.started / turn.prompt records, and marks a turn with no terminal
event as wedged (state failed + wedged flag) once a later turn prompt exists
in the wire; the tail turn is only wedged when it is not the live active one.
The live projector closes the previous running turn as wedged when a new turn
starts. The wedged marker is an additive optional field so released clients
keep parsing transcripts and render the turn as failed.

* feat(agent-core-v2): surface silent notification-delivery and persistence failures

The wedged-turn incident showed a main agent loop can stall for hours with
zero diagnostics: task notifications pooled in memory, a latched or hung wire
flush swallowed every subsequent record, and the running turn produced no
watchdog output.

- AppendLogStore warns once when an append is accepted while a storage
  failure is latched, and warns when a flush stays pending past 30s
  (repeating every 10min) with scope/key/pending counts.
- WireService routes append failures to ILogService in addition to
  onUnexpectedError so they land in the daemon log.
- AgentLoopService arms a per-turn watchdog that warns after 10min without
  observable progress (steps, streaming partials, machine phase), including
  pending notification/pause/queue state; loop.notify and nudge consumption
  log buffered/drained counts at debug level.
- AgentTaskService warns when lifecycle guards silently drop task
  notifications or terminal events, and debug-logs in-process redelivery
  suppression.
- EventDispatcherService warns once per episode when dispatch is stuck for
  over 30s and events keep queueing behind it.

* test(agent-core-v2): quiesce the spawned notification turn before counting leaked timers

With the loop turn watchdog armed, a notification-driven turn that happens
to be running at the assertion holds a legitimate interval, making the
global timer count scheduling-dependent. Cancel any spawned turn and pump
the clock until the loop is idle before counting.

* chore: add changeset for the wedged-turn transcript fix
2026-10-20 18:00:19 +08:00
..
layers.test.ts fix(transcript): realign rebuilt turn ordinals to wire ids and mark wedged turns (#4280) 2026-10-20 18:00:19 +08:00
store.test.ts feat(transcript): include step timing and usage in cold-folded steps (#3938) 2026-09-21 19:14:53 +08:00