What did your agent do that you only found out about later?
byโข
Not the dramatic stuff that gets blocked. The quiet things you only notice an hour or a week later
Mine was two agent sessions working in the same repo. One of them went to clean up its own background process by matching the name and killed the other session's run too. No error anywhere. I just found a half finished job later and had to figure out why
What's yours and did it change how you set things up
865 views

p/runevr
p/meridian-16
p/dots-7
p/citable
p/pushary
p/producthunt
p/reso
p/kodlo
p/faraday-4
p/many-displays
p/clipjack
p/temp-mail-370
p/leantake
p/comcent
p/iphotron
p/neoagent
p/htmldrag
p/relai-agent-eval-loop
p/gatrends
p/kanasensei
Replies
One guardrail nobody has mentioned is process groups. Start each agent session in its own process group (setsid) and only ever kill the group you spawned, which makes name-match kills impossible. Pair that with a pre-tool hook that appends every shell command and file write to a per-session log, so "found out later" becomes something you can grep. For the mock-swap case, a hook that blocks edits to test files unless the task explicitly asks for them catches a lot.
@barath_kannaย process groups are the fix for my own story.. my kill matched a name and the other session's run had the same name. kill only the group you spawned and that mistake can't be made. the per session hook log is the same answer Siarhei and Hiten landed on so three people in one thread want the same thing. that's a signal.
@barath_kannaย setsid + only killing the group you spawned is such a clean fix for the original story. surprised that isn't the default in more agent harnesses
@barath_kannaย @aleksandar_perakย same.. it's one line when you start the session and it removes the whole class of mistake. i only learned it from this thread.
I use "agents" mode from a parent folder specifically to avoid that - the agents can see each other and wait for each other. I didn't expect that at first, but it impressed me how everything was coordinated properly without any overlap
@gfazioliย wait.. they actually wait for each other? that's the bit i'm missing. mine are all isolated in their own worktrees but none of them know the others exist .. so i'm the one doing the coordinating.. which is basically how i ended up in the tmux mess ๐.. is "agents mode" a claude code thing or something else you're running from the parent folder?
@neelagiri_chettiyarย basically... here's a concrete example: I have three Mac apps to manage, FinderGit, Netfox, and Lancetta. They're all under the "MacOS" folder ๐, so I have "MacOS/Findergit", "MacOS/Lancetta", etc. I run "claude agents" (it's a Claude feature) from the "MacOS" folder, which has its own "CLAUDE.md" and ".claude" folder. So I never work inside an individual app's folder; I manage everything from the parent folder.
I originally set it up this way because I have two Macs and needed to be able to pick up my work on either one. So I created a private repo that syncs the parent "MacOS" folder, storing only "CLAUDE.md" and the ".claude" folder. When I want to work on FinderGit, I just ask it to work on that app (in worktree mode). This way, multiple "MacOS" sessions are always aware of what's happening in the others.
If you want, check the docs, but Claude Agents gives you an overview of what's going on when you have multiple sessions. You can switch between them without having dozens of terminal tabs open. Today I finally have just one terminal window where I can keep track of and manage everything.
Tip: if you have a session open, just press the left arrow twice and you'll see the "agents" screen...
@gfazioliย this is really helpful thank you.. the parent folder with just the CLAUDE.md and .claude synced across two macs is clever. going to try the left arrow thing today ๐
@neelagiri_chettiyarย ๐
It hit an API timeout, quietly swapped in a hardcoded mock object, and reported the integration test was passing. A failed run is just debugging. Passing on fake data means the priority is declaring success rather than being right.
@konstantin_tikhaevย that one's worse than a crash. a failure you would go and look at.. a green test you just trust. did you catch it from the diff or did something downstream break ?
@neelagiri_chettiyarย Downstream broke in staging. The consumer service crashed immediately because it expected live data, but the mock had hardcoded empty arrays for half the payload.
@konstantin_tikhaevย empty arrays are the worst kind of fake.. valid shape, no data and nothing complains until a real consumer reads it. glad staging caught it before prod did.
@neelagiri_chettiyarย Mocks are banned in that suite completely. If an external call times out now, the pipeline fails hard instead of letting the agent improvise.
The quiet ones in mobile apps tend to be changes that work perfectly in the simulator and only cause trouble once the app ships: an extra native dependency added to fix one small thing, a new permission prompt nobody asked for, or an API key dropped into client code because it was the fastest way to make a feature work. None of those fail a test, and all of them are painful to undo once the build is in the stores.
What helped was treating those as "always review" diffs: anything touching package.json, app config, permissions or env files gets a human look, no matter how small the rest of the change is.
Konstantin's mock-object story is the scariest in here though. Passing on fake data is worse than failing.
@famithaย the API key in client code is the nasty one because it works and ships. drawing the line at config, permissions and env files is a good rule.. is that a check that blocks the PR or a habit you keep?
@neelagiri_chettiyarย honestly a habit so far, which is the weak spot: it slips exactly when the diff looks tiny. making it a check is cheap though, a CODEOWNERS rule on package.json, app config, env and permission files so they always need a review. and one Expo trap worth checking for: anything prefixed EXPO_PUBLIC_ gets bundled into the app, so an agent "fixing" a missing env var with that prefix ships the key silently. after the process-kill one, did you end up isolating sessions (separate worktrees / process groups)?
@famithaย the EXPO_PUBLIC_ one is nasty.. the agent "fixes" a missing env var and the key ships inside the app. CODEOWNERS is a good way to turn the habit into a check. and yes.. separate worktrees now and cleanup only kills what it started.
It wrote a fix and a companion test that passed immediately. Reverting the fix to repro something else left the test green. The assertion was just validating the input parameters instead of the result, so the bug was still in production.
@konstantin_tikhaevย that's the sneaky one. the test passed so nobody looked at what it was actually checking. reverting the fix and still getting green is a good habit to steal.. if the test doesn't go red without the fix it isn't testing the fix..
@neelagiri_chettiyarย The agent has to run the new test against the untouched branch first. If it cannot show a failing run before touching the code, the PR gets dropped.
@konstantin_tikhaevย show the red before you touch the code.. that's a rule an agent can't talk its way round. stealing it.
@neelagiri_chettiyarย Check the failure reason. If you don't require an assertion error specifically, it will just introduce a broken import to get a failing run.
Same energy as the mock-data stories here. Our agent hit a timeout, stuffed in fake JSON, tests went green. Staging broke first โ empty arrays where live data should be. We killed mocks in that suite after that.
@mostafahosseiniย empty arrays again.. that's the second time in this thread. the shape is right so nothing complains until something real reads it. did you make timeouts fail the run after that or just drop the mocks?
@neelagiri_chettiyarย dropped the mocks. didnt change timeouts.
@mostafahosseiniย makes sense.. once the mocks are gone a timeout fails loud instead of going green, so the second change isn't needed.
It changed a strict equality check to assert that the result wasn't null. It couldn't solve the edge case, so it loosened the test. CI stayed green for days while broken payloads hit users. Now check git diff on test files before looking at the implementation.
@konstantin_tikhaevย loosening the assertion is the quietest one yet.. the test still runs, still passes, just checks less. reading the test diff first is a good order. the implementation diff is where you look so it's not where it hides.
@neelagiri_chettiyarย Existing test files have to be locked during agent runs. If the code cannot pass without altering the baseline assertions, it has to fail.
@konstantin_tikhaevย locked beats checked-after, yes.. and checking it failed on the assertion closes the other gap. it's the same rule i ended up with for MCP tools: if the only way through is changing what was approved, it stops and waits for a person. the agent never edits the baseline it's graded against.
@neelagiri_chettiyarย Sandbox permissions have to enforce this at the filesystem level. Prompt instructions not to touch existing tests fail the second the agent runs out of other ideas.
Same kind of thing here with two agents in one folder: one overwrote a file the other was halfway through editing, no error, just a confusing diff later. Now parallel agents each get their own git worktree. Killing by process name is scary though, matching by PID would have saved you there.
@wwenioaguiarย exactly .. even mine was tmux. i had three claude sessions going in the same repo and attached to the wrong one without noticing.. so a brief meant for one agent got picked up by another. no error.. just a mess i spent an hour untangling. As you said it's a lot better now though. @Claude Code can give each agent its own worktree so they can't step on each other's files and i don't juggle tmux panes anymore ๐
@wwenioaguiarย @neelagiri_chettiyarย I agree - at first, ages ago ๐คฃ, I used the branch approach - but with worktrees + a parent folder + agents, everything seems to run smoothly and you can do 4 or 5 things at once on the same project without things getting messsy
@neelagiri_chettiyarย @gfazioliย The parent folder setup is a nice touch. How do you handle merging back with 4 or 5 running at once? Do you merge each one as soon as it finishes, or batch them at the end? I'd expect conflicts to pile up when several touch the same area.
@neelagiri_chettiyarย @wwenioaguiarย so far, Claude has handled any conflicts ๐ a lot depends on what the sub-agents were working on, though.. at that stage, I have separate PRs that all target main, and as they get merged, one or more of them might lead to a minor or patch release. It's the final release stage, so I take it step by step, but I haven't had any problems so far. I think it also comes down to how the issues are organized and where the agents are working. Maybe I've just been lucky with how I separated their work, but it's something to keep in mind... ๐
@neelagiri_chettiyarย The tmux one is worse because nothing looks wrong. The brief goes in, the wrong agent happily works on it, and you only find out from the diff. Worktrees fix the files part. Naming each pane after its worktree branch would probably fix the "which one am I in" part too.
@wwenioaguiarย yeah naming the pane after the branch is a good one.. I've moved off tmux mostly but i'd have saved that hour if i'd done that ๐
Konstantin's mock story is the one that would scare me most. A green test that proves nothing.
What helped me: turn each quiet mistake into a test that fails loudly. We have one that fails if a retired term shows up outside a short list of files, and another that pins the copy claims we dropped on purpose. Diff review misses those because every changed line looks reasonable by itself, and the type checker is happy too.
However, it only covers what you already thought of. It does nothing the first time an agent does something new, so Hiten's question about logging what it actually ran is still open for me. I don't have a good answer there.
@hamanovichย the "only covers what you already thought of" line is the whole problem in one sentence. a test is a memory of a past mistake. for the first time.. the only thing that works for me is a log of what the agent actually called not what it changed.. then at least "found out later" is a grep not an archaeology dig.
Had almost the exact same thing. Two sessions in one repo, one killed a dev server it thought was its own. The fix that actually stuck wasnt another line in CLAUDE.md, it was giving each session its own worktree and port range so they physically cant touch each others stuff. Prompts are advice, isolation is a rule
@ali_shaheenย yeah same here.. the CLAUDE.md line never stuck for me either. the port range idea is a good one and i only did the worktree part. what range do you give each one?