agentscope-ai / agentscope-ai/QwenPaw
Bug: shell_evasion_checks.newlines=True silently blocks multiline commands, causing agent thought chain chaos
- Linguagem predominante
- Python
- Estrelas
- 34.9k
- Forks
- 3.1k
- Merge médio
- 1d 15h
- PRs com merge (30d)
- 225
Descrição
```markdown
# Bug: shell_evasion_checks.newlines=True silently blocks multiline commands, causing agent thought chain chaos
## Problem
When `config.json` has `security.tool_guard.shell_evasion_checks.newlines: true` (the **default**), any shell command containing newlines is **silently blocked** and returns `"Command executed successfully (no output)."`
The agent cannot distinguish between:
1. Command truly succeeded with no output
2. Command was blocked by the system and never executed
This creates a **"perception black hole"** where the agent blindly retries dozens of times, spiraling into thought chain chaos.
## Reproduction
```
Default: newlines=true
Agent runs: curl -x "socks5h://..." ... + git clone ... (multiline)
Result: "Command executed successfully (no output)." (blocked)
Agent thinks: "Hmm, maybe the temp dir was cleaned?" → retries → blocked again → loop
```
In a real session (2026-05-12.log, lines 485-620):
- 22 NULL OUTPUT events in 65 seconds
- 120 assistant messages, 241 total messages
- Agent switched between English/Chinese thinking (coherence loss)
- Pattern: no-newline commands → ✅ works, multiline → ⚠️ NULL
## Root Cause
```json
"shell_evasion_checks": {
"newlines": true, // silently blocks newlines
"backslash_escaped_operators": true,
"backslash_escaped_whitespace": true
}
```
The blocked command returns **deceptively successful** result:
```
"Command executed successfully (no output)."
```
No error code, no block reason, no way for the agent to know it was blocked.
## Impact
- **Thought chain chaos**: 20+ blind retries, language switching, coherence loss
- **Context bloat**: 120+ assistant messages, 360+ content blocks
- **Wasted time**: 7 invalid retries in 17 seconds
- **User experience**: Agent appears to "go crazy" back and forth
## Workaround
```json
"shell_evasion_checks": {
"newlines": false,
"backslash_escaped_operators": false,
"backslash_escaped_whitespace": false
}
```
After this change, multiline commands work normally ✅
## Suggested Fixes
1. **Return explicit error on block**: `{"error": "Command blocked: newlines detected"}` instead of fake success
2. **Consecutive failure protection**: After N NULL OUTPUTs, system intervenes with a warning
3. **Default value**: `newlines: false` (newlines are normal shell usage)
4. **White-list mechanism**: Allow `bash -c "..."` wrapped commands
## Environment
- QwenPaw: latest (2026-05-12)
- OS: Linux 6.17.0-22-generic (x86_64)
- Trigger: Any multiline command (for loops, if statements, pipeline chains)
Full session log: `workspaces/ailisi/dialog/2026-05-12.jsonl` lines 485-620
```
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.