Skip to Content
Vektos
Anecdotes

The cd that failed

A clone failed, so the cd after it failed, so a history rewrite meant for a scratch copy ran on the working repository. Nothing was lost, by luck and by a remote.

Date: 2026-11-10. Context: rewriting the commits' author before publishing (journal ch. 57).

What happened

The plan was careful: clone the repository into a scratch folder, rewrite the history there with git filter-repo, check it, and only then push it to a new repository. The commands went out as one line, joined by ;: clone, cd into the clone, rewrite. The clone failed (HTTPS asked for credentials), the cd failed because the folder did not exist, and the shell went on in the directory it was in: the working repository. git filter-repo --force rewrote it, and removed its origin remote as it always does.

Nothing was lost. The rewrite was the one intended; the working tree was clean, so no work was in the way; the ignored files (results/, node_modules) were untouched; and the original history was still on GitHub, where nothing had been pushed. A comparison of the latest commit's tree, local against GitHub's, gave the same hash: the content had not changed by a byte.

What we learned

  • ; runs the next command whatever happened; && does not. A sequence that only makes sense if each step worked must say so.
  • --force is a promise that the place is right. filter-repo refuses to run outside a fresh clone unless forced; forcing it in a chained command turned that safety off exactly when it was needed.
  • The safety net was the remote, not the plan. The plan assumed the clone; only an untouched copy elsewhere made the slip harmless.

What it means for Vektos

The benchmark watches agents use tools; this is an agent using tools. The failure was not in any one command but in what the agent assumed about the state between them, the same kind of mistake as anecdotes 18 and 19, where a check ran somewhere other than where it was believed to run. An agent that chains destructive commands should check the precondition in the chain itself.

Follow-ups

  • Destructive commands run alone, after a command that prints where they will run.
  • filter-repo only in a fresh clone, without --force.

On this page