Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(maker-core): suppress unclaimed Done from foreign yield-turn completions
Dash60d57fd1b7da
diff --git a/docs/dev-rules/maker-core-and-agent-behavior.md b/docs/dev-rules/maker-core-and-agent-behavior.mdindex 605e9d1d35..a03f736642 100644--- a/docs/dev-rules/maker-core-and-agent-behavior.md+++ b/docs/dev-rules/maker-core-and-agent-behavior.md@@ -85,7 +85,8 @@ timeout 不得触发自动换窗或 replay。Codex 当前没有与 Claude `AutoCbest-effort interrupt,再抛/返回取消;`wait` 仍输出 running marker 视为 cell存活证据,重试预算内继续等,不得当空续段报 lost-handle。claim 只归属于铸造它的 origin turn 及其续段 turn;迟到的外族终态(含成功- `completed`)不得结算、取消或 lost-handle 当前 claim。同一产品 turn 上的+ `completed`)不得结算、取消、lost-handle 当前 claim,也不得发出未认领的+ 产品 `done`。同一产品 turn 上的ask_user/plan 内部续段必须等 yield 空闲后再 `turn/start`,不得并发;Stop/close 取消 yield 时,排队中的内部续段必须退出而不是被当成正常空闲继续发送。Claude wake continuation 与 Codex yield continuation 先分账,不抽公共模块。diff --git a/packages/maker-core/src/agents/codex/index.test.ts b/packages/maker-core/src/agents/codex/index.test.tsindex 3a36b8c224..4857aef785 100644--- a/packages/maker-core/src/agents/codex/index.test.ts+++ b/packages/maker-core/src/agents/codex/index.test.ts@@ -18569,6 +18569,8 @@ describe('CodexAgent yield continuation', () => {threadId: 'start-thread-id',turn: { id: 'old-foreign-turn', status: 'failed', error: { message: 'stale turn failed' } },});+ expect(events.filter((event) => event.type === 'done')).toHaveLength(1);+ expect(events.find((event) => event.type === 'done' && event.turnContinuationId == null)).toBeUndefined();expect(handle.beginTurnContinuationWait?.(claimedDone?.turnContinuationId)).toBe('active');expect(handle.isTurnRunning?.()).toBe(true);await handle.close();@@ -18626,6 +18628,8 @@ describe('CodexAgent yield continuation', () => {event.type === 'error'&& String((event.data as { reason?: string }).reason ?? '') === 'yield-continuation-lost-handle'))).toBe(false);+ expect(events.filter((event) => event.type === 'done')).toHaveLength(1);+ expect(events.find((event) => event.type === 'done' && event.turnContinuationId == null)).toBeUndefined();expect(handle.beginTurnContinuationWait?.(claimedDone?.turnContinuationId)).toBe('active');expect(handle.isTurnRunning?.()).toBe(true);await handle.close();diff --git a/packages/maker-core/src/agents/codex/index.ts b/packages/maker-core/src/agents/codex/index.tsindex 6cb65041b9..0c622d7a7f 100644--- a/packages/maker-core/src/agents/codex/index.ts+++ b/packages/maker-core/src/agents/codex/index.ts@@ -8944,6 +8944,12 @@ export class CodexAgent extends BaseAgent {}if (turn.status === 'failed' || turn.status === 'interrupted') {+ const claim = activeYieldContinuationClaim();+ if (claim && !claimOwnsTurn(claim, turn.id)) {+ latestPlanByTurn.delete(turn.id);+ flushDeferredTerminalTurnCompletionsIfIdle();+ return;+ }// 失败 / 中断的 plan turn 不发审批 — 半截计划没有审批意义, 循环就此结束。proposedPlanText = null;planCycleActive = false;@@ -8994,7 +9000,11 @@ export class CodexAgent extends BaseAgent {let yieldClaim: YieldContinuationClaim | null = null;let suppressSuccessfulYieldBoundary = false;if (existingYieldClaim && !claimOwnsTurn(existingYieldClaim, turn.id)) {- // A late foreign completed must not settle or retry the active claim.+ // A late foreign completed must not settle the claim or emit an+ // unclaimed product Done while the continuation is still running.+ latestPlanByTurn.delete(turn.id);+ flushDeferredTerminalTurnCompletionsIfIdle();+ return;} else if (existingYieldClaim?.state === 'awaiting') {yieldClaim = existingYieldClaim;if (yieldedCells.length > 0) {