A task went off track after edits, a generated file and an external update. What would returning tracked files to an earlier state fail to recover?
Write a brief prediction before opening the explanation.
Read the lesson
Stop the mistaken direction and inventory the state
Course correction begins by naming the mismatch: the agent is replacing a subsystem when the task asks for a small defect fix. Pause the dependent edits and inspect the working tree, relevant diffs and available action history. Separate work that existed before the task from changes attributable to the agent. A file can contain both. An uncertain ownership boundary is a reason to inspect further, not permission to discard everything.
Recovery has more than one boundary
Tracked file changes, untracked artifacts and external side effects are different forms of state. Restoring a tracked file does not prove that a generated file was removed or a remote configuration was restored. A chat history records discussion; it is not a transaction log that guarantees reversal of every action. Determine what a proposed recovery actually affects in the current environment. Preserve relevant evidence privately before correcting a mistake, and avoid destructive commands whose scope exceeds the identified change.
Continue from a smaller, verified brief
After preserving evidence, propose the narrowest recovery that retains authorized work. If user and agent edits overlap, compare the hunks and resolve the overlap deliberately; do not blindly restore the whole file. An external write may need a separately authorized compensating action, with its own verification. Resume the original task with current facts, remaining uncertainties and acceptance checks. A handoff should describe what is still changed and unverified, not simply announce that the agent has reset.
Using a whole-checkout reset as a universal undo, or reporting remote recovery based only on a clean Git diff.
Make the request actionable
A weak starting brief: Undo everything you did and start from scratch. The external settings should be back too.
This example is an adaptable request, not evidence that a runtime action has executed.
An unwanted router rewrite
Simulated state: Before task: uncommitted accessibility edits in Menu.tsx. Task: fix a timeout message. Agent: rewrote router.ts, also changed Menu.tsx, created untracked route-notes.md, and updated a remote preview setting. No reliable separation of the Menu.tsx edits has been made.
Simulated scenario · No repository access or command execution
Loading your saved lesson progress…