Skip to content

Fix: list_background_processes prints (Exit Code: null) for signal-killed processes - #29237

Open
laxanarana1513 wants to merge 1 commit into
google-gemini:mainfrom
laxanarana1513:fix/list_background_process
Open

Fix: list_background_processes prints (Exit Code: null) for signal-killed processes#29237
laxanarana1513 wants to merge 1 commit into
google-gemini:mainfrom
laxanarana1513:fix/list_background_process

Conversation

@laxanarana1513

Copy link
Copy Markdown

Summary

  • Stop printing (Exit Code: null) from list_background_processes when a background process has no numeric exit code (signal kill / exitCode: null).
  • Guard the clause with typeof p.exitCode === 'number' in shellBackgroundTools.ts.
  • Add unit tests for null, undefined, 0, and signal-only listings in src/tools/shellBackgroundTools.test.ts.

Details

No design decisions were made for this change.

Related Issues

Fixes #29167

How to Validate

Run npx vitest run src/tools/shellBackgroundTools.test.ts.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@laxanarana1513
laxanarana1513 requested a review from a team as a code owner September 7, 2026 14:56
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where background process listings incorrectly displayed '(Exit Code: null)' for processes that were killed by signals or lacked a numeric exit code. By tightening the validation logic, the tool now correctly omits the exit code clause in these cases, improving the clarity of the process status output.

Highlights

  • Bug Fix: Updated the exit code display logic in list_background_processes to prevent printing '(Exit Code: null)' for processes terminated by signals.
  • Code Improvement: Refined the conditional check to ensure the exit code is only displayed when it is a valid number.
  • Testing: Added comprehensive unit tests covering null, undefined, numeric, and signal-only exit scenarios to ensure correct output formatting.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the size/m A medium sized PR label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

📊 PR Size: size/M

  • Lines changed: 113
  • Additions: +112
  • Deletions: -1
  • Files changed: 2

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the list_background_processes tool in packages/core to correctly handle cases where a background process's exit code is null or undefined. Specifically, it changes the check from p.exitCode !== undefined to typeof p.exitCode === 'number' to ensure that exit codes are only displayed when they are numeric. Additionally, several unit tests have been added to verify this behavior under various scenarios (null exit code, undefined exit code, exit code 0, and signaled exits). There are no review comments, so I have no feedback to provide.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

🛑 Action Required: Evaluation Approval

Steering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged.

Maintainers:

  1. Go to the Workflow Run Summary.
  2. Click the yellow 'Review deployments' button.
  3. Select the 'eval-gate' environment and click 'Approve'.

Once approved, the evaluation results will be posted here automatically.

@gemini-cli gemini-cli Bot added priority/p3 Backlog - a good idea but not currently a priority. area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality labels Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent Issues related to Core Agent, Tools, Memory, Sub-Agents, Hooks, Agent Quality priority/p3 Backlog - a good idea but not currently a priority. size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: list_background_processes prints (Exit Code: null) for signal-killed processes

1 participant