Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 263b864 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4fc39c871
ℹ️ 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".
| driver.turnId = undefined; | ||
| driver.awaitingContinuation = true; |
There was a problem hiding this comment.
Keep pre-start cancellation from stranding the driver
When cancellation arrives after this branch marks the driver as awaiting but while the next core turn is still in onBeforeSubmitPrompt (before its first public turn.started), AcpSession.cancel() sees no turnId and sends an unaddressed agent.cancel(). Agent-core treats that as a pre-start gate abort, and AgentPromptProjection.gateRejected publishes neither the turn.started nor turn.ended event this driver is now waiting for, so the cancelled session/prompt never resolves. Distinguish handoff from initial launch and defer the cancel until the continuation is adopted, or otherwise settle the driver on pre-start termination.
AGENTS.md reference: AGENTS.md:L111-L115
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| test('keeps session/prompt open across continuation: "turn" and streams the continuation turn under the same prompt', async () => { | ||
| const editor = continuationSession(); |
There was a problem hiding this comment.
Reproduce the lifecycle through the ACP surface
Both new regressions call continuationSession(), an Object.create fake, and then manually inject the ideal turn.ended/turn.started ordering; the cancellation test even guarantees a start after cancellation. They therefore cannot detect real ACP/agent-projection races such as a pre-start cancellation suppressing that start, nor prove that an editor remains busy. Add or extend a tests/e2e scenario with a held real continuation and assert that session/prompt remains pending until the second turn completes.
AGENTS.md reference: AGENTS.md:L61-L61
Useful? React with 👍 / 👎.
| "@moonshot-ai/kimi-code": patch | ||
| --- | ||
|
|
||
| Keep ACP `session/prompt` open across immediate `continuation: "turn"` handoffs so continuation turns stream under the active prompt instead of resolving prematurely with `end_turn`. |
There was a problem hiding this comment.
Synchronize the ACP prompt-lifecycle documentation
This changes the public lifecycle so an immediate background-task or Stop-hook continuation remains inside the active session/prompt, but docs/en/reference/kimi-acp.md:11 and docs/zh/reference/kimi-acp.md:11 still present those turns as updates arriving after the previous prompt has ended and tell clients to retry a new prompt afterward. Update both language pages to distinguish immediate handoffs from later autonomous turns so ACP client authors are not relying on the old request boundary.
AGENTS.md reference: AGENTS.md:L95-L96
Useful? React with 👍 / 👎.
…st, and sync docs
|
Addressed all three Codex review items:
|
Summary
When a background task finishes mid-turn and steers the active turn, the engine emits
turn.endedwithreason: completedandcontinuation: turn, immediately followed byturn.startedfor turnN + 1. Previously,AcpSession.onTurnEndedsettled the activesession/promptdriver immediately with{ stopReason: end_turn }, causing ACP clients to return to idle mid-task while turnN + 1was still running.This PR updates
packages/acp-server/src/session.tsto:TurnDriveropen (awaitingContinuation = true,turnId = undefined) whenturn.endedhasreason === 'completed',continuation === 'turn', and the driver was not cancelled, while still emittingusage_update.turn.startedevent into the activeTurnDriver(preserving deferredcancel()andearlyevent replay) instead of routing it toagentStartedTurnId.Closes #5693
Verification
packages/acp-server/test/turn-failure.test.tscoveringcontinuation: turnstreaming continuity and handoff cancellation (verified RED before fix, GREEN after fix).vitest run test/turn-failure.test.ts: 11/11 passed (including existing e2e background-task and Stop-hook tests).tsc --noEmit: 0 errors.oxlint --type-aware --deny-warnings&check-comments.mjs: passed..changeset/acp-turn-continuation.md.