Bash(git push *) in a Claude Code subagent's disallowedTools took away all of Bash in 10 of 10 launches, not just git push
On Claude Code 2.1.289, a subagent whose disallowedTools said Bash(git push *) started without the Bash tool in 10 of 10 launches, so git status and echo failed along with the push, just as the docs warn. The documented alternative, a Bash(git push *) deny rule in settings, kept Bash and stopped git push origin main 3 of 3 times, but when the subagent was only handed the repository path it typed…
In a series of 10 Claude Code 2.1.289 subagent launches, the disallowedTools parameter Bash(git push *) was found to completely disable Bash, affecting not just git push, but also git status and echo. While the documented workaround using a Bash(git push *) deny rule in settings successfully prevented git push 3 out of 3 times, the subagent sometimes invoked git -C path push origin main, bypassing the restriction.
To address this issue, a custom subagent was created that could run shell commands but was expressly forbidden from pushing code. The issue was investigated by testing a lab with two throwaway git repositories containing various subagent configurations and 39 claude -p runs. The findings showed that the disallowedTools specifier in subagents effectively removes the entire tool, unlike in the main conversation or settings where it would only block specific commands.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.