From bfec91b5e1d264f87d13529bc993da093135c83e Mon Sep 17 00:00:00 2001 From: Akiiia <74829345+Akiiia@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:20:33 +0800 Subject: [PATCH] fix(codex): start a new goal after the previous one completes (#2338) --- cli/src/codex/shared/root.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cli/src/codex/shared/root.ts b/cli/src/codex/shared/root.ts index ffd3c92a..b7ad5cc7 100644 --- a/cli/src/codex/shared/root.ts +++ b/cli/src/codex/shared/root.ts @@ -640,9 +640,16 @@ export class SharedCodexRoot { if (slash.kind === 'passthrough') return text; if (slash.kind === 'goal') { const params = { threadId: this.threadId }; + const goal = slash.action === 'set' + ? record(record(await this.client.request('thread/goal/get', params)).goal) : null; + if (goal?.status === 'complete') { + await this.client.request('thread/goal/clear', params); + } const response = slash.action === 'show' ? await this.client.request('thread/goal/get', params) : slash.action === 'clear' ? await this.client.request('thread/goal/clear', params) - : await this.client.request('thread/goal/set', { ...params, ...(slash.action === 'set' ? { objective: slash.objective } : { status: slash.action === 'pause' ? 'paused' : 'active' }) }); + : await this.client.request('thread/goal/set', { ...params, ...(slash.action === 'set' + ? { objective: slash.objective, ...(goal?.status === 'complete' ? { status: 'active' } : {}) } + : { status: slash.action === 'pause' ? 'paused' : 'active' }) }); this.notice(JSON.stringify(response)); return null; } if (slash.updates?.proactiveMultiAgent !== undefined) throw new Error('This Codex version uses Ultra reasoning effort instead of a multi-agent toggle');