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): keep nameless yield cells across unmarked siblings
Dashae450b8cc0d4
diff --git a/docs/dev-rules/maker-core-and-agent-behavior.md b/docs/dev-rules/maker-core-and-agent-behavior.mdindex 965812268e..b79b3405c8 100644--- a/docs/dev-rules/maker-core-and-agent-behavior.md+++ b/docs/dev-rules/maker-core-and-agent-behavior.md@@ -76,8 +76,8 @@ timeout 不得触发自动换窗或 replay。Codex 当前没有与 Claude `AutoCCodex `functions.exec` yield 没有协议级 execution handle(cell / wait 活在`codex-rs` daemon),近期检测只能是 adapter 内、用真实 rollout fixture 锁死的启发式,用来铸造有界 claim,再由宿主确定性开续段让模型 wait 同一 cell。无 `id`/`call_id`- 的 item 只认 `itemCompleted` 快照:`itemUpdated` 不得入账,无 yield marker 的完成- 必须清掉匿名桶,不得给匿名条目发明身份。匿名 `wait` 若按 `cell_id` 结算了其中一个+ 的 item 只认 `itemCompleted` 快照:`itemUpdated` 不得入账,不得给匿名条目发明身份。+ 无 yield marker 的 nameless 完成不得清匿名桶;匿名 `wait` 若按 `cell_id` 结算了其中一个cell,只从匿名桶拿掉该 cell,不得清空仍在跑的其它匿名 cell。同 turn 或续段里后续 `wait` 输出 `Script completed` / `Script terminated` 后视为该 cell 已结算,不得再铸 claim,也不得报 lost-handle。Plan Mode 审批只在产品终态跑:存在 awaitingdiff --git a/packages/maker-core/src/agents/codex/index.test.ts b/packages/maker-core/src/agents/codex/index.test.tsindex c7b0c713cb..77a8e403a1 100644--- a/packages/maker-core/src/agents/codex/index.test.ts+++ b/packages/maker-core/src/agents/codex/index.test.ts@@ -17767,6 +17767,68 @@ describe('CodexAgent yield continuation', () => {await handle.close();});+ it('keeps a nameless yielded exec_command when a later nameless exec completes without a marker', async () => {+ const agent = new CodexAgent(createDeps());+ let turnSeq = 0;+ const host = installFakeHost(agent, (method) => {+ if (method === Method.TurnStart) {+ turnSeq += 1;+ return { turn: { id: `turn-${turnSeq}` } };+ }+ return undefined;+ });+ const handle = await agent.startSession({+ sessionId: 'session-yield-nameless-sibling-exit',+ model: 'gpt-5.4',+ workingDir: '/repo',+ });+ const handlers = host.getThreadHandlers();+ if (!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.itemCompleted({+ threadId: 'start-thread-id',+ turnId: 'turn-1',+ item: {+ type: 'function_call',+ name: 'exec_command',+ arguments: JSON.stringify({+ cmd: 'pnpm --filter desktop run typecheck',+ yield_time_ms: 10_000,+ }),+ content: [{ type: 'output_text', text: 'Script running with cell ID 229' }],+ },+ });+ handlers.itemCompleted({+ threadId: 'start-thread-id',+ turnId: 'turn-1',+ item: {+ type: 'function_call',+ name: 'exec_command',+ arguments: JSON.stringify({ cmd: 'echo done' }),+ content: [{ type: 'output_text', text: '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' && event.turnContinuationId != null)).toBe(true);+ });+ await vi.waitFor(() => {+ expect(yieldTurnStartCalls(host)).toHaveLength(1);+ });+ const [, params] = yieldTurnStartCalls(host)[0] as [string, {+ input: Array<{ text?: string }>;+ }];+ expect(params.input[0]?.text).toContain('Wait for cell ID 229');+ await handle.close();+ });+it('does not mint a claim after wait settles the yielded cell in the same turn', async () => {const agent = new CodexAgent(createDeps());const host = installFakeHost(agent, (method) => {diff --git a/packages/maker-core/src/agents/codex/index.ts b/packages/maker-core/src/agents/codex/index.tsindex be0f9b7f19..ed8b9cbd56 100644--- a/packages/maker-core/src/agents/codex/index.ts+++ b/packages/maker-core/src/agents/codex/index.ts@@ -3213,16 +3213,12 @@ export class CodexAgent extends BaseAgent {]);const existing = yieldedExecCellsByTurnId.get(turnId) ?? new Map<string, YieldedExecCell[]>();if (cells.length === 0) {- 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 — unless this is a wait that settled- // one cell_id. That wait shares the anonymous bucket with other yielded- // execs; wiping '' would drop still-running cells and skip their claim.- if (itemId) existing.delete(itemId);- else if (extractSettledYieldCellIdsFromCodexItem(item).length === 0) {- existing.delete('');- }+ if (phase === 'completed' && itemId) {+ // Named completions drop that item. Nameless completions share the+ // anonymous bucket; an unmarked sibling (short exec Exit 0) must not+ // wipe still-running cells. Settled waits drop one cell_id via+ // forgetSettledYieldCells below — never delete('').+ existing.delete(itemId);}} else if (itemId) {existing.set(itemId, cells);