Skip to content

fix(video-assignment): clear pending resolves and fix bogus error log#133

Open
totoathos wants to merge 3 commits intogoogleworkspace:mainfrom
totoathos:fix/handlers
Open

fix(video-assignment): clear pending resolves and fix bogus error log#133
totoathos wants to merge 3 commits intogoogleworkspace:mainfrom
totoathos:fix/handlers

Conversation

@totoathos
Copy link
Copy Markdown

What changed

Fixed an error log in video_assignment_channel_handler that was being emitted unconditionally. It now logs only when the server sends a canvas ID that the client never created (missing layout).

Prevented a memory/state leak by always clearing pendingRequestResolveMap entries when onVideoAssignmentResponse is received (using try/finally to guarantee cleanup even if the callback throws).

Why

The bogus error log polluted logs and made real issues harder to spot.

Pending request resolvers were never removed, causing unbounded growth during long sessions or retries.

Files

web/internal/channel_handlers/video_assignment_channel_handler.ts

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @totoathos, 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 two key issues: reducing log noise by making an error message conditional and preventing a potential memory leak by guaranteeing cleanup of pending request resolvers. These changes improve system stability and maintainability by ensuring cleaner logs and more efficient resource management.

Highlights

  • Error Logging: The error log in video_assignment_channel_handler for 'server sent a canvas that was not created by the client' is now conditional, only appearing when the client truly hasn't created the canvas ID sent by the server. This prevents unnecessary log pollution.
  • Memory/State Leak Prevention: Ensured that entries in pendingRequestResolveMap are always cleared when onVideoAssignmentResponse is received, even if the resolution callback throws an error. This prevents unbounded growth of the map during long sessions or retries.
Changelog
  • web/internal/channel_handlers/media_stats_channel_handler.ts
    • Updated the formatting of an 'if' conditional statement.
  • web/internal/channel_handlers/video_assignment_channel_handler.ts
    • Refactored the onVideoAssignmentResponse method to use a try/finally block, ensuring pendingRequestResolveMap entries are always deleted.
    • Modified the onVideoAssignmentResources method to conditionally log an error only when a canvas ID from the server is genuinely not found on the client side.
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

Copy link
Copy Markdown

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

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 effectively addresses two issues: a memory leak in video_assignment_channel_handler by ensuring pending request resolvers are always cleared, and a bogus error log that was being emitted unconditionally. The use of try/finally to guarantee cleanup is a solid defensive programming practice. My review includes a couple of minor suggestions to improve code style for better consistency and readability.

Comment thread web/internal/channel_handlers/media_stats_channel_handler.ts Outdated
Comment thread web/internal/channel_handlers/video_assignment_channel_handler.ts
totoathos and others added 2 commits February 15, 2026 17:09
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants