Recover a Coding Agent Session After a Network Drop
A network drop can leave a coding agent looking frozen, disconnected, or finished when it is not. The safest response is not to repeat the last prompt immediately. First establish what happened locally, preserve useful context, and reconnect with a clear recovery instruction. This numbered walkthrough works as a general approach for tools such as Claude Code, Codex, and Gemini CLI, although their session controls differ.
#1 · Stop and identify what actually disconnected
Check whether your internet connection failed, the model request timed out, or the terminal itself closed. These are different problems. A failed connection to the model does not necessarily stop a command the agent already launched on your computer or a remote development machine.
Do not start a second agent yet. Look for running tests, build processes, or deployment commands. If the first process is still active, a second attempt could duplicate work or create conflicting edits.
#2 · Preserve the visible session
Before closing the terminal, save the last useful messages and any error text. Record your original objective, the agent’s latest plan, and the last command it attempted. Keep the project directory and current Git branch in your notes.
If your tool exposes a session identifier or a conversation export, save it using the tool’s documented interface. Do not assume every client stores conversations in the same location or supports the same resume command.
Remove API keys, tokens, and sensitive output before copying diagnostics into a support ticket or another conversation.
#3 · Inspect the project before retrying
Open a separate terminal in the project directory. For a Git repository, run git status and git diff to see which tracked files changed. Check untracked files as well: the agent may have created a new module or test that does not appear in the ordinary diff.
- Identify edits that appear complete and edits that stop midway.
- Check whether dependency files or lockfiles changed.
- Confirm whether any command with external effects actually completed.
A lost response is not proof that an operation failed. Before repeating a deployment, database migration, payment request, or publishing command, inspect the relevant system’s state. Save a local backup of important edits before making further changes.
#4 · Restore connectivity and verify configuration
Once your connection is stable, check the client’s credentials, selected model, and API endpoint. A network interruption can coincide with an expired credential or a configuration problem, so use the actual error message rather than guessing.
If you use Relay365, its API base is https://api.api365relay.com; OpenAI clients use https://api.api365relay.com/v1. Configure the endpoint through your client’s documented settings. Relay365 is a pay-as-you-go relay desk that works with Claude Code, Codex, Gemini CLI, and OpenAI SDK clients.
Keep the same model where practical—for example, Claude Sonnet 5.5—while recovering. Switching models adds another variable. An endpoint change does not automatically transfer conversation history or restore a session.
#5 · Resume with a small, explicit recovery prompt
Use your client’s documented session-resume feature if one is available. Otherwise, start a new conversation in the same project and provide your saved notes. Include the goal, known edits, last attempted command, and anything whose completion remains uncertain.
A useful prompt is: “The connection dropped while you were adding input validation. Inspect the current files and diff first. Summarize what is complete and what remains. Do not repeat commands with external effects without asking me.”
Ask for inspection before implementation. Even a resumed conversation may not contain the final tool result from before the interruption.
#6 · Validate, then continue in small steps
Review the agent’s recovery summary against the files you inspected. Run the narrowest relevant tests first, then broader checks as needed. Ask the agent to explain unexpected changes rather than automatically accepting or reverting them.
If you want a pay-as-you-go relay for your coding tools, create a Relay365 account and configure one client first. Keep your recovery notes regardless of provider: a relay can support your connection setup, but it does not replace local checkpoints.
Once the project is verified, make a focused commit when appropriate. For future sessions, keep tasks small and record progress at natural stopping points. Recovery becomes easier when the working tree, test results, and next action are all clear.
Further desk bulletins
| Date | Bulletin title | Filed under | Language |
|---|---|---|---|
| 2026-10-24 | Estimate Your Coding Agent’s Monthly Cost | Agent shift notes | EN |
| 2026-10-24 | Let a Coding Agent Run Shell Commands Safely | Agent shift notes | EN |
| 2026-10-24 | OpenCode: Multiple Model Providers, One Key | Agent shift notes | EN |
| 2026-10-24 | Review Pull Requests with an Agent and a Checklist | Agent shift notes | EN |
| 2026-10-24 | VS Code Assistants: A Guide to Environment Variables | Agent shift notes | EN |
| 2026-10-24 | Using Claude Code for Safe Overnight Migrations | Agent shift notes | EN |
Curious how it runs on your own code? Sign up →