Skip to content

fix(tui): skip sparse compacted segments in isBlockUncommitted#5298

Closed
tcf909 wants to merge 2 commits into
can1357:mainfrom
tcf909:fix-5239-sparse-segments
Closed

fix(tui): skip sparse compacted segments in isBlockUncommitted#5298
tcf909 wants to merge 2 commits into
can1357:mainfrom
tcf909:fix-5239-sparse-segments

Conversation

@tcf909

@tcf909 tcf909 commented Jul 12, 2026

Copy link
Copy Markdown

Summary

Repro

  1. Apply fix(tui): compact transcript retention without losing resize history #5239 compaction path.
  2. Commit a finalized head block into native scrollback so #compactCommittedPrefix runs.
  3. Render again so the compacted index becomes a sparse hole.
  4. Call isBlockUncommitted (or retire an IRC card) → crash.

Verification

  • Red: remove the guard → new test fails with the original segment.component TypeError.
  • Green: with the guard → bun test packages/coding-agent/test/modes/components/transcript-container.test.ts → 48 pass / 0 fail.
  • Locally confirmed against the live crash from omp.2026-07-12.log (#retireIrcCardisBlockUncommitted).

Notes

RensTillmann and others added 2 commits July 11, 2026 21:09
After can1357#5239 compaction, a later render only fills segments from
#compactedChildStart, leaving undefined holes in the prefix. Iterating
those entries crashed when retiring IRC/ephemeral cards
(`segment2.component`). Guard undefined segment slots and cover the
sparse-hole path with a red/green regression.
@github-actions

Copy link
Copy Markdown
Contributor

Hi @tcf909, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/can1357/oh-my-pi/blob/main/CONTRIBUTING.md for more details.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c14513a8b0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

let row = 0;
let stableRows = 0;
for (let i = 0; i < count; i++) {
for (let i = this.#compactedChildStart; i < count; i++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the inter-block gap after compaction

When the compacted prefix has consumed every existing transcript child and a later message/tool block is appended, this loop starts rendering at the new child with row still 0; the separator logic below only emits a blank when row > 0. The previous tail block was committed without a trailing blank, so the newly appended block is written directly adjacent to the last committed history row instead of matching the full transcript layout (old, blank, new). This shows up in long sessions once all prior transcript blocks have been compacted; keep a pending leading separator or avoid compacting the last block until a following separator exists.

Useful? React with 👍 / 👎.

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.

2 participants