Codex Cloud CLI: Resume a Task and Verify Its Files

Use the Codex Cloud CLI to reopen the same task from a new terminal, verify a file with a fresh remote read, and recover if the chat or saved files are missing.

Codex Cloud CLI illustration of Terminal A and Terminal B accessing one Cloud task with the original conversation and resume-fixture.txt.Codex Cloud CLI illustration of Terminal A and Terminal B accessing one Cloud task with the original conversation and resume-fixture.txt.
Illustrative task:resume-fixture-01. Close the first client, reopen the original conversation with the Cloud picker and read resume-fixture.txt to verify handoff-47. Based on OpenAI's Codex CLI release notes and Cloud environments documentation.

You close the terminal after Codex writes a file in a Cloud task. When you open a fresh terminal, you need to know whether you can pick up with that file still in place. With the Codex Cloud CLI, verify the original conversation and use a new tool action to read the file from that task’s workspace before sending another edit.

This tutorial uses a disposable case called task:resume-fixture-01, a file called resume-fixture.txt, and a known value, handoff-47. You’ll create the file, close the client after the turn finishes, reopen the original chat from a second terminal, and read the file. Then you’ll remove the fixture in Cloud. The worked example and its expected observations are illustrative.

Choose a disposable Cloud environment

  1. Use Codex CLI 0.174.0 or a later build that supports the Cloud flags. Sign in with ChatGPT and use the workspace where you already have Codex Cloud access. OpenAI documents the ChatGPT sign-in option and installation methods. Codex CLI overview · Codex CLI installation guide
  2. Choose an existing published environment suitable for a throwaway task. Have its actual environment ID handy. If you only know its display name, the CLI reference documents codex cloud as a way to list environment options. CLI reference
  3. Open a terminal in a scratch location. The exercise needs a writable Cloud task workspace and permission to create and remove one text file there. Use the scratch location for both terminal windows so you can clearly identify which actions you submit to the Cloud chat.

The environment ID chooses the prepared setup for a new task. Each task has its own workspace. Two tasks can start from the same published environment and acquire different files as work proceeds. For the first launch, the environment ID is the input you need. On return, the opening message and creation turn let you identify the particular chat that holds your work. Codex Cloud overview

A published environment starts a task from its prepared filesystem. An existing task can continue with its own saved files, including uncommitted changes. The exercise needs resume-fixture.txt to be absent from the prepared filesystem. If the prepared setup already contains the fixture, a fresh task could return the same text even though it never ran the creation prompt. The first prompt checks for a collision so you can leave an existing file alone. Cloud environments

Have the environment ID and the case label available when you move between terminals. The ID goes in the launch command. The label goes in the opening prompt and gives you distinctive text to look for in the reopened conversation. task:resume-fixture-01 is the example’s label. If you see an actual task reference in the client, keep it alongside the label so you can distinguish two rehearsals that started with the same prompt.

OpenAI’s December 4, 2026 release of Codex CLI 0.174.0 documents interactive launch with --cloud, --env for choosing a new chat’s environment, and codex resume --cloud for reopening a Cloud chat. The release also says the terminal remembers the selected environment per project. Supply the ID explicitly during each new-task launch in this exercise so both launches use the setup you intend. OpenAI release notes

OpenAI Codex CLI 0.174.0 release page on GitHub.
OpenAI's Codex CLI 0.174.0 release page on GitHub. · Original source

Create the fixture and exit the first terminal

  1. Run the command below in Terminal A. Replace YOUR_ENV_ID with the disposable environment’s actual identifier. Keep the quotes so the shell passes the value as one argument.
  2. After the interactive Cloud chat opens, paste the creation prompt into the Codex composer. Wait for the turn to finish. Inspect the file operation and read-back in the turn’s activity where available, and check that the report identifies the path and the expected contents.
  3. Keep a note of the opening message and, if visible, the chat title or task reference. Submit /exit in the Codex composer and confirm you’re back at the shell. The CLI reference documents /exit as a way to close the interactive session. CLI reference
codex --cloud --env 'YOUR_ENV_ID'
Case task:resume-fixture-01. In this Cloud task's working directory, check whether resume-fixture.txt already exists. If it does, report the collision and stop without changing it. Otherwise create resume-fixture.txt with exactly the text handoff-47, with no trailing newline. Read the file back from disk and report the path and exact contents. Change only this fixture in the Cloud task.

The first read establishes what was on disk before you closed the client. Compare the reported path with the working directory shown in the operation. For the worked case, the intended path is resume-fixture.txt directly in the task’s working directory. If the agent placed the fixture in a subdirectory, identify the exact location before leaving and use that path in the resumed read and cleanup prompts. A read of a similarly named file in a second directory would answer a different question.

The marker is short enough to compare by eye and contains no project data. The no-newline instruction makes the intended contents precise. A terminal can display a trailing newline ambiguously, so if you need exact byte verification, ask the agent to expose the byte count or line ending from the read. The expected payload is ten ASCII bytes with no terminating newline. An assistant message that formats the marker on its own line gives you the text to compare, while the underlying operation supplies the evidence about its bytes.

If the creation turn reports that the fixture already exists, leave that file in place. For a clean example, start a fresh task in another disposable environment where the path is absent. If the write is denied, inspect the error and confirm you chose a workspace where you can create and remove the fixture. A collision gives you a readable path whose origin is uncertain. A write denial leaves you without the initial read-back the exercise needs. Cloud environments

A terminal disconnect before the turn finishes leaves the creation result uncertain. Follow the reconnect procedure below and look for a completed write and read-back when history catches up. The write may already have landed even if the reply never appeared in Terminal A. If the recovered history is incomplete, ask for a read of the path before sending the creation prompt again. Once the path and value are established, you can close the first client and move to the fresh terminal.

Resume the original chat and read the file

  1. Open Terminal B in your scratch location and run the resume command. Select the original Cloud chat. If the picker entry is ambiguous, open a likely entry and check the conversation before submitting the read. Look for the opening task:resume-fixture-01 message and the completed creation turn.
  2. Paste the read prompt into that chat. Confirm that this new turn runs a file-reading operation at the expected path. Keep the expected value out of the prompt so the requested operation can supply the answer.
  3. Compare the fresh tool output with handoff-47. Count the exercise as a pass when the original conversation is visible and a fresh read returns the expected contents without a write. Expand the available activity if the tool details are collapsed. If you cannot establish that the read happened, leave the result unconfirmed.
codex resume --cloud
In this Cloud task's working directory, use a file-reading tool or command to read the existing resume-fixture.txt from disk now. Report the path you read and the exact contents from that operation. If the file is missing or the read fails, report the error and stop. Do not create, recreate, edit, or move the file. Do not answer from the earlier conversation.

Codex Cloud CLI sequence in which Terminal A creates a fixture and Terminal B reopens the same Cloud task and reads the file.Codex Cloud CLI sequence in which Terminal A creates a fixture and Terminal B reopens the same Cloud task and reads the file.
Illustrative client handoff. The environment sets up a new task, while the Cloud picker returns Terminal B to the original conversation. Based on OpenAI's release notes and Cloud environments documentation.

The old creation turn identifies both the chat and the file you expect to find. The new tool result shows what that workspace can read now. Watch for a summary that says the file “still contains” the marker with no accompanying read, or a file reference that points back to the old tool result. In either case, ask for the read again if the task can still run tools. If the fresh read returns different contents, compare the path and look for intervening changes before diagnosing what happened to the original file.

Use the table as you run the example. The wrong-chat row is a read-only comparison for a second disposable task in the same environment. Run it before cleanup if you want to see the original file present and the second task’s copy of the same path missing. Launch the second task with the same environment ID and send only the read prompt. Leave the second task as found after reading it. Cloud environments

Input Action Expected result
task:resume-fixture-01, Terminal A, fresh Cloud workspace, resume-fixture.txt initially absent Run codex --cloud --env 'YOUR_ENV_ID' with the real ID, then send the creation prompt. Wait for the read-back and enter /exit. The completed first turn reads resume-fixture.txt and returns handoff-47. The first interactive client closes after the completed turn.
task:resume-fixture-01, Terminal B, the original Cloud chat from Terminal A Run codex resume --cloud, select the original chat, confirm the opening message and send the read prompt. The original creation turn is visible and a fresh tool read of resume-fixture.txt returns handoff-47 without modifying the file.
task:resume-fixture-01, wrong-chat check, another fresh task in the same environment with no fixture creation turn Launch codex --cloud --env 'YOUR_ENV_ID' with the same ID and send only the read prompt. The first task’s creation turn is absent and the fresh workspace should report the fixture missing, assuming the prepared filesystem lacks it and nothing else created it.

A similarly titled chat can lead you into a healthy workspace with entirely different work. If the history lacks your opening message, exit that chat and return to the Cloud picker. When you’ve run the example twice with identical prompts, the case label alone can match both. Use the task reference if you recorded it, or compare the creation turn and when you opened it before proceeding. Keep the original task and the wrong-chat comparison open only as long as you can tell which one you’re addressing.

Interpret a matching read in the second task as a reason to investigate. First check whether you actually launched a new chat. If you did, check whether the environment’s prepared contents changed between launches or whether the read used a different path. Read-only comparisons preserve both workspaces while you sort out what happened. Deleting the unexpected file or creating another copy would erase information about the discrepancy.

The terminal commands open clients for this exercise. File creation, verification and cleanup belong in the Cloud chat composer. Leave the diff in Cloud throughout. OpenAI documents codex apply as the operation that would take a Cloud diff into your local working tree. CLI reference · Agent harness field map

Recover a disconnect, missing chat or missing file

What you see First action When to move on
Terminal still open with a Cloud disconnect Give automatic reconnection a chance. If it fails, press Ctrl+R in the disconnected client. Inspect the recovered history for the last completed turn before sending a prompt again.
Cloud picker opens but you cannot identify the original chat Check the signed-in workspace and Cloud access. Look for the same task on the web if you can identify it there. If the original chat remains unavailable, record that outcome and start a fresh disposable fixture task when access permits.
Original history loads but a fresh read reports the file missing Compare the path with the creation turn, check intervening edits and check the saved VM state window. If the saved state is unavailable, repeat the fixture in a new disposable task and record which attempt failed.
File read is denied or fails before returning contents Inspect the error and confirm the task can access the workspace and recorded path. Retry the read after authorized access is restored. Until a read completes, the file’s presence is unconfirmed.

For a broken connection in an open client, wait for automatic reconnection. The release notes say the terminal can recover missed replies, preserve the draft and wait for history to catch up before sending queued messages. Use Ctrl+R if automatic reconnection fails. The CLI reference also documents Ctrl+R for prompt-history search in ordinary interactive use. After you deliberately exit the client and return to the shell, use codex resume --cloud. OpenAI release notes · CLI reference

Once the connection is back, inspect the latest completed activity before sending more work. If the interrupted turn was Terminal A’s creation turn, look for the write and its read-back. If the interrupted turn was Terminal B’s verification, look for the new read and its result. When the result remains missing, the read prompt is a safe action to repeat because it asks for the current file and stops at an error. Confirm that any queued copy has finished before submitting another. You Can’t Replay What You Can’t See

If the picker is missing the chat, check access before treating the files as lost. codex login status prints the CLI’s active authentication mode. Use it to identify a sign-in discrepancy, then check the ChatGPT workspace where the task was created and your access to its Cloud environment. If you can find the original task on the web, open it and compare its first turn with your notes. In Enterprise workspaces, OpenAI documents a workspace permission for using Codex in the cloud and separate access controls for shared environments. CLI reference · Cloud environments

The error from a fresh read matters. A missing-path result calls for comparing the exact location with the creation turn and checking whether later activity renamed or removed the file. A permission error calls for confirming authorized access to the working directory and path. If the task can’t run the tool at all, wait until the workspace is available or use the fallback below. Preserve the exact error when you record the outcome so your next check starts with the condition you actually observed.

Codex Cloud saved-state stat tile showing the default window of up to seven days from the last turn start or task resume.Codex Cloud saved-state stat tile showing the default window of up to seven days from the last turn start or task resume.
OpenAI documents a default saved VM state recovery window of up to seven days after the last turn start or task resume. Source: ChatGPT Learn, Cloud environments, checked December 4, 2026.

OpenAI documents a default saved VM state recovery window of up to seven days after you last start a turn or resume the task. If the conversation reopens and the file check fails, use the last known turn start or resume when judging how old the saved state was before you tried to return. For a first rehearsal, run the fresh-terminal check soon after the initial turn. For an older task, use the documented window as context and the actual read for the availability decision. Cloud environments

If the original chat or its working state remains unavailable, start a new disposable task with the same explicit environment ID once you have access. Send the creation prompt, wait for its read-back, exit and reopen that new task through the picker. Write down the outcome of the original attempt before testing the replacement. A passing replacement confirms that you can perform the handoff on that task. For actual work, recover from a committed change or separately saved output when available. OpenAI recommends committing important work or saving the output you need. Cloud environments · Hybrid Agent Fleets

Remove the verified fixture in Cloud

  1. Return to the disposable Cloud chat that passed the fresh read. Confirm this is the task where the creation turn wrote the fixture, and confirm the path from the completed read. If a replacement task also passed, apply the same cleanup to its own verified fixture when it is accessible.
  2. Submit the cleanup prompt. Inspect the delete action and the subsequent check that the path is absent. If the check before deletion reports changed contents or an unexpected path, leave the file where it is and inspect the reason.
  3. Exit the Cloud client with /exit after the cleanup turn finishes. The wrong-chat comparison needs no deletion if it reported the expected missing file.
In this Cloud task, check the same resume-fixture.txt path that we just verified. If it is still the fixture we created and its contents match handoff-47, remove only that file in this Cloud workspace. Then check that the same path is absent and report the result. If the path is missing, points elsewhere, or the contents differ, report what you found and stop without deleting anything.

Check the same path the resumed read used. If a delete message is followed by an error during the existence check, ask the task to check that one path again without touching other files. If the client disconnected during cleanup, recover the chat and inspect the completed activity first. A fresh absence check can finish the exercise even if the initial delete reply was lost. If the workspace is unreachable, record cleanup as unconfirmed for that attempt and keep the local working tree untouched.

For a real coding handoff, pick one file whose current state matters to the next edit. If the prior turn changed a setting, ask for a fresh read of that setting at the recorded path and compare the value with the checkpoint you approved. If the value differs, inspect the current file before asking the agent to continue from the older plan. Use the conversation to recover why you chose the change and the new tool output to decide what the next edit should use. Write a Finish Line the Transcript Can Prove

Sources

Many assistants.
One place to remember.

Bring your AI sessions, context, and usage together with Automater.

Meet Automater