Skip to content

fix(tools): let KillShell stop a background shell without approval - #1810

Merged
edenreich merged 3 commits into
mainfrom
fix/killshell-approval
Nov 11, 2026
Merged

edenreich merged 3 commits into
mainfrom
fix/killshell-approval

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

KillShell no longer asks for approval. It only takes the id of a background shell the same session started, and BashOutput and Wait on that shell never ask, so the gate protected nothing - the agent could stop the same process with kill through Bash. On an unattended run it suspended the agent until someone looked.

Its manifest set no require_approval, so it fell back to the global setting. It now declares require_approval: false, like its two siblings.

The issue's expected behaviour mentions turning the approval back on in the configuration. KillShell has no setting of its own for that, the same as BashOutput and Wait, and this PR adds none.

Closes #1808

Changes

  • internal/tools/KillShell.yaml - require_approval: false
  • internal/tools/tool_manifests_test.go - a case in TestToolApprovalSettings that pins it, with the global setting on
  • docs/tools-reference.md - the shell tools table says No for KillShell

no docs ticket: the tools reference in this repo is updated here

KillShell only takes the id of a background shell the same session started, and BashOutput and Wait on that shell never ask. Its manifest set no require_approval, so it fell back to asking and suspended unattended runs.
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 11, 2026
@edenreich
edenreich marked this pull request as ready for review November 11, 2026 16:23
@edenreich
edenreich requested a review from a team as a code owner November 11, 2026 16:23
@edenreich

Copy link
Copy Markdown
Contributor Author

@infer CI is failing, can you fix this?

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Model: ollama_cloud/glm-5.3-flash · Action: v0.59.7 · CLI: v0.254.0 · Gateway: v0.63.4 · View Job

Todos

  • Reproduce TestToolDefinitionsGolden failure locally
  • Regenerate golden file and verify the diff is only the KillShell approval flip
  • Run checks, commit and push
  • [~] Confirm CI passes on the fix commit

Pull Request

#1810

⚠️ Infer Result: Stopped early

The agent hit its time limit before finishing, so it was stopped to salvage its work. Its committed changes were pushed; the draft pull request is linked above.

The re-triggered run is in progress (CodeQL, Analyze passed; lint/vet pending). Let me wait for it and save a memory note about the macOS runner flake pattern:

Model: ollama_cloud/glm-5.3-flash · Action: v0.59.7 · CLI: v0.254.0 · Gateway: v0.63.4 · Exit Code: 3 · Duration: 35m 7s

Tokens: 1,256,079 in · 9,733 out · 1,265,812 total (28 requests)

Tool calls: 37 total · 100% success rate

Traces
Session: 1794416652-c20a7c3f

session (headless, stopped_early)                                                                  35m0s
├── chat ollama_cloud/glm-5.3-flash                                                                 2.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.2s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.2s
├── execute_tool TodoWrite call_2rks8ssh                                                            82µs
├── execute_tool Bash call_f5u1eaey                                                                 1.3s [error: tool_error]
├── execute_tool Bash call_b6aomaq0                                                                  6ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.9s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.9s
├── execute_tool Bash call_vd8wi1kd                                                                 3.6s
├── chat ollama_cloud/glm-5.3-flash                                                                 2.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.7s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.7s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.7s
├── execute_tool Bash call_tbsk5qw5                                                                  6ms
├── execute_tool Read call_n5ex5wye                                                                623µs
├── chat ollama_cloud/glm-5.3-flash                                                                 5.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       5.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     5.9s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        5.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 5.9s
├── execute_tool TodoWrite call_n7kvq1jy                                                            66µs
├── execute_tool Bash call_7u58oaly                                                                1m32s [error: tool_error]
├── chat ollama_cloud/glm-5.3-flash                                                                 1.6s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.6s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.6s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.6s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.6s
├── execute_tool TodoWrite call_clcokw7n                                                            61µs
├── execute_tool Bash call_y9os6vbg                                                                 1.6s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.2s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.2s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.2s
├── execute_tool Bash call_4nv7a5me                                                                  7ms
├── chat ollama_cloud/glm-5.3-flash                                                                 3.6s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.6s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.6s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.6s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.6s
├── execute_tool Bash call_jyambdez                                                                 1.7s
├── execute_tool Bash call_2tnuqrhe                                                                 4.4s
├── chat ollama_cloud/glm-5.3-flash                                                                 6.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       6.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     6.0s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        6.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 6.0s
├── execute_tool Bash call_6uz18rqr                                                                 10ms
├── chat ollama_cloud/glm-5.3-flash                                                                 1.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.4s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.4s
├── execute_tool Bash call_a8692wwp                                                                 10ms
├── chat ollama_cloud/glm-5.3-flash                                                                 1.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.2s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.2s
├── execute_tool Bash call_6u2nwisk                                                                 2m7s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.3s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.3s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.3s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.3s
├── execute_tool Bash call_ddbm5psm                                                                 1.5s
├── chat ollama_cloud/glm-5.3-flash                                                                 3.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.4s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.4s
├── execute_tool Bash call_3h1trd86                                                                 12ms
├── execute_tool Bash call_krpi9uoi                                                                641ms [error: tool_error]
├── chat ollama_cloud/glm-5.3-flash                                                                 2.2s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.2s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.2s
├── execute_tool Bash call_7waw5xse                                                                648ms
├── chat ollama_cloud/glm-5.3-flash                                                                 3.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.0s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.0s
├── execute_tool Bash call_gakcxx6u                                                                  6ms
├── chat ollama_cloud/glm-5.3-flash                                                                 1.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.4s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.4s
├── execute_tool Bash call_88q7y037                                                                711ms
├── chat ollama_cloud/glm-5.3-flash                                                                 5.8s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       5.8s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     5.7s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        5.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 5.7s
├── execute_tool TodoWrite call_mlrvoc7x                                                            73µs
├── execute_tool Wait call_tt44mxlv                                                                 1.8s
├── chat ollama_cloud/glm-5.3-flash                                                                 3.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.7s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.7s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.7s
├── execute_tool Wait call_vztm9zrv                                                                10m0s [error: tool_error]
├── chat ollama_cloud/glm-5.3-flash                                                                 1.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.9s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.9s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.9s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.9s
├── execute_tool Wait call_lpcg785l                                                                 8m1s
├── chat ollama_cloud/glm-5.3-flash                                                                 3.0s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.0s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.0s
├── execute_tool Bash call_fc6pqv7h                                                                 2.6s
├── chat ollama_cloud/glm-5.3-flash                                                                 3.3s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.2s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        3.2s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.2s
├── execute_tool Bash call_b6r4ash8                                                                 3.6s
├── chat ollama_cloud/glm-5.3-flash                                                                14.9s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                      14.8s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    14.8s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                       14.8s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                14.8s
├── execute_tool Bash call_cl862z7f                                                                 8.3s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.1s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.0s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.0s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.0s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.0s
├── execute_tool Bash call_ggg7gk3a                                                                 1.6s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.5s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.5s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.5s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.5s
├── execute_tool Bash call_dmlr8x4i                                                                331ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.5s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.4s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.4s
├── execute_tool Bash call_qscvmyn9                                                                 1m0s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.1s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.1s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.1s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.1s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.1s
├── execute_tool Bash call_iyz3ln2x                                                                349ms
├── chat ollama_cloud/glm-5.3-flash                                                                 2.2s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       2.2s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     2.1s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        2.1s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 2.1s
├── execute_tool Bash call_99vfieh5                                                                1m30s
├── chat ollama_cloud/glm-5.3-flash                                                                 1.4s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       1.4s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     1.4s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        1.4s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 1.4s
├── execute_tool Bash call_ebqwtzvx                                                                815ms [error: tool_error]
├── chat ollama_cloud/glm-5.3-flash                                                                 4.7s
│   ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.7s
│       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.7s
│           ╰── POST /proxy/{provider}/{path...} [inference-gateway, server]                        4.7s
│               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.7s
├── execute_tool Wait call_slo03h9x                                                                8m44s [error: tool_error]
╰── execute_tool Memory call_wj2uieo9                                                                1ms
Stats
Tool Calls

╭───────────┬───────┬───────┬──────────╮
│ Tool      │ Calls │ Fail% │ Avg      │
├───────────┼───────┼───────┼──────────┤
│ Bash      │ 27    │ 15%   │ 14921ms  │
│ TodoWrite │ 4     │ 0%    │ 65µs     │
│ Wait      │ 4     │ 50%   │ 401643ms │
│ Read      │ 1     │ 0%    │ 614µs    │
│ Memory    │ 1     │ 0%    │ 2ms      │
╰───────────┴───────┴───────┴──────────╯

Token Usage

╭────────────────────────────┬─────────┬────────┬────────────┬─────────┬──────╮
│ Model                      │ Prompt  │ Cached │ Completion │ Total   │ Cost │
├────────────────────────────┼─────────┼────────┼────────────┼─────────┼──────┤
│ ollama_cloud/glm-5.3-flash │ 1256079 │ 869120 │ 9733       │ 1265812 │ -    │
╰────────────────────────────┴─────────┴────────┴────────────┴─────────┴──────╯

Sessions

╭───────────┬──────────┬──────────╮
│ Execution │ Mode     │ Sessions │
├───────────┼──────────┼──────────┤
│ headless  │ headless │ 1        │
╰───────────┴──────────┴──────────╯
⚠️ 1 log(s)
  • agent:
    …it"
    },
    "id": "call_slo03h9x",
    "type": "function"
    },
    "function": {
    "arguments": "{\"content\":\"macos-15 matrix leg of the CI build job can fail with \\\"The job was not acquired by Runner of type hosted even after multiple attempts\\\" plus \\\"Due to capacity constraints, jobs targeting macOS arm64 runners may experience longer queue times\\\" annotations after queuing ~15m. Downstream test/e2e/postgres jobs then show \\\"skipping\\\" (they need the build matrix). Not a code failure: re-trigger with an empty conventional commit (gh run rerun is not on the Bash allow-list). Also: `gh run view \\u003cid\\u003e --exit-status` exits 0 while the run is still in progress, so do not use it as a pending signal for the Wait tool; use `gh pr checks \\u003cn\\u003e` with pending_exit_codes=[8] instead (8 = pending, 0 = all pass, 1 = failure or no checks reported yet).\",\"description\":\"CI flake: macOS arm64 runner capacity + how to re-trigger and poll CI\",\"name\":\"ci-flakes-and-polling\",\"operation\":\"write\",\"type\":\"project\"}",
    "name": "Memory"
    },
    "id": "call_wj2uieo9",
    "type": "function"
    }
    ]
    }
    "content": "context deadline exceeded",
    "failed": true,
    "role": "tool",
    "timestamp": "2026-11-11T17:39:14.150360275Z",
    "tool_call_id": "call_slo03h9x",
    "tool_execution": {
    "duration": "8m44.02993734s",
    "error": "context deadline exceeded",
    "rejected": false,
    "success": false,
    "tool_name": "Wait"
    }
    }
    "content": "context deadline exceeded",
    "failed": true,
    "role": "tool",
    "timestamp": "2026-11-11T17:39:14.150396593Z",
    "tool_call_id": "call_wj2uieo9",
    "tool_execution": {
    "duration": "20.483017ms",
    "error": "context deadline exceeded",
    "rejected": false,
    "success": false,
    "tool_name": "Memory"
    }
    }
    "completion_tokens": 9733,
    "cost": {
    "currency": "USD",
    "input": 0,
    "output": 0,
    "total": 0
    },
    "message": "Session complete",
    "model": "ollama_cloud/glm-5.3-flash",
    "prompt_tokens": 1256079,
    "requests": 28,
    "total_tokens": 1265812,
    "type": "session_stats"
    }
    ERROR
    max_duration_reached.
    

Triggered by edenreich · Infer Action · OSS

@edenreich
edenreich merged commit 02bb52f into main Nov 11, 2026
13 checks passed
@edenreich
edenreich deleted the fix/killshell-approval branch November 11, 2026 17:56
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.255.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 11, 2026
@edenreich edenreich moved this from Todo to Done in 2026 Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] KillShell asks for approval to stop a background shell the agent started

1 participant