refactor(coding-agent): delete unreachable empty-selector auto-cancel timers - #1746
Closed
snimu wants to merge 6 commits into
Closed
refactor(coding-agent): delete unreachable empty-selector auto-cancel timers#1746snimu wants to merge 6 commits into
snimu wants to merge 6 commits into
Conversation
This was referenced Aug 27, 2026
Contributor
Author
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.
What was wrong
Both TUI selectors (fork-message and session-tree) carried a 100ms auto-cancel timer for the empty-collection case — but their only construction sites already return early with a user-facing notice when the collection is empty. Unreachable defensive timers, plus the stale-callback hazard they imply (audit: timeouts.md finding 8).
The fix
Pure deletion of both blocks (+1/−8). No replacement assertions — the callers own the precondition.
How it's verified
Reviewer independently enumerated all construction sites (production + tests) confirming the empty case cannot reach the components, and that the deleted blocks held no listener registrations — nothing leaks. tsgo/biome clean, tree-selector 18/18, full CI-style suite failing set matches stack base. Two-model implement/review loop, approved first pass.
Stacked on #1744 (test the whole stack at the leaf; merge base-first). This completes the deletion-only wave of the audit stack.
Note: intentionally no Linear ticket for this cleanup stack, so that check stays red.
Note
Low Risk
Dead-code removal with no change to reachable paths; callers already enforce non-empty collections before opening selectors.
Overview
Removes 100ms
setTimeoutauto-onCancellogic fromTreeSelectorComponentandUserMessageSelectorComponentconstructors when given an empty tree or message list.Those branches were unreachable in production:
showTreeSelectorandshowUserMessageSelectorin interactive mode already bail out with a status message before constructing the components. This is deletion-only cleanup from the timeouts audit (stale callback hazard), with no new guards added inside the components.A changelog note documents the removal of delayed cancellation from empty interactive selectors.
Reviewed by Cursor Bugbot for commit 2033172. Bugbot is set up for automated code reviews on this repo. Configure here.
Linear ticket: ENG-5663
(ticket linked above)
Note
Remove unreachable empty-selector auto-cancel timers in
TreeSelectorComponentandUserMessageSelectorComponentsetTimeout-based auto-cancellation from the constructors of tree-selector.ts and user-message-selector.tsonCancelafter 100ms when given an empty tree or messages array; this logic was unreachable and is now deletedMacroscope summarized 2033172.