Skip to content

fix(agent-core-v2): pair steered follow-ups by reserved message id - #3891

Merged
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:refact-244-09-18-steer-append-pairing
Sep 18, 2026
Merged

sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:refact-244-09-18-steer-append-pairing

Conversation

@sailist

@sailist sailist commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

Follow-up to #3262 / bug-097. Steered follow-ups were still joined to append_message by matching whole-message content.

Problem

turn.steer used to fire when a prompt left the queue, before that text entered context. Transcript, history, and fork then treated that event as an in-turn user message and had to guess which later append_message it belonged to by JSON.stringify / text equality. Same-text steers, abort-then-reissue, and append-before-steer order all broke that guess.

These are two states, not two copies of one fact: steered-but-not-in-context, then actually appended.

What changed

  • Reserve the context messageId when the prompt is steered (prompt.steered).
  • Append that message, then emit turn.steer with the same messageId / promptIds.
  • Live and cold transcript, plus fork, join by that id. History users stay keyed by prompt identity.
  • Old wires without the id fields still fall back to content matching.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve).
  • 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.

Reserve the context message id when a prompt is steered, emit turn.steer only after that message is appended, and join live/cold transcript plus fork by the id instead of content.
@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a6e7d5d

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 Sep 18, 2026

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

commit: a6e7d5d

@sailist
sailist merged commit 53e5e3f into MoonshotAI:main Sep 18, 2026
16 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 18, 2026
7723qqq added a commit to 7723qqq/kimi-code that referenced this pull request Sep 20, 2026
Compaction pre-shrinks the summarizer's history to the model's
effective window before the first request (MoonshotAI#3911), replayed thinking on
OpenAI-compatible transports rides the declared `reasoning_key` (MoonshotAI#3910),
the catalog endpoints expose each provider's resolved `base_url` (MoonshotAI#3909),
usage telemetry fires for the swarm transition, external hooks,
remote-control toggles and tower entry/exit (MoonshotAI#3897), a steered message
carries its prompt's identity end to end (MoonshotAI#3906 / MoonshotAI#3891), and the rating
survey payload gains the per-turn trace id plus copilot statistics
(MoonshotAI#3907).
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Oct 5, 2026
Step 7 of the incremental sync to 2.1.1: 21 upstream commits over 263
files. 24 conflicts, concentrated in the provider/registry import path
(api_key_env, registry import) and the media-read layer where the fork's
inline media reading sits on top of upstream's ReadMediaFile guidance.

Upstream's changes in this step, all absorbed:
- Stop listing unavailable media tools in subagent menus and clarify
  Read errors for images and videos (MoonshotAI#3878)
- Providers can read their API key from a named environment variable
  (api_key_env in config.toml or the provider API) (MoonshotAI#3762)
- Keep follow-up messages sent during a turn from appearing twice after
  a session reload (MoonshotAI#3896)
- Session index compaction on startup, faster CLI startup, faster
  session list and resume on large workspaces, and incremental
  background search indexing (MoonshotAI#3889)
- Rename kimi install-app to kimi install-desktop, keeping the old name
  as a hidden alias (MoonshotAI#3864)
- Restore thinking display for OpenAI-compatible providers that send a
  reasoning string next to an unrecognized reasoning_details array
  (MoonshotAI#3910)
- Fix kimi -p exiting early and cancelling the active turn when a cron
  task fires (MoonshotAI#3875)
- Drop literal decision clauses from the system prompt and the auto
  permission mode reminder (MoonshotAI#3894)
- select_tools points out already-available tools to call directly and
  suggests announced names for near-miss selections (MoonshotAI#3885)
- Fix deleting or archiving a session sometimes never finishing (MoonshotAI#3887)
- Keep follow-up messages attached to their turn; undo the host turn
  instead of the follow-up alone (MoonshotAI#3891, MoonshotAI#3906)
- Remove the system-prompt rule that forbade all file access outside the
  working directory (MoonshotAI#3879)
- Stop workspace file watchers from scanning an unbounded project root;
  add [watch] enabled / KIMI_CODE_WATCH to disable watching (MoonshotAI#3892)

Fork behaviour that had to survive:
- the i18n layer: the registry-import and provider api_key_env strings
  went through `t()` with en/zh entries (providerApiKey,
  registryAuthRequired, providerAuthRequired, subtitleDefault,
  tokenLabel)
- the fork's inline media reading in the read tool, kept over
  upstream's ReadMediaFile guidance
- the provider/registry import path, where the fork's custom-registry
  flow and upstream's api_key_env support had to be reconciled

The merge also drops the unused READ_MEDIA_FILE_TOOL_NAME constant that
came in with this step (the fork reads media inline), keeping the lint
gate green.

Verified: typecheck clean across every package and app; full suite
17752 passed / 0 failed / 81 skipped / 1 todo; lint 0 errors.
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