Skip to content

fix(agent-core-v2): degrade idle-session steer to turn launch like v1 - #2723

Open
sailist wants to merge 1 commit into
MoonshotAI:mainfrom
sailist:fix/steer-goal-turn-boundary
Open

fix(agent-core-v2): degrade idle-session steer to turn launch like v1#2723
sailist wants to merge 1 commit into
MoonshotAI:mainfrom
sailist:fix/steer-goal-turn-boundary

Conversation

@sailist

@sailist sailist commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — the problem is explained below.

Problem

Sending a message (steer) while a goal run is between turns — or on an idle session — made v2 reject with a spurious prompt.not_found ("Failed to steer") error. v1 treats an idle steer like a prompt: it launches a fresh turn and updates the session title/lastPrompt. v2's steer RPC enqueues first, and the enqueue itself already launches the turn when nothing is pending, so the follow-up steer-by-id could never find the record pending and rejected. The v2 path also never synced the title/lastPrompt metadata.

What changed

  • packages/agent-core-v2/src/agent/rpc/rpcService.ts: when the enqueued message is no longer pending (the enqueue already launched it as its own turn), return that turn instead of rejecting — v1's steer-degrades-to-launch end state. When the message is pending but there is nothing active to steer into (a manual compaction holds the context), report it as queued (undefined) instead of failing, since it launches once compaction finishes. Also sync title/lastPrompt metadata on main-agent steer, matching v1's prompt behavior.
  • packages/node-sdk/src/sdk-rpc-client-v2.ts: update the steer facade doc comment to describe the converged v1/v2 behavior.
  • packages/node-sdk/test/v1-v2-parity.test.ts: replace the pinned-divergence test with one asserting both engines launch a turn and update metadata on an idle-session steer.

This approach keeps the fix at the RPC boundary, matching v1 semantics without changing the underlying prompt/steer pipeline.

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.

- return the enqueue-launched turn instead of rejecting with
  prompt.not_found when no prompt is pending at steer time
- report steer as queued when a manual compaction holds the context
- sync title/lastPrompt metadata on main-agent steer, matching v1
- update the v1-v2 parity test to assert converged behavior
@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8110bdc

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

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

commit: 8110bdc

@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: 8110bdc3ec

ℹ️ 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 +132 to +133
const turn = await queued.launched;
return turn === undefined ? undefined : { turn_id: turn.id };

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 steer history when degrading to launch

When this branch is taken for an idle session, queued.launched is the turn started by promptService.enqueue(); that path uses a PromptStepRequest, and LoopService.startTurn persists a turn.prompt record. v1 AgentTurn.steer() records turn.steer before launching, so the v2 call now succeeds while history/transcript consumers see it as a normal prompt instead of a steer. Use a steer launch path for this degradation rather than returning the enqueue-launched prompt.

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