Repository navigation
fix(transcript): keep realigned turn ids unique when folding cold facts - #4658
Merged
wbxl2000 merged 2 commits intoNov 3, 2026
Merged
Conversation
Realigning base turns to their wire ids only skipped ordinals held by turns without a wire id. When an inherited turn held a forked turn's wire id, that turn kept its base ordinal, and the next turn's wire id could land on the same ordinal, so two turns shared a turn id and the later one replaced the earlier in clients. Claim ordinals in order: turns without a wire id or already at their wire id first, then each realigned turn takes its wire id when free, else keeps its ordinal or moves to the next free one.
🦋 Changeset detectedLatest commit: 7c30b66 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
Closed
Grapedge
pushed a commit
that referenced
this pull request
Nov 4, 2026
* fix(tui): read welcome cwd and footer git status from the session environment (#4649) * fix(tui): show remote cwd in welcome panel * fix(tui): read footer git status through the session environment The footer ran git and gh on the local machine, so a remote-bound session hid the git badge. Read branch, working-tree, and pull request state through the SDK instead: a live session's own environment, or the local work dir before the lazy session exists. The local HEAD poll stays as a refresh trigger only. Core git commands now time out after 30s, and the pull request cache is keyed by branch so a branch switch no longer serves the previous branch's pull request. * fix(agent-core-v2): resolve local git and gh outside the working directory GitService spawned bare git and gh with the workspace as cwd. On Windows a bare name is looked up in the cwd before PATH, so a binary planted in the workspace could run, and the TUI footer now reads git status at startup, before the workspace trust gate. Resolve both through PATH for the local environment and refuse any match inside the working directory. * chore: merge changesets for remote cwd and git status * fix(tui): drop the startup Ready. row once startup succeeds The startup progress row turned into a permanent "Ready." line under the welcome panel. Remove it on success; a failed startup still leaves the "Startup failed." row. * fix(agent-core-v2): compare workspace containment case-insensitively on Windows resolveProgramPath compared the PATH candidate against the working directory case-sensitively, so on Windows a PATH entry spelled with different casing (c:\repo\bin vs C:\Repo) let a workspace-local executable through. * fix(tui): keep the footer git badge through a remote disconnect The git cache key included the environment status, so a remote dropping to connecting or disconnected rebuilt the cache and lost the last badge. Key the cache by session and work dir only, and refresh it when the environment turns ready again. * feat: isolate plugin availability by client (#4653) * fix: preserve marketplace descriptions * fix: preserve localized plugin display names * feat: isolate plugin availability by client * fix: preserve cli marketplace loading * fix: harden plugin availability reconciliation * fix: hash plugin marketplace provenance * fix: complete plugin availability reconciliation * fix(transcript): keep realigned turn ids unique when folding cold facts (#4658) * fix(transcript): keep realigned turn ids unique when folding cold facts Realigning base turns to their wire ids only skipped ordinals held by turns without a wire id. When an inherited turn held a forked turn's wire id, that turn kept its base ordinal, and the next turn's wire id could land on the same ordinal, so two turns shared a turn id and the later one replaced the earlier in clients. Claim ordinals in order: turns without a wire id or already at their wire id first, then each realigned turn takes its wire id when free, else keeps its ordinal or moves to the next free one. * chore: add changeset for side chat turn order fix * fix(kap-server): wait for an agent's history before accepting its prompt (#4659) * fix(kap-server): backfill a side chat fork before replying to :btw A fork's inherited history folds into a cold turn at t0, while the live transcript only records it as markers. When the fork's first prompt started before anything read the fork transcript, its live turn took t0; the history backfill then merged the inherited main turn into it by turn id, so the first side chat turn carried the main answer and the real answer landed in a duplicate turn. Finish the fork's history backfill before :btw replies, so the inherited turn holds t0 before the first prompt can start. * fix(kap-server): wait for an agent's history before accepting its prompt Delaying the :btw reply did not order the fork's first prompt after its history backfill: other clients learn the fork from the agent roster as soon as it is created, and checking for a live transcript with forSessionLive created one, so every :btw also waited for the whole main history. Move the wait to prompt submission: a prompt for a non-main agent awaits that agent's history backfill before it is enqueued, which covers every client and leaves :btw unchanged. The backfill is cached per agent, so later prompts do not wait again. * fix: safely launch Windows SSH executors (#4664) * feat: support Windows SSH remote environments * Delete .changeset/windows-remote-environments.md Signed-off-by: 7Sageer <[email protected]> --------- Signed-off-by: 7Sageer <[email protected]> * fix(agent-core-v2): match regional plugin locales (#4666) * fix(plugins): confirm stopping Windows CU processes before install (#4670) * fix(plugins): confirm stopping Windows CU processes before install * test(plugins): cover capability install confirmation contract * fix(plugins): preserve bodyless installs and plugin-only repairs * chore: sync web dist from code-app (#4667) * chore: sync web dist from code-app code-app: 63661fc449e2ec0ce024bc08fe87f2c757d483e8 * chore: sync web dist from code-app code-app: d0e913a6c9607be778c62f0c74ee7310bfb8862a * chore: sync web dist from code-app code-app: b306f4a2f9be8944e5a8064ecb076e3137c968f1 --------- Co-authored-by: kimi-agent-bot <[email protected]> * ci: release packages (#4672) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Signed-off-by: 7Sageer <[email protected]> Co-authored-by: 7Sageer <[email protected]> Co-authored-by: liruifengv <[email protected]> Co-authored-by: qer <[email protected]> Co-authored-by: kimi-agent-bot <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Nov 4, 2026
Port of upstream MoonshotAI/kimi-code e9de788 (MoonshotAI#4658). Realigning base turns to their wire ids only skipped ordinals held by turns without a wire id. When an inherited turn held a forked turn's wire id, that turn kept its base ordinal, and the next turn's wire id could land on the same ordinal, so two turns shared a turn id and the later one replaced the earlier in clients. Claim ordinals in order: turns without a wire id or already at their wire id first, then each realigned turn takes its wire id when free, else keeps its ordinal or moves to the next free one. The added test folds a fork whose inherited turn holds wire id 0 and fails on the pre-change tree with four unique turn ids for five turns.
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Nov 4, 2026
Fifteen rows enter the ledger: the six commits that landed on upstream/main after the last refresh, and the nine commits that reach main only through the release/2026-11-04 sync (MoonshotAI#4674), which is where the 2.5.0 changelog entries come from. Each 2.5.0 row records what it needs from this tree, so the next batch starts from the blocker instead of rediscovering it: - MoonshotAI#4658 and MoonshotAI#4659 are ported (79a4199, 7a531f5) with tests that fail on the pre-change tree. - MoonshotAI#4649 is in_progress: its agent-core-v2 half landed in 2fa7b6b, while the footer and welcome half needs the pull-request API of MoonshotAI#4527 and the session workdir of MoonshotAI#4062. - MoonshotAI#4653, MoonshotAI#4666 and MoonshotAI#4670 build on the MoonshotAI#4525 plugin marketplace, absent here; MoonshotAI#4670 additionally needs isError2. - MoonshotAI#4664 needs the MoonshotAI#4062 remote environments. - MoonshotAI#4667 and MoonshotAI#4672 are generated-bundle and release commits; settling them as not-applicable needs a signature. Rows were appended by a one-off writer because --refresh fetches and that fetch does not complete on this network; the file still parses under the tool's own column contract, and --verify --batch B5 passes both new probes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirement or Bug
侧边对话(BTW)在服务端从磁盘重新读取会话之后(例如服务端重启、会话被空闲回收后再打开),历史会缺轮次或乱序:按顺序问了四个问题,重新打开后第一问不见了,被第二问覆盖。这个 PR 之后,冷读出来的侧边对话轮次编号唯一,顺序和 wire 记录一致。
Bug Reproduction Steps
GET /sessions/{id}/transcript?agent_id=<fork>的轮次编号是t0, t1, t1, t2, t3,两轮共用t1;客户端按 turnId 存轮次,后加载的那轮覆盖了前一轮。Root Cause
foldWireRecordFacts冷读时先用groupMessagesIntoSnapshot按消息分组出基础轮次,再把每个基础轮次重新编号到它在 wire 记录里的 turn id(realignedBaseItems)。fork 出来的 agent 里,继承自主 agent 的历史没有 wire 记录,占用基础编号 0;fork 自己的第一轮在 wire 里也是 0。重新编号时只避让了"没有 wire 记录的轮次"(
keptOrdinals),所以:t0t1keptOrdinals里,改成t1,与第一问撞号#4544 加的已占用编号避让只覆盖后面"补缺失轮次"(
missingTurnIds)那条路径,没有覆盖这一段。本 PR 是根本修复。Code Changes
只改
realignedBaseItems的编号认领顺序:轮次在数组里的顺序不变,只是保证每个轮次最终的 ordinal / turnId 互不相同;能对齐到 wire id 的轮次照旧对齐,startedAt、wedged 等仍按 wire id 查。
Behavior Changes and Affected Users
受影响的是所有走冷读的 transcript 读取:REST
GET /sessions/{id}/transcript在会话未加载时、以及会话加载时的历史回填。主 agent 一般没有"无 wire 记录的继承轮次",不会进入撞号分支;受益的主要是 web / desktop 里的侧边对话。测试:
packages/transcript/test/layers.test.ts新增用例覆盖"继承轮次占用 fork 第一轮的 wire id",断言五轮按顺序、turnId 和 ordinal 都唯一(修复前失败:5 轮只有 4 个不同 turnId);transcript 全部测试和 kap-servertest/services通过。另外在本地用真实会话做了端到端验证:同一份侧边对话记录冷读后由t0, t1, t1, t2, t3变为t0…t4,界面上四问齐全且顺序正确。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.