fix(cli): align ingest step counter with SDK num_turns

The Claude Code runtime counted every SDKAssistantMessage with
parent_tool_use_id === null as a step, but the SDK emits extra messages
within a single num_turns round-trip — `stop_reason: 'pause_turn'`
continuations and errored partials it retries internally. The local
counter then outran maxTurns and the ingest HUD rendered confusing
ratios like `step 69/40`.

Filter both cases in collectResult so stepIndex tracks num_turns and
stays bounded by the work-unit stepBudget.
This commit is contained in:
Andrey Avtomonov 2026-05-28 01:55:39 +02:00
parent a94f35800a
commit 20454bcb8f
3 changed files with 77 additions and 3 deletions

4
uv.lock generated
View file

@ -458,7 +458,7 @@ wheels = [
[[package]]
name = "ktx-daemon"
version = "0.5.0"
version = "0.6.0"
source = { editable = "python/ktx-daemon" }
dependencies = [
{ name = "fastapi" },
@ -515,7 +515,7 @@ dev = [
[[package]]
name = "ktx-sl"
version = "0.5.0"
version = "0.6.0"
source = { editable = "python/ktx-sl" }
dependencies = [
{ name = "pydantic" },