fix(transcript): fold mid-turn task notifications into the current turn on cold rebuild - #3102
fix(transcript): fold mid-turn task notifications into the current turn on cold rebuild#3102wbxl2000 wants to merge 23 commits into
Conversation
commit: |
There was a problem hiding this comment.
💡 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".
🦋 Changeset detectedLatest commit: 2f795cc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
74bb90e to
bc9a862
Compare
…rn on cold rebuild
…ndaries, not the previous message role
…ack when the wire has no turn.started records
…reserve legacy background_task turns absent from the boundary set
…-block tag, not just the tag lines
…truncate only at output blocks
…step, cold and live
…ued engine events
…from the live loop state
…e client renders from
…align stream expectations with prompt.accepted on the bus
…rects to the task row
bc9a862 to
11f9cd0
Compare
|
@codex review |
There was a problem hiding this comment.
💡 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".
| readonly model?: string; | ||
| /** Thinking effort of the spawned subagent (`subagent.spawned`). */ | ||
| readonly thinkingEffort?: string; |
There was a problem hiding this comment.
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 👍 / 👎.
| const prompt = this.upsertPrompt(event.promptId, () => ({ | ||
| promptId: event.promptId, | ||
| status: 'running', | ||
| createdAt: nowIso(), | ||
| })); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 👍 / 👎.
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.