Skip to content

fix(cli, conversation): Show stable raw turn numbers in print headers#810

Merged
JeanMertz merged 1 commit into
mainfrom
turn-count-issue
Jun 29, 2026
Merged

fix(cli, conversation): Show stable raw turn numbers in print headers#810
JeanMertz merged 1 commit into
mainfrom
turn-count-issue

Conversation

@JeanMertz

Copy link
Copy Markdown
Collaborator

Turn headers shown by jp conversation print now display the pre-projection (raw) turn number rather than the position in the projected iterator. This means the number in the header matches the argument jp conversation compact --from/--to accepts, so users can reference a printed turn directly in a compact command without having to account for how many earlier turns were collapsed.

In the compacted view, a summary turn that stands in for several raw turns shows the full range it replaced, e.g. turns 2–5, 12 minutes ago, while a single-turn summary continues to show turn N. The TurnSelection::Index path also resolves by raw turn number now, so jp conversation print --turn N is consistent with the header.

A new TurnOrigin enum is returned by apply_projection() and threaded through to TurnRenderer::render_turn, carrying the mapping from each projected turn back to its raw source turn(s). When no compaction is present every turn maps to TurnOrigin::Kept of its own index, so behaviour is unchanged for uncompacted views.

Turn headers shown by `jp conversation print` now display the
pre-projection (raw) turn number rather than the position in the
projected iterator. This means the number in the header matches the
argument `jp conversation compact --from/--to` accepts, so users can
reference a printed turn directly in a compact command without having
to account for how many earlier turns were collapsed.

In the compacted view, a summary turn that stands in for several raw
turns shows the full range it replaced, e.g. `turns 2–5, 12 minutes
ago`, while a single-turn summary continues to show `turn N`. The
`TurnSelection::Index` path also resolves by raw turn number now,
so `jp conversation print --turn N` is consistent with the header.

A new `TurnOrigin` enum is returned by `apply_projection()` and
threaded through to `TurnRenderer::render_turn`, carrying the
mapping from each projected turn back to its raw source turn(s).
When no compaction is present every turn maps to `TurnOrigin::Kept`
of its own index, so behaviour is unchanged for uncompacted views.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 87da498 into main Jun 29, 2026
16 checks passed
@JeanMertz JeanMertz deleted the turn-count-issue branch June 29, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant