Repository navigation
Description
Summary
An infer session (model deepseek/deepseek-v4-flash, run via infer-action) on inference-gateway/adl#48 finished its task but reported a 36% tool-call success rate - 7 of 11 tool calls were rejected. Almost every rejected call was a benign read-only or low-risk GitHub operation blocked by the bash command whitelist / WebFetch domain allow-list, not a genuinely dangerous action.
The agent then bypassed the gh issue create restriction by writing a node one-liner that POSTed to api.github.com using GITHUB_TOKEN from the environment, and succeeded. So in this configuration the whitelist degraded reliability (and burned extra tokens/cost over retries) without providing a real security boundary.
Source run (the 36% one): https://github.com/inference-gateway/adl/actions/runs/26850564162
Earlier related run: https://github.com/inference-gateway/adl/actions/runs/26808650985
Steps to Reproduce
- Run an
infer-actionsession with a model that defensively wraps shell commands (observed withdeepseek/deepseek-v4-flash). - Give it a task that needs cross-repo GitHub access, e.g. "create a follow-up issue in inference-gateway/adl-cli".
- Observe the rejected calls in the run summary's "failed tool call(s)" section.
Expected Behavior
Benign read-only GitHub calls (gh search, gh api GET) and the intended low-risk write (gh issue create) should either succeed or be governed by one coherent policy. The agent should not have to route around the sandbox with node + a raw token to complete the task.
Actual Behavior
7 of 11 tool calls rejected. Verbatim from the run summary:
| # | Tool call (abbreviated) | Rejection message | Intent |
|---|---|---|---|
| 1 | gh search issues --repo .../adl-cli "vercel" ... 2>&1 |
command not whitelisted | read-only: find duplicate issue |
| 2 | gh api repos/.../contents/.github/ISSUE_TEMPLATE 2>&1 |
command not whitelisted | read-only: read issue templates |
| 3-5 | WebFetch https://api.github.com/... (x3) |
domain not whitelisted | read-only (wrong tool) |
| 6 | gh issue create --repo .../adl-cli --title ... 2>&1 |
command not whitelisted | low-risk write: file the issue |
| 7 | A2A_QueryAgent http://localhost:8085 |
connection refused | model probe, no agent configured |
Analysis (root cause is mostly config + prompt, partly model)
a. Whitelist matching vs. real commands. The repo whitelist patterns read as full-command/anchored matches, e.g. ^gh issue (create|edit|comment)( |$) and ^gh api [^ -][^ ]*( --paginate| --jq [^ ]+| -q [^ ]+)*$. Real invocations carry flags (--repo, --title, --body) and the model appends 2>&1 / || echo "...", so the whole string no longer matches. This is why call #2 was rejected even though gh api appears whitelisted.
b. Model shell habits (deepseek). The model defensively appends 2>&1, 2>/dev/null, and || echo "...". The Bash tool already returns stdout + stderr + exit code, so these suffixes are pure downside here: they break the anchored patterns. This is the single biggest contributor (calls #1, #2, #6).
c. Genuine hallucination (deepseek). Call #7 (A2A_QueryAgent to localhost:8085) is a real wrong turn - no A2A agent is configured, the model invented one. One of seven.
d. Wrong tool for the job. Calls #3-5 used WebFetch against api.github.com; the correct path is gh api (authenticated, audited). Adding api.github.com to the WebFetch allow-list would "fix" this the wrong way.
e. Config-source to verify. The committed .infer/config.yaml in adl does not list node/npm in the bash whitelist, yet the session ran node -e successfully, and gh patterns that are committed were reported "not whitelisted". So the effective runtime config likely differs from the committed file (injected by infer-action, a global ~/.infer/config.yaml, or uncommitted working-tree edits). Confirming which layer supplies the effective default determines exactly where the fix lands - if infer-action injects it, a companion change there is needed.
Recommendations
Safe to add (read-only, low blast radius) - good default candidates:
gh search (issues|code|prs|repos)- read-only discovery.- Make
gh apiGET actually work in practice (see matcher fix below). - Keep the existing read-only
gh ... (list|view|status|diff|checks).
Safe but policy-gated (writes) - org should decide whether to default:
gh issue create|edit|comment,gh pr create- low-blast-radius writes already present in the committed whitelist; reasonable as a default for an agent expected to file issues/PRs.
Do NOT simply add:
api.github.comto the WebFetch allow-list - prefergh api.- Leaving arbitrary
node -eable to POST withGITHUB_TOKENwhile restrictinggh- pick one coherent policy; today theghrestriction is illusory becausenodeis an open escape hatch.
Matcher / prompt fixes (no per-command whitelisting needed):
- Make the bash whitelist tolerant of benign trailing redirections (
2>&1,2>/dev/null): strip them before matching, or allow a trailing( 2>&1| 2>/dev/null)?$. Reject compound operators (||,&&,;, pipes) unless each segment is independently whitelisted. - Add to the default system prompt: "The Bash tool already captures stdout, stderr, and exit code. Do NOT append
2>&1,2>/dev/null, or|| echo .... Usegh api/gh(or the Github tool) for GitHub operations; do not probe A2A agents unless one is configured." This directly addresses (b) and (c).
Did the model "hallucinate"?
Partly. About 1 of 7 (the A2A probe) is a true hallucination. The other 6 were legitimate, necessary intents (search / read templates / create issue) blocked by policy plus the model's 2>&1 / || echo habit. The higher-leverage fix is config + prompt, not "the model is broken."
Originating PR: inference-gateway/adl#48
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
edenreich commentedon Jun 4, 2026
@infer /model ollama_cloud/deepseek-v4-pro Can you fix this? use /maintainer
inference-gateway-maintainer commentedon Jun 4, 2026
Todos
✅ Infer Result: Success
The
&&chain test expectation is wrong for the new behavior -gh issue list && echo doneshould now pass since both segments are independently whitelisted. Let me fix the test:Model:
ollama_cloud/deepseek-v4-pro· Exit Code:0· View JobTokens: 5,053,752 in · 28,619 out · 5,082,371 total (50 requests)
Tool calls: 60 total · 95% success rate
Possible matches found:
Near line 370:
Bash: PromptsToolDescription{
Description:
Execute whitelisted bash commands securely. Only pre-approved commands from the whitelist can be executed.,},
Hint: Ensure exact whitespace and indentation match. Use the Read tool to see the current file content.
No similar content found. Please verify the content exists and matches exactly (including whitespace).
Possible matches found:
Near line 336:
// Test without streaming callback (original behavior)
t.Run("works without streaming callback", func(t *testing.T) {
ctx := context.Background()
}
Hint: Ensure exact whitespace and indentation match. Use the Read tool to see the current file content.
Agent output (tail)
Triggered by edenreich · Infer Action
chore(release): 0.118.0 [skip ci]
inference-gateway-releaser commentedon Jun 5, 2026
🎉 This issue has been resolved in version 0.118.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀
feat(tools): restrict bash file-write redirects unless whitelisted by…
chore(release): 0.120.0 [skip ci]