Skip to content

fix(bash): advertise the restart switch so a timed-out session can be revived - #1464

Open
DZH166 wants to merge 1 commit into
FoundationAgents:mainfrom
DZH166:fix/bash-restart-advertised
Open

DZH166 wants to merge 1 commit into
FoundationAgents:mainfrom
DZH166:fix/bash-restart-advertised

Conversation

@DZH166

@DZH166 DZH166 commented Nov 6, 2026

Copy link
Copy Markdown

Problem

Bash.execute(command, restart=False) implements restart=True as the only way to replace a session whose _timed_out flag is set, and _BashSession.run() raises

ToolError: timed out: bash has not returned in 120.0 seconds and must be restarted

for every later command once that flag is set. But Bash.parameters only declares command - restart is missing from the schema, and to_param() is the only interface the model receives:

arguments advertised by the tool schema: ['command']

So one command that exceeds the 120 s session timeout disables the bash tool for the rest of the run, and the tool description's own advice ("retry running the command in the background") cannot take effect because run() raises before anything reaches the shell. Affects SWEAgent and the bash tool exported over MCP.

Fix

Declare the restart switch in Bash.parameters so the model can actually recover a timed-out session.

after: arguments advertised ['command', 'restart']; restart returns 'tool has been restarted.' and starts a fresh shell

Tests

tests/tools/test_bash_restart.py (2 tests):

  • the schema advertises restart;
  • restarting a timed-out session with the advertised arguments replaces the shell.
pytest tests/tools/test_bash_restart.py -q    # before: 2 failed   after: 2 passed
pytest tests/tools -q                         # 6 passed

… revived

restart=True is the only way out of the timed-out state, but Bash.parameters only declared 'command', so the model could never send it and one slow command disabled the bash tool for the rest of the run. Declare the switch in the schema.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant