fix(tui): prevent crash when task references missing child session#26944
Open
shalin-dev wants to merge 2 commits into
Open
fix(tui): prevent crash when task references missing child session#26944shalin-dev wants to merge 2 commits into
shalin-dev wants to merge 2 commits into
Conversation
The Task component's onMount fires sync.session.sync(sessionId) as a fire-and-forget promise without .catch(). When the child session has been deleted or doesn't exist, the unhandled rejection crashes the TUI. Guard the onClick navigation with a childExists memo to prevent navigating to a dead-end session view for missing sessions. Closes anomalyco#26871
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #26871
Type of change
What does this PR do?
The Task component in the session TUI route fires sync.session.sync(sessionId) as a fire-and-forget promise (void ...) without .catch(). When the child session referenced by a task tool part has been deleted or doesn't exist, the SDK call throws and the unhandled promise rejection crashes the TUI process.
Two changes:
Added .catch(() => {}) to the void sync.session.sync() call in onMount. This is a fire-and-forget sync with no user-facing error to show, so swallowing the rejection is appropriate. The sync was only needed to populate local state for a session that no longer exists.
Added a childExists memo that checks sync.data.session for the child session ID, and guards the onClick navigation with it. Without this, clicking a task row for a missing session would navigate to a dead-end session view.
How did you verify your code works?
Screenshots / recordings
N/A - TUI behavior change, no visual diff.
Checklist