Repository navigation
Fix #14: Remove shell access from web-UI spec chat and tell the model why - #298
zwanski-start wants to merge 1 commit into
Conversation
…l the model why The spec creation chat never removed the Bash tool, so the model tried to run commands (e.g. Python to read a .parquet file) that failed with 'This command requires approval' and then asked the user to approve them, which is impossible in the web UI. - Deny/disallow Bash in the spec chat session - Append an environment note to spec and expand chat system prompts: no shell, no approval prompts, and ask the user to describe binary files - Add tests covering both sessions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🔍 QA report: ✅ PassedTester: Dennis (cubefarm agent, in a fresh session) · Round: 1 · Author: Ada The web-UI spec chat now removes Bash (disallowed_tools) and denies it in its settings file. Both spec and expand chats append a note telling the model it has no shell and no approval prompt, and to ask the user to describe or paste unreadable files such as .parquet. I confirmed the SDK passes this as --disallowedTools Bash and that Claude Code 2.1.303 then leaves Bash out of its tool list. A live spec WebSocket session wrote the note to CLAUDE.md and the deny list to settings, and degraded cleanly with no credentials. Lint and new tests pass; the 21 pytest failures and 24 mypy errors are the same on master.
🧪 Commands run
No browser screenshots were taken in this round. Posted by cubefarm · merges automatically once GitHub's checks pass |
…l the model why Adaptations: with AutoForgeAI#316 in place the spec and expand prompts reach the CLI through the session's ephemeral --system-prompt-file, so the 'no Bash/shell tool' note stays scoped to that conversation and never lands in a CLAUDE.md the coding agents read. The PR's tests now read the note from the system prompt file and assert that no CLAUDE.md is created (they asserted claude_md.endswith(NO_SHELL_PROMPT_NOTE)). Integrates AutoForgeAI#298 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeH26pcsqoxPb3CDs8g1VN
Closes #14
Problem
The web UI's spec creation chat (
SpecChatSession) only pre-approved Read/Write/Edit/Glob/Web tools and never removedBash. When a user dropped a binary file (e.g..parquet) into the project, the model tried to read it with Python/shell, each call failed withThis command requires approval, and the model then asked the user to approve — which the web UI has no way to do.Changes
server/services/chat_constants.py: newNO_SHELL_TOOLSandNO_SHELL_PROMPT_NOTE. The note tells the model it has no shell, that there is no approval prompt (so never ask for one), and that for formats it can't read (parquet, xlsx, sqlite, archives…) it should ask the user to describe the structure or paste/attach an excerpt.server/services/spec_chat_session.py:Bashis now indisallowed_toolsand in the settingsdenylist, and the note is appended to the system prompt (written to the projectCLAUDE.md).server/services/expand_chat_session.py: already disallowed Bash; now also appends the note so the model doesn't ask for approvals there either.test_chat_sessions_no_shell.py: tests that capture theClaudeAgentOptionsbuilt by both sessions and check Bash is removed/denied and the note is in the prompt.The assistant chat already disallows Bash and states it in its prompt, so it is unchanged.
Verification
pytest test_chat_sessions_no_shell.py— 4 passedpytest test_client.py test_ws_security.py test_security.py— 44 passedruff check .— cleanmypy .— no new errors (the remainingunused type: ignoreerrors on theeffort=lines exist on master)Assumptions
.claude/commands/create-spec.md, because that file is also used by the CLI flow, where Claude Code can prompt for approval.🤖 Generated with Claude Code