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): ignore nameless yield snapshots until completed
Dashe10e8597eb29
diff --git a/docs/dev-rules/maker-core-and-agent-behavior.md b/docs/dev-rules/maker-core-and-agent-behavior.mdindex d9282d0689..35046e2f81 100644--- a/docs/dev-rules/maker-core-and-agent-behavior.md+++ b/docs/dev-rules/maker-core-and-agent-behavior.md@@ -75,7 +75,9 @@ timeout 不得触发自动换窗或 replay。Codex 当前没有与 Claude `AutoC结算 usage;只有原子挂在该终态边界上的显式 continuation claim 才能挡住产品结束。Codex `functions.exec` yield 没有协议级 execution handle(cell / wait 活在`codex-rs` daemon),近期检测只能是 adapter 内、用真实 rollout fixture 锁死的启发式,- 用来铸造有界 claim,再由宿主确定性开续段让模型 wait 同一 cell。同 turn 或续段里+ 用来铸造有界 claim,再由宿主确定性开续段让模型 wait 同一 cell。无 `id`/`call_id`+ 的 item 只认 `itemCompleted` 快照:`itemUpdated` 不得入账,无 yield marker 的完成+ 必须清掉匿名桶,不得给匿名条目发明身份。同 turn 或续段里后续 `wait` 输出 `Script completed` / `Script terminated` 后视为该 cell 已结算,不得再铸 claim,也不得报 lost-handle。禁止把 `last_agent_message == null` 或开场白当结算判据;cell 跨 turn 存活性未证实前,续段失败必须诚实报 lost-handle,不得 replay 原请求diff --git a/packages/maker-core/src/agents/codex/index.test.ts b/packages/maker-core/src/agents/codex/index.test.tsindex 6f8503c059..33488f5ac4 100644--- a/packages/maker-core/src/agents/codex/index.test.ts+++ b/packages/maker-core/src/agents/codex/index.test.ts@@ -18206,6 +18206,57 @@ describe('CodexAgent yield continuation', () => {await handle.close();});+ it('does not mint a claim from a nameless itemUpdated yield that later completes without a marker', async () => {+ const agent = new CodexAgent(createDeps());+ const host = installFakeHost(agent, (method) => {+ if (method === Method.TurnStart) return { turn: { id: 'turn-1' } };+ return undefined;+ });+ const handle = await agent.startSession({+ sessionId: 'session-yield-nameless-updated-then-finished',+ model: 'gpt-5.4',+ workingDir: '/repo',+ });+ const handlers = host.getThreadHandlers();+ if (!handlers?.itemUpdated || !handlers.itemCompleted || !handlers.turnCompleted) {+ throw new Error('expected item and turn handlers');+ }+ const events = await collectYieldEvents(handle);+ await handle.send({ type: 'user', content: 'run typecheck' });+ handlers.itemUpdated({+ threadId: 'start-thread-id',+ turnId: 'turn-1',+ item: {+ type: 'commandExecution',+ command: 'pnpm --filter desktop run typecheck',+ status: 'inProgress',+ aggregatedOutput: 'Script running with cell ID 226',+ },+ });+ handlers.itemCompleted({+ threadId: 'start-thread-id',+ turnId: 'turn-1',+ item: {+ type: 'commandExecution',+ command: 'pnpm --filter desktop run typecheck',+ status: 'completed',+ aggregatedOutput: 'Exit 0',+ exitCode: 0,+ },+ });+ handlers.turnCompleted({+ threadId: 'start-thread-id',+ turn: { id: 'turn-1', status: 'completed' },+ });+ await waitForExpectation(() => {+ expect(events.some((event) => event.type === 'done')).toBe(true);+ });+ expect(events.find((event) => event.type === 'done')?.turnContinuationId).toBeUndefined();+ expect(yieldTurnStartCalls(host)).toHaveLength(0);+ expect(handle.isTurnRunning?.()).toBe(false);+ await handle.close();+ });+it('emits a terminal error when a later continuation start is rejected without throwing', async () => {const agent = new CodexAgent(createDeps());let turnStarts = 0;diff --git a/packages/maker-core/src/agents/codex/index.ts b/packages/maker-core/src/agents/codex/index.tsindex 3489cf0ca1..63f1875033 100644--- a/packages/maker-core/src/agents/codex/index.ts+++ b/packages/maker-core/src/agents/codex/index.ts@@ -3207,12 +3207,20 @@ export class CodexAgent extends BaseAgent {]);const existing = yieldedExecCellsByTurnId.get(turnId) ?? new Map<string, YieldedExecCell[]>();if (cells.length === 0) {- if (phase === 'completed' && itemId) existing.delete(itemId);+ if (phase === 'completed') {+ // Named completions drop that item. Nameless completions cannot match+ // a prior updated snapshot, so they clear the anonymous bucket rather+ // than invent a synthetic identity.+ if (itemId) existing.delete(itemId);+ else existing.delete('');+ }} else if (itemId) {existing.set(itemId, cells);- } else {+ } else if (phase === 'completed') {// Nameless exec and wait share the same anonymous bucket. A later wait// that is still running must accumulate, not replace the yielded exec.+ // Only completed snapshots are authoritative; nameless itemUpdated+ // cannot later be forgotten without an id.const anonymous = existing.get('') ?? [];existing.set('', dedupeCells([...anonymous, ...cells]));}