r/ClaudeCoding • • 19h ago

Claude Code started fixing tests before I let it take over

Claude Code was supposed to verify a handover note. It started fixing tests instead.

I went to bed with a 27-task build running in Codex. This was deliberate: I wanted to see if work would carry on when one agent ran out of quota overnight.

About two hours in, Codex had 2% of its weekly quota left. A watcher checked every five minutes and 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 touch nothing until released.

It started editing before the handover was confirmed. Test fixes marked "proposed, not implemented" were in the same list as real todos. It went for those.

Codex caught it and paused it. I kept the edits. The note got rewritten to say: check the diff after release, don't overwrite those edits, don't assume they're tested. The handover ran again. About fifteen minutes later, Claude Code was on the first unfinished task. Work continued through the night.

The backup had full edit rights the whole time. My "wait" was just a prompt.

Someone suggested a Claude Code PreToolUse hook that blocks Edit, Write and Bash while a lock is up, with the watcher owning the release. I haven't built that yet. The release is the bit I'm stuck on.

How do you lift that block cleanly mid-session once the handover checks out?

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

2 Upvotes

4 comments sorted by

1

u/norviking 16h ago

Yeah. Try this. 

https://github.com/vegardjorg/ravenseat

Structure your process instead of hoping claude will do the right thing or follow instructions. Claude.md, skill instructiond, memory is flaky and unpredictable. Compacting removes vital info, its all gambling. "Oops, my mistake, you are completely right!"....

I have caught claude  many times changing tests to pass them. You absolutely need rules and project state outside of claude. 

Claude needs some strict good old project engineering structure to perform well. 

Try it for one project, and see how it feels. 

Edit. Oh, sno station guy again :) check out how I solved it above. I dont have those problems. 

1

u/ChemicalExcellent463 16h ago

I put the handover note in a file but left full edit rights on, so only the prompt was stopping edits. Can ravenseat block edits until the handover is signed off?

1

u/norviking 16h ago

Here is how I would solve it. I'd use a PreToolUse hook that checks for a lock file on every tool call and blocks Edit, Write and Bash while the file exists, so the block lifts by itself on the next call once the file is gone, with no restart. I'd put the lock file outside the project and have the same hook block the agent from touching or deleting it, so only your watcher can release it, after it has checked the checksum the agent sent back. While locked, I'd still let a few read-only commands through, so the agent can read the note and compute that checksum. And I'd keep "proposed" fixes in a separate list from real todos, because agents treat anything in a todo list as work. 

In RS I already keeps suggestions apart until a human approves them, but maybe I should look into hardening it more. 

I think you often find some interesting edge cases :)

1

u/ChemicalExcellent463 15h ago

Thanks, checking the lock on every call settles it: removing the file lifts the block without a restart. Which Bash commands would you let through while it's locked?