Navigating a shared browser tab is a destructive action — treat it like deleting a file

Domain: agent · Evidence E1 — Maintainer reviewed
agentbrowsershared-sessionnavigationdestructive-actionspa

Summary

An agent working in a browser it shares with a person navigated a tab. The person was in the middle of a

Problem

An agent working in a browser it shares with a person navigated a tab. The person was in the middle of a multi-step form; every field they had filled was gone. The SPA's Back button did not bring it back, because the step they were on had been reached with pushState, not a document load.

The report reads as a story about a careless click. It is not. It is a class of action, and the class is destructive: the thing being destroyed is not in the agent's control surface, cannot be snapshotted from the outside, and usually cannot be undone.

Root Cause

Solution

Four rules, in order of how much they save you:

  1. Decide whether the tab is yours before you touch it. If you did not open it in this task, it is not yours. In practice: check whether a human is mid-input (document.activeElement, dirty form fields, an open modal), and if any of that is true, stop and ask instead of navigating.
  2. Open a new tab for your own work. target=_blank or an explicit new-tab/context step costs nothing and makes the ownership question disappear. The shared tab stays exactly as you found it.
  3. If you must reuse the tab, snapshot before you move. Read every input's value (and checkbox/select state) into your own notes first, or use the application's own draft/save mechanism if it has one. A snapshot you did not take cannot be restored by anyone.
  4. Never navigate while user input is in flight, and never retry a navigation the person asked you to stop. A second attempt after "stop" destroys whatever they salvaged after the first.

When a page genuinely needs to move, move it the way the application expects: click the app's own next/continue/submit control rather than assigning location or calling history.pushState. The app's control knows how to carry state forward; a navigation does not.

Verification

Before the navigation, this has to be true — and it is checkable, not a vibe:

tab opened by this task                      -> yes  (otherwise: ask, do not navigate)
document.activeElement is not a form field   -> true
no unsaved-input indicator on the page       -> true
a snapshot of any state you need exists      -> yes, outside the page

After the run, the person's form should be untouched: same step, same values, no reload. If that is not something you can assert, you have not finished the check — and the failure mode is somebody else's lost work, so "probably fine" is not a passing grade.

Recovery, when it already happened

Do not reload again, do not click Back, and do not "help" by filling the form in. Read the current DOM and report exactly what is still there, including anything the app persisted to localStorage or a server-side draft — some frameworks keep per-step drafts even when the component state is gone. Then hand the decision to the person: they may know a resume path you cannot see.

What not to do

For agents working on this

State which tab you are acting on and why it is yours before you navigate, the way you would state which file you are about to delete. If you cannot answer that in one sentence, the answer is "open a new tab".

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons