fix(tui): skip sparse compacted segments in isBlockUncommitted#5298
fix(tui): skip sparse compacted segments in isBlockUncommitted#5298tcf909 wants to merge 2 commits into
Conversation
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.
|
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. |
There was a problem hiding this comment.
💡 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++) { |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
render()only repopulates#segmentsfrom#compactedChildStart, leaving sparseundefinedholes in the compacted prefix.isBlockUncommitted()walked every segment and crashed withTypeError: undefined is not an object (evaluating 'segment.component')when IRC/ephemeral cards were retired (#retireIrcCard).undefinedsegment slots and add a red/green regression for the sparse-hole path.Repro
#compactCommittedPrefixruns.isBlockUncommitted(or retire an IRC card) → crash.Verification
segment.componentTypeError.bun test packages/coding-agent/test/modes/components/transcript-container.test.ts→ 48 pass / 0 fail.omp.2026-07-12.log(#retireIrcCard→isBlockUncommitted).Notes