From 0cdb1f1c83889381de69f692698be7d0b5959cf9 Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Tue, 25 Aug 2026 15:41:04 +0000 Subject: [PATCH] Harden goal continuation and remove duplicate prompt helpers (#40628) ## What changed - Teach goal continuations to distinguish concrete progress, verified waits on live handles, and turns that made no progress. - Re-poll live work after observation timeouts instead of treating the work as terminal or restarting it, and carry equivalent blockers through the existing blocked audit. - Remove the duplicate goal prompt renderers and templates from `codex-prompts`; goal steering remains owned by the goal extension. GitOrigin-RevId: 4ec64721164743e879ae946a2dd024bba5869fbe --- .../ext/goal/templates/goals/continuation.md | 5 + codex-rs/prompts/src/goals.rs | 110 ---------------- codex-rs/prompts/src/goals_tests.rs | 120 ------------------ codex-rs/prompts/src/lib.rs | 4 - .../prompts/templates/goals/budget_limit.md | 16 --- .../prompts/templates/goals/continuation.md | 51 -------- .../templates/goals/objective_updated.md | 16 --- 7 files changed, 5 insertions(+), 317 deletions(-) delete mode 100644 codex-rs/prompts/src/goals.rs delete mode 100644 codex-rs/prompts/src/goals_tests.rs delete mode 100644 codex-rs/prompts/templates/goals/budget_limit.md delete mode 100644 codex-rs/prompts/templates/goals/continuation.md delete mode 100644 codex-rs/prompts/templates/goals/objective_updated.md diff --git a/codex-rs/ext/goal/templates/goals/continuation.md b/codex-rs/ext/goal/templates/goals/continuation.md index 904d15c266..62391c523c 100644 --- a/codex-rs/ext/goal/templates/goals/continuation.md +++ b/codex-rs/ext/goal/templates/goals/continuation.md @@ -19,6 +19,11 @@ Budget: Work from evidence: Use the current worktree and external state as authoritative. Previous conversation context can help locate relevant work, but inspect the current state before relying on it. Improve, replace, or remove existing work as needed to satisfy the actual objective. +No-progress check: +- Classify the previous goal turn as progress, a verified wait, or no progress. Progress changes authoritative state, completes work, or yields evidence that changes the next action; status restatements and unexecuted plans are no progress. +- A verified wait polls a specific process, session, job, or tool handle confirmed live now. Conversation, intent, prior output, or a lock or state file alone is insufficient. Treat work as stopped only when authoritative state says it is terminal or its handle is missing. An observation timeout or transient polling failure is not terminal: re-poll the same handle or inspect other authoritative state; never restart solely because observation expired. +- Revalidate a no-progress turn and take the next available safe action. If none exists because the same genuine blocker remains, report it and leave the goal active until the blocked audit threshold is met. Treat equivalent blockers as the same condition across turns even when their wording or stated next step changes. + Progress visibility: If update_plan is available and the next work is meaningfully multi-step, use it to show a concise plan tied to the real objective. Keep the plan current as steps complete or the next best action changes. Skip planning overhead for trivial one-step progress, and do not treat a plan update as a substitute for doing the work. diff --git a/codex-rs/prompts/src/goals.rs b/codex-rs/prompts/src/goals.rs deleted file mode 100644 index 5d792d79b2..0000000000 --- a/codex-rs/prompts/src/goals.rs +++ /dev/null @@ -1,110 +0,0 @@ -use codex_protocol::protocol::ThreadGoal; -use codex_utils_template::Template; -use std::sync::LazyLock; - -static CONTINUATION_PROMPT_TEMPLATE: LazyLock