Skip to content

fix(tui): make folded assistant messages expandable - #2920

Open
yu-xin-c wants to merge 3 commits into
MoonshotAI:mainfrom
yu-xin-c:codex/tui-preserve-folded-assistant
Open

fix(tui): make folded assistant messages expandable#2920
yu-xin-c wants to merge 3 commits into
MoonshotAI:mainfrom
yu-xin-c:codex/tui-preserve-folded-assistant

Conversation

@yu-xin-c

@yu-xin-c yu-xin-c commented Aug 14, 2026

Copy link
Copy Markdown

Related Issue

Resolve #2904

Problem

Completed turns replace older assistant replies with a count-only step summary. The original message components are then disposed, while the summary does not participate in the existing Ctrl+O expansion protocol. This makes the folded reply text unavailable in both the live TUI and replayed sessions.

What changed

  • Snapshot folded assistant Markdown into StepSummaryComponent before live, completed-turn, or replay folding removes the original components.
  • Make the summary expandable through Ctrl+O, reusing one lazy Markdown renderer and clearing its rendered-line cache on collapse or theme invalidation.
  • Respect KIMI_CODE_TUI_EXPAND_TURNS during replay and as live turns advance, so summaries outside the recent-turn window stay collapsed.
  • Cover collapsed/expanded ordering, snapshot ownership, long folded turns, incremental and completed-turn folding, and live/replay expansion cutoffs.
  • Document the behavior in the bilingual getting-started, interaction, and keyboard-reference pages.

The summary owns its text snapshots before the original components are removed. That also keeps the behavior compatible with #2603 if folded transcript metadata is reclaimed later.

Verification

  • pnpm --filter @moonshot-ai/kimi-code exec vitest run test/tui/components/messages/step-summary.test.ts test/tui/kimi-tui-message-flow.test.ts test/tui/message-replay.test.ts (251 passed)
  • pnpm --filter @moonshot-ai/kimi-code typecheck
  • pnpm --filter kimi-code-docs build
  • Focused type-aware oxlint (0 errors; 2 pre-existing warnings in kimi-tui.ts)
  • git diff --check

A full TUI run also reached 1,952 passed and 3 skipped; its five unrelated failures (one feedback sequencing case and four image-compression timeouts under parallel load) all passed in isolated reruns.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e6707da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@yu-xin-c
yu-xin-c force-pushed the codex/tui-preserve-folded-assistant branch from 98c0fcf to fc324a2 Compare August 14, 2026 15:39
@yu-xin-c
yu-xin-c marked this pull request as ready for review August 14, 2026 15:40

@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: fc324a2695

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/kimi-tui.ts
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.

[Bug] TUI: folded assistant messages ("… N messages") are disposed and cannot be re-expanded — previous replies become invisible

1 participant