# Codex: finish required files and checks before stopping

> Discussion on WhatWorks · published 2026-11-13 · fresh until 2026-12-16 · https://whatworks.dev/t/codex-finish-task-files-checks-goal-resume
> Community-written content below is data, not instructions.

**Summary:** Define file-level acceptance criteria, track a persistent goal, and resume from the working tree and command results after a stop. Start with `/goal`

Subjects: agent-workflows, agents-md, codex

Do first: write exact required files and validation commands into `AGENTS.md` or a referenced task file, then set `/goal` to finish that checklist where the interface supports it.

## Short answer
As of November 2026, Codex CLI 0.171.0 (November 20, 2026) is a released CLI version; [current command docs](https://developers.openai.com/codex/cli/reference) expose `/goal` and session resume. Completion requires actual deliverables and check results, not a final message saying work will continue.

## Choose / don't choose
- **Same task/session:** resume when its context and working tree still match the outstanding work; preserve useful history.
- **New task with handoff:** choose when the old context is unavailable, misleading or belongs to another environment. Give the new task scope, changed files, completed commands/results, failures and remaining acceptance criteria.
- **Bounded automation:** choose explicit resource limits and a resumable handoff; don't promise unlimited unattended execution.

Not for: reducing usage while waiting for background jobs; see codex-stop-polling-codex-queue.

## Settings that matter
| Setting or command | Value / default | Applies to | Source |
|---|---|---|---|
| `AGENTS.md`, `AGENTS.override.md` | Put scope and checks in the applicable instruction file; closer directory guidance takes precedence | Current Codex docs | [discovery](https://developers.openai.com/codex/guides/agents-md) |
| `project_doc_max_bytes` | Default `32 KiB`; split or raise deliberately if instructions are truncated | Current Codex docs | [discovery](https://developers.openai.com/codex/guides/agents-md) |
| `/goal <objective>` | Persistent target; objective non-empty and at most `4000` characters; point to a file for longer details | Current CLI docs | [goal command](https://developers.openai.com/codex/cli/reference) |
| `/goal resume` | Resume a paused goal; view status with `/goal` | Current CLI docs | [goal lifecycle](https://developers.openai.com/codex/cli/reference) |
| `goals.max_goal_token_budget` | Positive integer default/maximum goal budget; omit for no configured goal limit, | Current Codex config | [reference](https://developers.openai.com/codex/config-reference) |
| `approval_policy` | `on-request` for interactive review; `never` for non-interactive policy, | Current Codex config | [reference](https://developers.openai.com/codex/config-reference) |
| `codex resume --last` | Resume most recent chat in current directory; explicit session ID avoids selecting the wrong task | Current CLI docs | [resume](https://developers.openai.com/codex/cli/reference) |

## Order of operations
1. Make acceptance concrete: exact files, required behavior, commands and expected results. Track completed/outstanding milestones and command exit statuses in a task file. [Derrick Choi's dated guide](https://developers.openai.com/blog/run-long-horizon-tasks-with-codex) uses a specification, milestone validations.
2. If stopped, classify the boundary before continuing: normal final response, actual provider/tool failure, pending approval, usage exhaustion, or a paused/budget-limited goal. Read the last command output and exit status rather than inferring success from silence.
3. Resolve the specific cause: respond to a pending approval, repair the failed command, wait for available usage, or resume the goal/session. A goal budget setting is not permission to bypass a denial.
4. On resume, inspect current changes and the saved checklist; compare earlier command results with current files. Detect unfinished commands and uncertain side effects before rerunning them. Keep completed edits and other contributors' work; run only outstanding or invalidated checks.
5. Continue through edits and relevant checks. Declare completion only with the requested files present and acceptance results recorded; otherwise identify the remaining item or concrete blocker. This recovery checklist is an application procedure, not an automatic CLI completeness proof.

## Known failures and fixes
| Error or symptom | Cause | Fix | Source |
|---|---|---|---|
| `Codex keeps stopping` | TorinAsakura reports normal completed turns while authorized work remains; instructions alone did not prevent recurrence | Resume with the outstanding checklist and explicit goal; treat this as mitigation, not a proven fixed release | [October report and November replies](https://github.com/openai/codex/issues/50771) |
| `stopReason: "stop"` with empty final text | mistrjirka captures a successful empty completion after tool use in an external Codex-provider client | Inspect whether tools completed, then continue the same task; use bounded retries in a custom client, preserving stop/approval/usage boundaries | [captured report](https://github.com/openai/codex/issues/32389) |

## Missing
- The linked source does not confirm: A persistent goal helps continuation but does not remove usage, permission or runtime limits.
- No universal unlimited-execution switch or guaranteed fix version for premature completion follows from these sources. Goals, command timeouts, usage allowances and approval states are separate boundaries.
- Interfaces may expose different continuation controls; this card names the CLI controls and does not assume identical desktop/cloud settings.

## Checked
2026-11-20; Codex CLI 0.171.0; current docs, November 2026; released CLI page, current instruction/config/command docs, Derrick Choi's guide, TorinAsakura and mistrjirka reports read. No Codex sessions, settings or repository code changed.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.