TECHNOLOGY

Resume a Codex automation with explicit external state

In this article
THE QUICK TAKE

Resuming restores a conversation path; reliable continuation also requires checking the current workspace and the application’s continuing ownership of the task.

Codex exec can continue a noninteractive session through its resume subcommand. This is useful when investigation and implementation happen in separate stages. The key design choice is deciding which state comes from the conversation and which facts must be read again from the current environment.

Select the intended session

The documentation supports continuing the last session or addressing a particular session identifier. A personal terminal workflow can use the former, while an application coordinating several jobs should retain an explicit association. The following commands illustrate both shapes; SESSION_ID is a placeholder for an identifier obtained from the actual session.

codex exec "Investigate why the export fixture fails"
codex exec resume --last "Apply the smallest supported fix and run the fixture"
codex exec resume SESSION_ID "Continue using the current repository state"

Reconcile conversation and filesystem state

Suppose the first stage identified a failing export fixture. Before implementation resumes, another developer changes the parser. The previous explanation remains useful history but is no longer sufficient evidence of the present code. Read the relevant diff and rerun the narrow fixture before applying a repair based on an earlier implementation.

Retain a durable intermediate artifact

A compact investigation note can identify the fixture, relevant source paths and the unresolved hypothesis. Store it as an artifact the resumed task can inspect. It should describe evidence rather than prescribe an unverified patch. This is particularly helpful when the next stage runs through a different scheduler or after a human has reviewed the initial findings.

Keep the different state stores visible

A saved conversation and a job record are related but separate objects. The scheduler might cancel the job while the conversation remains resumable. The current working tree can also change without a new conversation turn. A state map makes these relationships explicit before the automation takes the next step.

State locationWhat it contributesWhat to recheck on continuation
Saved conversationEarlier requests and investigationWhether the objective has changed.
Working treeActual files and uncommitted editsWhether another process changed relevant files.
Test artifactReproducible input and expectationWhether the fixture still exercises the current code.
Application job recordOwnership and scheduling stateWhether this job should still be resumed.

Write a continuation result that explains the transition

The final handoff can state what was reused from the investigation, what was rechecked and which artifact now contains the change. This distinguishes a continuation from repeating the first stage blindly. A proposed test can alter a relevant file between stages and verify that the resumed workflow observes the new state before choosing an implementation.

Documentation and further study

Related engineering guides: Reproducible inference stacks: preserving a GPU pilot’s result; Choose a local AI stack: desktop chat, shared UI or coding agent.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles