You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Bash execution environment hangs - all commands timeout #575
All shell commands hang indefinitely and timeout regardless of complexity. Tested with simple commands like echo "Hello, world!" and brew info. Commands do not execute or return output.
@kapral18 we made some major updates to the shell tool in v0.0.355. Would you mind upgrading to latest and seeing if that fixes your problem. Shell session management was one thing specifically that was improved.
@kapral18 we made some major updates to the shell tool in v0.0.355. Would you mind upgrading to latest and seeing if that fixes your problem. Shell session management was one thing specifically that was improved.
@RyanHecht maybe you have any ideas ? I would really appreciate being able to use copilot-cli, if you need any additional specific diagnostics data let me know
Copilot found a bash that did not have readline support, therefore non-interactive and that made it fail.
Background:
As I'm on nix, and was running everything in a nix shell, the bash was not the bashInteractive version, but a minimal version without readline support. Adding bashInteractive from nixpkgs fixed it for me 🎉
So if somebody else has the problem and wants to check if bash has readline:
Copilot found a bash that did not have readline support, therefore non-interactive and that made it fail.
Background:
As I'm on nix, and was running everything in a nix shell, the bash was not the bashInteractive version, but a minimal version without readline support. Adding bashInteractive from nixpkgs fixed it for me 🎉
So if somebody else has the problem and wants to check if bash has readline:
My build environment is Windows so I have a compile.sh in my folder that just does this:
#!/usr/bin/bash
cmd.exe /c build.cmd java
I can run that script in WSL and it works.
I can start copilot and I can run the script as !compile.sh and it works - I see all the compiler output.
I tell copilot to run it and copilot will run it but it then just hangs, it never comes back. It keeps monitoring the run but there is no output ever.
Here is a sanitized excerpt from a failing Copilot CLI shell session state (~/.copilot/session-state/fd75ead5-7e03-437b-9341-cf8b87ecc0b8/events.jsonl).
Copilot CLI version: 0.0.418
Repro prompt: “Use bash with mode=async to run: sleep 2; echo done. Then call read_bash with delay 3 seconds on the returned shellId and report output.”
Notable behavior:
bash returns a “still running” message with a negative duration (-0.001 seconds)
Immediately after, read_bash fails with <no active shell sessions> for the returned shellId
[
{
"type": "session.start",
"data": {
"sessionId": "fd75ead5-7e03-437b-9341-cf8b87ecc0b8",
"copilotVersion": "0.0.418",
"startTime": "2026-02-25T21:39:12.798Z",
"context": {
"repository": "kapral18/kibana",
"cwd": "<redacted>",
"gitRoot": "<redacted>",
"branch": "<redacted>"
}
}
},
{
"type": "user.message",
"data": {
"content": "Use bash with mode=async to run: sleep 2; echo done. Then call read_bash with delay 3 seconds on the returned shellId and report output."
}
},
{
"type": "tool.execution_start",
"data": {
"toolCallId": "toolu_vrtx_018jFJkVLJBjNKRZpP8CAGkh",
"toolName": "bash",
"arguments": {
"command": "sleep 2; echo done",
"description": "Test async bash with sleep",
"mode": "async"
}
}
},
{
"type": "tool.execution_complete",
"data": {
"toolCallId": "toolu_vrtx_018jFJkVLJBjNKRZpP8CAGkh",
"toolName": "bash",
"success": true,
"result": {
"content": "<command with shellId: 0 is still running after -0.001 seconds. The command is still running but hasn't produced output yet. It may be waiting for input or still processing. Use read_bash to continue waiting, write_bash if you think it needs input, or stop_bash to stop it.>",
"detailedContent": "<command with shellId: 0 is still running after -0.001 seconds. The command is still running but hasn't produced output yet. It may be waiting for input or still processing. Use read_bash to continue waiting, write_bash if you think it needs input, or stop_bash to stop it.>"
},
"toolTelemetry": {
"properties": {
"customTimeout": "false",
"executionMode": "async",
"detached": "false"
},
"metrics": {}
}
}
},
{
"type": "tool.execution_start",
"data": {
"toolCallId": "toolu_vrtx_01QvEdVaoqgrE1KVvvPCWKZk",
"toolName": "read_bash",
"arguments": {
"shellId": "0",
"delay": 3
}
}
},
{
"type": "tool.execution_complete",
"data": {
"toolCallId": "toolu_vrtx_01QvEdVaoqgrE1KVvvPCWKZk",
"toolName": "read_bash",
"success": false,
"error": {
"message": "Invalid shell ID: 0. Please supply a valid shell ID to read output from.\n\n<no active shell sessions>",
"code": "failure"
},
"toolTelemetry": {}
}
}
]
I enabled interactive shell logs via --log-interactive-shells and it looks like the failure happens before the user command runs, during shell session initialization.
Finally found the system-side culprit that makes bash / read_bash sessions fail.
Root cause
My ~/.inputrc had this binding:
Control-j: menu-complete
In readline, Control-j is the LF/newline byte (\n, 0x0A). Copilot’s PTY driver injects commands into an interactive /bin/bash by writing text + LF as the “press Enter” delimiter.
So instead of “accept-line”, bash/readline interprets Copilot’s injected newlines as menu-complete, which causes:
BEL beeps (^G) / redisplay noise
random completion text appearing in the buffer
Copilot’s wrapped init command never actually running
then executeCommand(... timeout=5000ms) → shell shutdown → read_bash sees <no active shell sessions>
How we proved it
A minimal PTY harness reproduces the exact corruption when sending LF (\n) into bash --norc --noprofile with that .inputrc binding.
Two independent fixes make it work immediately:
send CR (\r) instead of LF for “Enter”
or disable readline config with INPUTRC=/dev/null
Removing the Control-j binding from ~/.inputrc also fixes it.
Workaround for affected users
Quick workaround:
env INPUTRC=/dev/null copilot
Or remove / change the Control-j binding in ~/.inputrc.
Suggestion for copilot-cli
To be robust against user readline configs, consider sending carriage return (\r) rather than \n when simulating Enter in PTY interactive shells (or set INPUTRC=/dev/null for the tool’s internal shell sessions).
(Separate note: macOS /bin/bash also prints the “default interactive shell is now zsh” banner in PTY-interactive mode; it’s noisy but not the root cause here.)
Activity
EvanBoyle commentedon Nov 15, 2025
@kapral18 we made some major updates to the shell tool in v0.0.355. Would you mind upgrading to latest and seeing if that fixes your problem. Shell session management was one thing specifically that was improved.
kapral18 commentedon Nov 16, 2025
@EvanBoyle I updated to latest
kapral18 commentedon Nov 16, 2025
@EvanBoyle same with hello world
EvanBoyle commentedon Nov 16, 2025
Ah, I see from your other screenshots that this is with haiku?
kapral18 commentedon Nov 16, 2025
@EvanBoyle nope, happens across all models.
kapral18 commentedon Nov 17, 2025
@RyanHecht maybe you have any ideas ? I would really appreciate being able to use copilot-cli, if you need any additional specific diagnostics data let me know
markus1189 commentedon Nov 17, 2025
Same here on x86 linux (nixos). 354 still works, and all builds up to 358 are broken for me too
kapral18 commentedon Nov 18, 2025
@tidy-dev any ideas?
Foo-x commentedon Nov 18, 2025
Same here on WSL2 with 0.0.360.
0.0.354 works.
kapral18 commentedon Nov 18, 2025
I was on 0.0.354 when I opened the issue. So for me it didn't work even then. But im on amd mac
EvanBoyle commentedon Nov 18, 2025
Thank you all for the reports. We have some tool instructions updates we can roll out that will hopefully help smooth this out.
9 remaining items
markus1189 commentedon Nov 22, 2025
I found the problem in my setup:
Copilot found a
bashthat did not have readline support, therefore non-interactive and that made it fail.Background:
As I'm on nix, and was running everything in a
nix shell, the bash was not thebashInteractiveversion, but a minimal version without readline support. AddingbashInteractivefrom nixpkgs fixed it for me 🎉So if somebody else has the problem and wants to check if bash has readline:
kapral18 commentedon Nov 25, 2025
that's a nix specific problem.
Other systems have full bash package with readline support. So the problem persists for me on Mac with both native and brew versions of bash.
kapral18 commentedon Dec 2, 2025
@shibbas @dereklegenzoff @EvanBoyle any update on this?
kapral18 commentedon Dec 14, 2025
I just tried latest version 0.0.369 and it's still the same
amkza commentedon Jan 27, 2026
I'm having a similar issue.
I'm running the latest version v0.0.395
I'm running Windows Server 2025 with WSL.
My build environment is Windows so I have a compile.sh in my folder that just does this:
I can run that script in WSL and it works.
I can start copilot and I can run the script as !compile.sh and it works - I see all the compiler output.
I tell copilot to run it and copilot will run it but it then just hangs, it never comes back. It keeps monitoring the run but there is no output ever.
amkza commentedon Jan 27, 2026
Okay I just tried something and I got it working.
Looks like it is having issues reading the stdout
I changed my script from:
to
And I tell copilot to read the output file when done.
This works 100% - I now have feedback from my build and it could see compiler errors and fixes it and retries the build etc.
kapral18 commentedon Feb 25, 2026
Here is a sanitized excerpt from a failing Copilot CLI shell session state (
~/.copilot/session-state/fd75ead5-7e03-437b-9341-cf8b87ecc0b8/events.jsonl).0.0.418sleep 2; echo done. Then callread_bashwith delay 3 seconds on the returned shellId and report output.”Notable behavior:
bashreturns a “still running” message with a negative duration (-0.001 seconds)read_bashfails with<no active shell sessions>for the returnedshellId[ { "type": "session.start", "data": { "sessionId": "fd75ead5-7e03-437b-9341-cf8b87ecc0b8", "copilotVersion": "0.0.418", "startTime": "2026-02-25T21:39:12.798Z", "context": { "repository": "kapral18/kibana", "cwd": "<redacted>", "gitRoot": "<redacted>", "branch": "<redacted>" } } }, { "type": "user.message", "data": { "content": "Use bash with mode=async to run: sleep 2; echo done. Then call read_bash with delay 3 seconds on the returned shellId and report output." } }, { "type": "tool.execution_start", "data": { "toolCallId": "toolu_vrtx_018jFJkVLJBjNKRZpP8CAGkh", "toolName": "bash", "arguments": { "command": "sleep 2; echo done", "description": "Test async bash with sleep", "mode": "async" } } }, { "type": "tool.execution_complete", "data": { "toolCallId": "toolu_vrtx_018jFJkVLJBjNKRZpP8CAGkh", "toolName": "bash", "success": true, "result": { "content": "<command with shellId: 0 is still running after -0.001 seconds. The command is still running but hasn't produced output yet. It may be waiting for input or still processing. Use read_bash to continue waiting, write_bash if you think it needs input, or stop_bash to stop it.>", "detailedContent": "<command with shellId: 0 is still running after -0.001 seconds. The command is still running but hasn't produced output yet. It may be waiting for input or still processing. Use read_bash to continue waiting, write_bash if you think it needs input, or stop_bash to stop it.>" }, "toolTelemetry": { "properties": { "customTimeout": "false", "executionMode": "async", "detached": "false" }, "metrics": {} } } }, { "type": "tool.execution_start", "data": { "toolCallId": "toolu_vrtx_01QvEdVaoqgrE1KVvvPCWKZk", "toolName": "read_bash", "arguments": { "shellId": "0", "delay": 3 } } }, { "type": "tool.execution_complete", "data": { "toolCallId": "toolu_vrtx_01QvEdVaoqgrE1KVvvPCWKZk", "toolName": "read_bash", "success": false, "error": { "message": "Invalid shell ID: 0. Please supply a valid shell ID to read output from.\n\n<no active shell sessions>", "code": "failure" }, "toolTelemetry": {} } } ]kapral18 commentedon Feb 25, 2026
I enabled interactive shell logs via
--log-interactive-shellsand it looks like the failure happens before the user command runs, during shell session initialization.Session directory (local):
~/.copilot/session-state/334c9413-42ac-463c-b109-5b8014099f59/From
shell-logs/shell-0-*.log(same pattern inshell-1-*.log):So the
bashtool is failing during the init step, the session gets shut down, and thenread_bash/list_bashcorrectly see<no active shell sessions>.Also seeing unexpected PTY output in the same logs like:
even though the spawned shell is
bash --norc --noprofile.kapral18 commentedon Feb 26, 2026
Finally found the system-side culprit that makes
bash/read_bashsessions fail.Root cause
My
~/.inputrchad this binding:In readline,
Control-jis the LF/newline byte (\n, 0x0A). Copilot’s PTY driver injects commands into an interactive/bin/bashby writing text + LF as the “press Enter” delimiter.So instead of “accept-line”, bash/readline interprets Copilot’s injected newlines as menu-complete, which causes:
^G) / redisplay noiseexecuteCommand(... timeout=5000ms)→ shell shutdown →read_bashsees<no active shell sessions>How we proved it
A minimal PTY harness reproduces the exact corruption when sending LF (
\n) intobash --norc --noprofilewith that.inputrcbinding.Two independent fixes make it work immediately:
\r) instead of LF for “Enter”INPUTRC=/dev/nullRemoving the
Control-jbinding from~/.inputrcalso fixes it.Workaround for affected users
Control-jbinding in~/.inputrc.Suggestion for copilot-cli
To be robust against user readline configs, consider sending carriage return (
\r) rather than\nwhen simulating Enter in PTY interactive shells (or setINPUTRC=/dev/nullfor the tool’s internal shell sessions).(Separate note: macOS
/bin/bashalso prints the “default interactive shell is now zsh” banner in PTY-interactive mode; it’s noisy but not the root cause here.)kapral18 commentedon Feb 26, 2026
@SteveSandersonMS @dereklegenzoff @shibbas @EvanBoyle feel free to close this as original issue is resolved unless you want to track this for a follow up fix for carriage return suggestion.
jonas054 commentedon Mar 7, 2026
Excellent work @kapral18! 🥇 I've had the same problem for weeks. Your solution fixed it.
toby commentedon Mar 17, 2026
Closing — reporter confirmed the original issue is resolved.
mvillafuertem commentedon Apr 17, 2026
@kapral18 @toby why has this issue been closed? I'm still experiencing the same error in the latest version