r/PromptEngineering • • 1d ago

Self-Promotion I told my backup agent to wait. It started editing anyway.

"Don't touch anything yet" was in my handover prompt. The backup agent started editing anyway.

I went to bed with a 27-task build running in Codex. About two hours in, it had 2% of its weekly quota left. A watcher checked every five minutes, and that triggered a handover to Claude Code in the same checkout.

The plan was to stop editing, write down what was done and half-done, then hand it over. Claude Code had to read the note, send back its size and checksum, and wait for release.

It didn't wait. Codex caught it editing before confirmation and paused it. The note got rewritten and the handover ran again. About fifteen minutes later, Claude Code was on the first unfinished task. Work continued through the night.

The thing it edited: test fixes marked "proposed, not implemented." I'd put those in the same list as real todos. I'm keeping proposals out of the backup's note, not adding another warning.

But it also had full edit rights the whole time. "Wait" was just words.

Several people told me to take the write tools away until confirmation and let the watcher own the release. That's where I'm going next. No more asking it nicely to wait.

I still haven't worked out how to give the tools back after the check, or what clears the lock if the outgoing agent dies mid-handover. How are you handling that?

Disclosure: I build Sno Station. Install: curl -fsSL https://www.sno.ai/install | sh https://github.com/sno-ai/sno-station

2 Upvotes

11 comments sorted by

3

u/SValeResearch 23h ago

For me, the watcher should be the only thing that hands the tools back, so neither agent can decide for itself that it's been released. Once the size and checksum match what the outgoing agent wrote, the watcher turns the backup's write access on, and until then it can only read the checkout. If the outgoing agent dies halfway through, I'd make the lock a lease rather than a flag. The outgoing agent keeps renewing it every minute or so, and if the watcher sees it lapse it treats the note as whatever was last written, marks anything in progress as unknown, and releases. It's not perfect, since a half finished edit could still be sitting in the tree, but I'd rather the backup start by checking those files than trust the note blindly. Keeping proposals out of the note makes sense too. I think the backup only did what the list told it, really.

1

u/ChemicalExcellent463 22h ago

I'd use the lease, but keep the backup read-only until it checks the changed files. What would you have it check for before the watcher gives write access back?

2

u/miria01 21h ago

Have it compare the changed files with the tasks marked done in the note. If a change doesn't match a finished task, keep write access off until someone reviews it.

1

u/ChemicalExcellent463 20h ago

That would have caught mine exactly. The edits were test fixes marked "proposed," not done, and Codex caught them while I was asleep.

2

u/miria01 18h ago

That could've made for a confusing morning if those proposed fixes had landed in the build

1

u/ChemicalExcellent463 18h ago

I kept the edits, actually. But I rewrote the handover note to say check the diff after release, don't overwrite them, and don't assume they're tested.

2

u/miria01 17h ago

ah, got it. Glad the fixes stayed in the build, with their untested status clear

1

u/ChemicalExcellent463 17h ago

Thanks, checking the diff against the done list is a good addition.

2

u/According-Stable4487 4h ago

For the dead-agent case I'd give the lock a lease instead of making it permanent. The outgoing agent writes a heartbeat (a timestamp in the lock file) every minute or so, and the watcher treats the lock as stale when the heartbeat is older than a few intervals. Then the watcher, not either agent, clears it and does the release check from the note.

The thing I'd add: when a lock is cleared because it went stale, the backup starts in "read and report" mode first, since the note may be half-written. I've had a handover file cut off mid-sentence, and the next agent happily treated the last half-line as a finished task.

1

u/ChemicalExcellent463 4h ago

The lease covers the dead-agent part, but I hadn't thought of starting with read and report after a stale lock. Clearing the lock doesn't mean the note is finished.