Skip to content

fix(kimi-code): render v2 background task notifications on session replay - #2677

Merged
liruifengv merged 2 commits into
mainfrom
fix/tui-v2-task-notification-replay
Aug 6, 2026
Merged

fix(kimi-code): render v2 background task notifications on session replay#2677
liruifengv merged 2 commits into
mainfrom
fix/tui-v2-task-notification-replay

Conversation

@liruifengv

@liruifengv liruifengv commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — the problem is explained below.

Problem

When the TUI runs on the v2 engine, resuming a session renders background-task terminal notifications as raw <notification ...> XML user messages instead of the usual task status card.

The v2 engine persists these notifications with prompt origin kind task (renamed from v1's background_task), and both spellings reach the replay verbatim. The TUI's replay path only recognized the legacy spelling, so a v2-spelled notification fell through every special-case branch and landed in the generic user-message renderer, leaking the protocol XML into the visible transcript.

What changed

  • The replay's background-task origin gate now accepts both spellings (background_task and task). The v2 spelling is declared as a local origin type because the SDK's PromptOrigin union only carries the v1 vocabulary; both shapes share the same taskId / status / notificationId fields and identical status value sets, so the status-card renderer works unchanged — only its parameter type was widened.
  • Added a replay test feeding a v2-spelled completion notification: it renders as the bash task status card, and the test also asserts the raw notification XML never appears as a user message. The existing v1-spelling test keeps guarding the legacy path.

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 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 676a67e

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 6, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@676a67e
npx https://pkg.pr.new/@moonshot-ai/kimi-code@676a67e

commit: 676a67e

@liruifengv
liruifengv merged commit 713bf1a into main Aug 6, 2026
15 checks passed
@liruifengv
liruifengv deleted the fix/tui-v2-task-notification-replay branch August 6, 2026 05:00
@github-actions github-actions Bot mentioned this pull request Aug 6, 2026
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