Skip to content

Conversation

@nighca
Copy link
Collaborator

@nighca nighca commented Feb 2, 2026

close #2784.

@gemini-code-assist
Copy link

Summary of Changes

Hello @nighca, 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 a critical issue where asset generation tasks were not being properly cancelled, leading to orphaned processes. The changes ensure that all generation tasks are cancelled and disposed of correctly when the asset library modal is closed or when certain parameters change. This is achieved by implementing a cancel() method in the relevant generator classes and updating the task cancellation logic to handle potential failures and prevent abortion of cancellation requests during disposal. The UI modal integration is also adjusted to ensure proper cleanup during modal closure.

Highlights

  • Cancellation of Asset Generation Tasks: Ensures that asset generation tasks are properly cancelled when the AssetLibraryModal is closed or when the keyword changes, preventing orphaned processes.
  • Task Cancellation Implementation: Implements a cancel() method in AnimationGen, BackdropGen, CostumeGen, and SpriteGen classes to properly cancel ongoing generation tasks.
  • Task Cancellation Logic: Updates the tryCancel() method in the Task class to ensure cancellation requests are not aborted when the task instance is disposed, and handles potential cancellation failures.
  • UImodal Integration: Removes the direct cancellation call in handleModalClose within AssetLibraryModal.vue. The cancellation is now handled in the onCleanup hook.
  • Costume and Animation Cancellation: Adds cancellation of costumes and animations when they are removed from SpriteGen.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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

@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 the issue of ensuring orphaned generation processes are properly cancelled. The core change in tryCancel to prevent the cancellation request from being aborted by a subsequent dispose is a solid fix. The cascading changes in other components and models are consistent and well-implemented. I've only found one minor issue regarding an unused import. Overall, great work on improving the robustness of the asset generation lifecycle.

@nighca nighca marked this pull request as ready for review February 2, 2026 08:21
Copilot AI review requested due to automatic review settings February 2, 2026 08:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures that ongoing generation tasks are properly cancelled when costume or animation generation items are removed during sprite generation, addressing issue #2784.

Changes:

  • Added cancel() calls before dispose() in removeCostume() and removeAnimation() methods in sprite-gen.ts
  • Updated tryCancel() implementation to not abort cancellation requests when task instance is disposed, and added error handling
  • Added comprehensive documentation to all cancel() methods explaining cancellation behavior
  • Updated AssetLibraryModal to properly cancel generation tasks in watch cleanup handlers and renamed preventAssetGenDisposal to keepAssetGenAlive for clarity

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
spx-gui/src/models/gen/sprite-gen.ts Added cancel() calls before dispose() in removeCostume and removeAnimation methods, and documented the cancel() method
spx-gui/src/models/gen/costume-gen.ts Added documentation for the cancel() method
spx-gui/src/models/gen/animation-gen.ts Added documentation for the cancel() method
spx-gui/src/models/gen/backdrop-gen.ts Added documentation for the cancel() method
spx-gui/src/models/gen/common.ts Updated tryCancel() to not use getSignal() and added error handling with capture()
spx-gui/src/components/asset/library/AssetLibraryModal.vue Added cancel() calls in watch cleanup handlers, renamed preventAssetGenDisposal to keepAssetGenAlive, and removed manual cancel call from handleModalClose

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@xgopilot
Copy link
Contributor

xgopilot bot commented Feb 2, 2026

Code Review Summary

Reviewed PR #2792 using specialized subagents. The PR effectively addresses orphaned generation cancellation with excellent design patterns, particularly the keepAssetGenAlive rename and defensive programming in tryCancel().

Critical Issue Found:
handleBackToAssetLibrary (line 298) calls dispose() without cancel(), inconsistent with the pattern established elsewhere (lines 98-99, 110-111). This defeats the purpose of this PR for the "back to library" flow.

Recommendation: Add assetGen.value?.cancel() before the dispose() call at line 298 to ensure consistency.

@nighca nighca merged commit c98e93f into goplus:dev Feb 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancel ongoing-task if costume / animation gen item removed during sprite gen

2 participants