Skip to content

fix(transcript): fold mid-turn task notifications into the current turn on cold rebuild - #3102

Open
wbxl2000 wants to merge 23 commits into
mainfrom
fix/transcript-notification-fold
Open

fix(transcript): fold mid-turn task notifications into the current turn on cold rebuild#3102
wbxl2000 wants to merge 23 commits into
mainfrom
fix/transcript-notification-fold

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Found by the main-flow shadow reconciliation (kimi-code-app#279): a background-task completion notice that arrives mid-turn is persisted as a task-origin user message, and the cold rebuild (groupMessagesIntoSnapshot) opened a NEW turn for each one — splitting the logical turn and reordering user/assistant chat turns, while the live projector folds them into the open step as role:'user' text frames.

Now the cold path matches the live path: a task/background_task/task_notification user message whose previous message is assistant/tool output folds into the current turn as a taskId-keyed user text frame; otherwise (idle — the engine really does open a task turn) it keeps opening its own turn, preserving the legacy behavior locked by the existing test.

Tests: new cold-path case (notification between assistant messages folds in, one turn, taskId kept) + the existing legacy-behavior case both green; transcript package 79 green, typecheck/lint/no-comments clean.

@pkg-pr-new

pkg-pr-new Bot commented Aug 19, 2026

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

commit: 2f795cc

@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: 71c345b4c4

ℹ️ 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".

Comment thread packages/transcript/src/history/groupTurns.ts Outdated
@changeset-bot

changeset-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2f795cc

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

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 30a206bd4d

ℹ️ 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".

Comment thread packages/transcript/src/history/groupTurns.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

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

ℹ️ 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".

Comment thread packages/transcript/src/history/groupTurns.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 709ca5b0d3

ℹ️ 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".

Comment thread packages/transcript/src/history/groupTurns.ts Outdated
Comment thread packages/kap-server/src/services/transcript/transcriptService.ts
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 18330dae81

ℹ️ 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".

Comment thread packages/transcript/src/history/groupTurns.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

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

ℹ️ 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".

Comment thread packages/transcript/src/history/groupTurns.ts Outdated
Comment thread packages/transcript/src/history/groupTurns.ts Outdated
Comment thread packages/transcript/src/history/groupTurns.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 1ca99dae34

ℹ️ 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".

Comment thread packages/transcript/src/history/groupTurns.ts Outdated
Comment thread packages/transcript/src/history/groupTurns.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

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

ℹ️ 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".

Comment thread packages/kap-server/src/services/transcript/coreEventMap.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 85caf6d59f

ℹ️ 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".

Comment thread packages/kap-server/src/services/transcript/transcriptService.ts Outdated
@wbxl2000
wbxl2000 force-pushed the fix/transcript-notification-fold branch from 74bb90e to bc9a862 Compare August 20, 2026 11:07
@wbxl2000
wbxl2000 force-pushed the fix/transcript-notification-fold branch from bc9a862 to 11f9cd0 Compare August 20, 2026 18:47
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 2f795ccac7

ℹ️ 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".

Comment on lines +37 to +39
readonly model?: string;
/** Thinking effort of the spawned subagent (`subagent.spawned`). */
readonly thinkingEffort?: string;

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 Add subagent fields to the task wire schema

The projector now populates model and thinkingEffort, but transcriptTaskSchema does not declare either property. Because Zod objects strip unknown keys, REST and WebSocket consumers parsing transcriptResponseSchema or transcriptOperationSchema lose both fields, so the newly exposed metadata never reaches schema-driven clients. Add both optional properties to the package-owned task contract schema.

AGENTS.md reference: packages/transcript/AGENTS.md:L3-L3

Useful? React with 👍 / 👎.

Comment on lines +1335 to +1339
const prompt = this.upsertPrompt(event.promptId, () => ({
promptId: event.promptId,
status: 'running',
createdAt: nowIso(),
}));

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 active prompt details on the event path

When the transcript binding already exists before a normal prompt submission, the first immediately launched prompt is initialized only by prompt.accepted; prompt.queued is not emitted, and the terminal handlers merely preserve the previous fields. This initializer omits both userMessageId and content, so the same prompt is complete when discovered through livePromptBackfill but remains permanently partial when observed from submission onward. Carry the admitted prompt details in the event or project the submission into the transcript store.

AGENTS.md reference: packages/transcript/AGENTS.md:L23-L23

Useful? React with 👍 / 👎.

const prompt = this.upsertPrompt(event.promptId, () => ({
promptId: event.promptId,
status: 'queued',
content: event.content,

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 Normalize queued prompt content before exposing it

When a queued prompt contains uploaded image, video, or session-media content, this stores the engine ContentPart[] directly, including internal image_url/kimi-file:// representations, instead of the public message-content shape used by the prompt routes and steer projection. The late-attach backfill repeats the same direct assignment, so transcript clients receive internal and path-dependent content; apply projectPromptContentParts in both paths.

AGENTS.md reference: packages/transcript/AGENTS.md:L23-L23

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.

1 participant