Skip to content

chore(lint): mark intentional fire-and-forget promises with void in a2a-server#27686

Open
Eswar809 wants to merge 1 commit into
google-gemini:mainfrom
Eswar809:chore/lint-floating-promises-a2a
Open

chore(lint): mark intentional fire-and-forget promises with void in a2a-server#27686
Eswar809 wants to merge 1 commit into
google-gemini:mainfrom
Eswar809:chore/lint-floating-promises-a2a

Conversation

@Eswar809

@Eswar809 Eswar809 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of the linter hygiene epic (#19440), which calls out misuse of promises as a target. This eliminates the two @typescript-eslint/no-floating-promises suppressions in a2a-server using the void operator — the idiomatic way to mark an intentionally un-awaited promise.

Both call sites are deliberately fire-and-forget and cannot/should not be awaited:

  • agent/executor.tspushTaskStateFailed is async, but its body only performs a synchronous eventBus.publish, so the returned promise is already settled by the time it is created; not awaiting it is harmless.
  • agent/task.ts — the enclosing addToolResponsesToHistory method is synchronous (returns void), so addHistory cannot be awaited without changing the method's public signature.

Behavior

Unchanged — void only documents the already-existing fire-and-forget intent; no await is introduced, so timing and control flow are identical.

Testing

  • eslint clean on both files
  • tsc --noEmit passes for @google/gemini-cli-a2a-server
  • Existing unit tests pass: executor.test.ts (2) and task.test.ts (16)

…2a-server

Eliminates the two `@typescript-eslint/no-floating-promises` suppressions in
a2a-server by using the `void` operator, the idiomatic way to mark an
intentionally un-awaited promise. Both call sites are deliberately
fire-and-forget and cannot/should not be awaited:

- agent/executor.ts: `pushTaskStateFailed` is async but its body only performs
  a synchronous `eventBus.publish`, so the returned promise is already settled;
  not awaiting it is harmless.
- agent/task.ts: the enclosing `addToolResponsesToHistory` method is
  synchronous (returns `void`), so `addHistory` cannot be awaited without
  changing the method's public signature.

Behavior is unchanged; `void` only documents the existing intent.

Part of google-gemini#19440
@Eswar809 Eswar809 requested a review from a team as a code owner June 5, 2026 06:12
@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 linter warnings regarding floating promises within the a2a-server package. By utilizing the void operator, the changes explicitly document the intentional fire-and-forget nature of specific asynchronous calls, maintaining existing behavior while adhering to project-wide linter hygiene standards.

Highlights

  • Linter Compliance: Replaced @typescript-eslint/no-floating-promises suppressions with the void operator to explicitly mark fire-and-forget promises.
  • Code Hygiene: Improved codebase cleanliness in a2a-server by adopting the idiomatic TypeScript approach for handling un-awaited asynchronous calls.
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/xs An extra small PR label Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

📊 PR Size: size/XS

  • Lines changed: 6
  • Additions: +2
  • Deletions: -4
  • 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 replaces ESLint disable comments with the void operator to handle floating promises in executor.ts and task.ts. Feedback on both changes suggests appending a .catch() block to safely handle and log potential promise rejections, preventing potential Node.js process crashes from unhandled rejections.

);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
pushTaskStateFailed(error, eventBus, taskId, contextId);
void pushTaskStateFailed(error, eventBus, taskId, contextId);

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.

high

Using void to discard a floating promise suppresses the linter warning, but it does not handle potential promise rejections. If pushTaskStateFailed rejects (for example, if eventBus.publish throws an error), it will result in an unhandled promise rejection, which can crash the Node.js process.

To prevent this, attach a .catch() handler to log or handle the error.

        void pushTaskStateFailed(error, eventBus, taskId, contextId).catch((err) => {
          logger.error('[CoderAgentExecutor] Failed to push task state failed:', err);
        });

}
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.geminiClient.addHistory({
void this.geminiClient.addHistory({

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.

high

Using void to discard the promise returned by this.geminiClient.addHistory suppresses the linter warning, but it leaves potential promise rejections unhandled. If the history update fails, it will trigger an unhandled promise rejection, which can crash the Node.js process.

Consider appending a .catch() block to safely handle and log any failures.

      void this.geminiClient.addHistory({
        role: 'user',
        parts,
      }).catch((error) => {
        logger.error('[Task] Failed to add history to Gemini client:', error);
      });

@gemini-cli gemini-cli Bot added priority/p2 Important but can be addressed in a future release. area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! labels Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! priority/p2 Important but can be addressed in a future release. size/xs An extra small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant