Repository navigation
Conversation
|
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. |
commit: |
- route abort completion through actor-owned settlement - run step stopping before aborted step and turn endings
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e563adb8af
ℹ️ 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".
| if (isPromiseLike(ending)) { | ||
| ctrl.spawn((proc) => this.finishAfterEnding(proc, at, step, ending)); | ||
| return; |
There was a problem hiding this comment.
Preserve a forced exit from stopping hooks
When an onDidFinishStep/step.stopping handler ignores the already-aborted signal and never resolves, this path leaves the turn in finishing while awaiting it indefinitely. Further forced aborts return immediately because closing is already true, so neither abortGraceMs nor shutdown can settle AgentLoopService.cancel(), loop.settled(), or the turn's done promise. Before this change, aborted drafts bypassed step.stopping; retain the new hook ordering but add a bounded forced-settlement path.
AGENTS.md reference: AGENTS.md:L111-L115
Useful? React with 👍 / 👎.
| ): StepEndingRun | Promise<StepEndingRun> { | ||
| const failures: StepEndingFailure[] = []; | ||
| if (draft.type === 'aborted' || draft.type === 'blocked') return { outcome: draft, failures }; | ||
| if (draft.type === 'blocked') return { outcome: draft, failures }; |
There was a problem hiding this comment.
Add the required core changeset
This commit changes source behavior in the @moonshot-ai/core library but adds no .changeset entry; the existing core changeset describes an unrelated JSONL migration. Without a dedicated patch changeset, this cancellation fix will not be represented in the library's versioning and changelog, contrary to the repository's mandatory library-source workflow.
AGENTS.md reference: AGENTS.md:L169-L170
Useful? React with 👍 / 👎.
| ): StepEndingRun | Promise<StepEndingRun> { | ||
| const failures: StepEndingFailure[] = []; | ||
| if (draft.type === 'aborted' || draft.type === 'blocked') return { outcome: draft, failures }; | ||
| if (draft.type === 'blocked') return { outcome: draft, failures }; |
There was a problem hiding this comment.
Do not start compaction from an aborted step
For users with compaction_trigger_ratio < 0.85, cancelling after context usage crosses that trigger now runs the v2 onDidFinishStep chain for the aborted draft. The built-in full-compaction handler consequently calls checkAutoCompaction(false) and launches a new automatic model request without the aborted step's signal, so pressing cancel can still consume API work and later rewrite the conversation context. Aborted drafts previously returned here before any stopping hook ran; skip completion-only after-step work for aborts or propagate cancellation into the compaction task.
AGENTS.md reference: AGENTS.md:L111-L115
Useful? React with 👍 / 👎.
010a307 to
5e7cc92
Compare
e563adb to
57f0d14
Compare
|
Superseded by #5211. |
Requirement or Bug
abort 活跃 Turn 时,部分路径无法保证 Step/Turn 终态事件完整,晚到的模型结果还可能继续进入正常工具批次或 continue。需要让取消、请求完成、工具完成和 abort grace 到期都经过同一个封闭的 Actor 结算路径。
Bug Reproduction Steps
N/A
Root Cause
Turn 的正常 continuation 与 abort 收尾共享入口,缺少明确的来源阶段和 abort 专用结算,导致晚到结果可以触发正常生命周期副作用,active Step 的 ended 顺序也不完整。
Code Changes
aborting/finishing与abortFrom,在 Actor 内统一处理 abort、晚到请求结果、批次完成与 grace 到期。done + toolCalls只生成 aborted 工具结果,不再执行tool.batch-starting;活跃 Step 不启动新的step.continuing。runStepEnding对 aborted draft 调用step.stopping,但保持 aborted outcome,不允许 hook 反转为 done/continue。TurnStep.ending复用正在进行的 ending,避免 abort 时重复执行step.stopping。owner.ending(at=abort来源)保留 requesting 阶段的 reminder 恢复行为;force abort 只缩短等待,不跳过工具结果或终态事件。Behavior Changes and Affected Users
step.stopping或完整 Step ended 顺序step.stopping → step.ended → owner.ending → turn.ended → done,outcome 始终为 abortedowner.ending → turn.ended → done验证:本地 Turn abort 对抗测试 3/3;core 与 agent-core-v2
tsc --noEmit通过;Linux 远程环境相关回归 53 个文件、633/633;仓库完整 lint 与 diff 检查通过。Checklist
/approve).