google-gemini / google-gemini/gemini-cli

bug(cli): ShellProcessor ignores abort signal, hung custom command blocks prompt pipeline

Open
#29,314 2 comments 0 reactions 0 assignees View on GitHub
area/core effort/medium kind/bug priority/p1 status/bot-triaged status/need-information
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

## What happened?

`packages/cli/src/services/prompt-processors/shellProcessor.ts:171-178` executes every `!{cmd}` injection with a fresh, never-linked `AbortController`, serially:

```ts
const { result } = await ShellExecutionService.execute(
injection.resolvedCommand,
config.getTargetDir(),
() => {},
new AbortController().signal,
...
);
```

User Ctrl+C / caller abort never reaches the child; the `for...of` loop awaits each command with no per-command timeout. One hung custom command blocks the whole prompt pipeline.

## What did you expect to happen?

Thread the caller's `AbortSignal` into `process()`/`CommandContext`, run with per-command timeout, kill on abort, and continue or fail gracefully with a visible message.

## Client information

- Repo `google-gemini/gemini-cli` @ `main` `9c1b0a610`
- Area `packages/cli/src/services/prompt-processors/shellProcessor.ts:155-180`
- Platform: interactive CLI with `!{sleep 60}` custom command

## Login information

N/A — repro: prompt containing hung `!{...}` + Ctrl+C still blocks.

## Anything else we need to know?

Fix direction: accept `AbortSignal` param, `Promise.allSettled` with timeout + abort-kill, test asserting abort terminates child and pipeline continues.

Contributor guide

Open the contributing guide

Research direction

Start with packages/cli/src/services/prompt-processors/shellProcessor.ts:155-180 and trace process(), CommandContext, and ShellExecutionService.execute(). Reproduce the hung !{sleep 60} command with Ctrl+C, then add coverage asserting that abort terminates the child and the prompt pipeline continues or reports a visible failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.