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): inherit origin turnPermissionPolicy on yield continuations
Dash9a8f99bf8cfa
diff --git a/docs/dev-rules/maker-core-and-agent-behavior.md b/docs/dev-rules/maker-core-and-agent-behavior.mdindex a03f736642..0c44bf0da1 100644--- a/docs/dev-rules/maker-core-and-agent-behavior.md+++ b/docs/dev-rules/maker-core-and-agent-behavior.md@@ -89,6 +89,8 @@ timeout 不得触发自动换窗或 replay。Codex 当前没有与 Claude `AutoC产品 `done`。同一产品 turn 上的ask_user/plan 内部续段必须等 yield 空闲后再 `turn/start`,不得并发;Stop/close 取消 yield 时,排队中的内部续段必须退出而不是被当成正常空闲继续发送。+ 续段必须继承铸造 claim 时的 `turnPermissionPolicy`,不得把无人值守只读边界+ 重置成普通 Auto。Claude wake continuation 与 Codex yield continuation 先分账,不抽公共模块。## 3. 守住四项核心数据指标diff --git a/packages/maker-core/src/agents/codex/index.test.ts b/packages/maker-core/src/agents/codex/index.test.tsindex 4857aef785..bde70d4396 100644--- a/packages/maker-core/src/agents/codex/index.test.ts+++ b/packages/maker-core/src/agents/codex/index.test.ts@@ -17417,6 +17417,61 @@ describe('CodexAgent yield continuation', () => {await handle.close();});+ it('inherits the origin turnPermissionPolicy on the yield continuation turn', 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-permission-policy',+ model: 'gpt-5.4',+ workingDir: '/repo',+ permissionMode: 'auto',+ });+ const handlers = host.getThreadHandlers();+ if (!handlers?.itemCompleted || !handlers.turnCompleted) {+ throw new Error('expected item and turn handlers');+ }+ const events = await collectYieldEvents(handle);+ const policy: TurnPermissionPolicy = {+ origin: { kind: 'im', channel: 'wechat', taskId: 'task-yield' },+ confirmationSurface: 'desktop',+ forceConfirmToolCall: (_toolName, input) => JSON.stringify(input).includes('rm -rf'),+ };+ await handle.send({ type: 'user', content: 'run typecheck' }, { turnPermissionPolicy: policy });+ handlers.itemCompleted({+ threadId: 'start-thread-id',+ turnId: 'turn-1',+ item: {+ id: 'item-exec-policy',+ type: 'commandExecution',+ command: 'pnpm --filter desktop run typecheck',+ status: 'completed',+ aggregatedOutput: 'Script running with cell ID 226',+ },+ });+ handlers.turnCompleted({+ threadId: 'start-thread-id',+ turn: { id: 'turn-1', status: 'completed' },+ });+ await vi.waitFor(() => {+ expect(yieldTurnStartCalls(host)).toHaveLength(1);+ });+ const [, continuationParams] = yieldTurnStartCalls(host)[0] as [string, Record<string, unknown>];+ expect(continuationParams).toMatchObject({+ approvalPolicy: 'untrusted',+ sandboxPolicy: { type: 'readOnly' },+ });+ expect(continuationParams).not.toHaveProperty('approvalsReviewer');+ expect(events.some((event) => event.type === 'done' && event.turnContinuationId != null)).toBe(true);+ await handle.close();+ });+it('detects Responses/proxy function_call(exec_command) yield output', async () => {const agent = new CodexAgent(createDeps());let turnSeq = 0;diff --git a/packages/maker-core/src/agents/codex/index.ts b/packages/maker-core/src/agents/codex/index.tsindex 0c622d7a7f..6a99880a81 100644--- a/packages/maker-core/src/agents/codex/index.ts+++ b/packages/maker-core/src/agents/codex/index.ts@@ -1183,6 +1183,7 @@ type YieldContinuationClaim = {retryCount: number;originTurnId: string;continuationTurnId: string | null;+ permissionPolicy: TurnPermissionPolicy | null;};const SYSTEM_PLAN_REVIEW_DISMISSAL_REASONS = new Set(['no_listener_attached',@@ -3246,6 +3247,7 @@ export class CodexAgent extends BaseAgent {retryCount,originTurnId,continuationTurnId: null,+ permissionPolicy: activeTurnPermissionPolicy,};yieldContinuationClaims.set(claim.id, claim);activeYieldContinuationId = claim.id;@@ -3376,6 +3378,9 @@ export class CodexAgent extends BaseAgent {[CODEX_INTERNAL_CONTINUATION]: true,throwOnStartFailure: true,signal: abort.signal,+ ...(claim.permissionPolicy+ ? { turnPermissionPolicy: claim.permissionPolicy }+ : {}),};try {await handle.send(