Repository navigation
Cancel obsolete command discovery without crashing the UI - #1244
Merged
Merged
Conversation
trissim
marked this pull request as ready for review
October 25, 2026 08:08
trissim
enabled auto-merge
October 25, 2026 08:08
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This was referenced Oct 25, 2026
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.
Fixes #1243.
Defect and owner
Navigation can change while command discovery awaits preparation. Conversation.command_target_context and Conversation.read_command_catalog currently report that normal lifetime change as ValueError. Textual.Worker treats it as ERROR and terminates the application. ContextualCommand.apply has the sibling target-revalidation path.
Use the existing cancellation owner: CommandDiscoveryCancelled derives from asyncio.CancelledError, which Textual.Worker._run already records as CANCELLED rather than WorkerFailed. Both discovery guards and the target revalidation use it. CommandCatalog.execute catches only that specific cancellation at the submission boundary, tells the user the command was not run, and marks it handled so it cannot fall through into an agent prompt. Genuine task cancellation and unrelated errors are not swallowed. No alternate cache, duplicate navigation state, broad catch, retries or retargeted command execution.
Source evidence
Fresh main at source trace: 18c9906. Existing NRA ModuleSyntaxIndex indexed 1,042 Toad/Core/Textual modules and 7,733 class declarations with zero parse omissions. Traced declarations, imports, guards, writes and all syntactic consumers of command_target_context/read_command_catalog/update_slash_commands/CommandCatalog/TargetContext. Consumers include native and Comms chat submissions, slash completion, target suggestions and sidebar/menu discovery. Dynamic Python method binding is not statically proven. Initial NRA invocation under the installed runtime failed on metaclass-registry incompatibility; the completed pass used NRA's own existing environment, not a copied scanner.
Before: both conversation invalidation guards and ContextualCommand target mismatch raise ordinary ValueError; background discovery and foreground command submission disagree about cancellation. After: one nominal cancellation meaning goes to the inherited worker cancellation owner, with foreground handling only at the shared command execution boundary. The unsafe ValueError paths are deleted in place.
Checks and live path
Delivery
Tristan explicitly requested this fatal blocker be hotfixed locally for immediate use. Local installed files were changed only from the reviewed three-file source diff, with original preimages retained; no agent restart, root migration or UNKNOWN input replay. The branch remains the durable source repair and lands through the merge queue.
Assumed: