fix(daemon): reordering no longer needs multiple C-x C-n/C-x C-p presses near operator-routed sessions - #1254
Merged
Merged
Conversation
Operator-routed sessions (title `operator:<name>...`) render nested under their operator's row in every list client, never at their flat position — but move_session still counted them as flat-region members. Reordering a session position-adjacent to N routed sessions took N+1 presses of C-x C-n / C-x C-p: every press before the last swapped with a row the user cannot see, with no visible change and no status message. Same class of bug as the earlier fork fix, resolved the same way: - The flat reorder region now excludes sessions routed to a defined operator, so one press crosses them. - A routed session reorders only among sessions routed to the same operator (the order its operator row displays), instead of swapping with — and silently perturbing — an unrelated flat neighbor. - At the edge of its routed cluster the move reports a no-op, and the TUI explains it, mirroring the fork edge message. Operator names are read from the definitions dir at move time (the same source list clients render from); a title that merely looks routed with no matching operator stays a flat row, matching client behavior.
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.
Problem
In the TUI session list, reordering with
C-x C-n/C-x C-psometimes needed multiple presses before the row visibly moved (reported as "exact condition not known").Root cause: operator-routed sessions (title
operator:<name>/operator:<name>:...) render nested under their operator's row in every list client, never at their flat position — but the daemon'smove_sessionstill counted them as members of the flat reorder region. A session position-adjacent to N routed sessions took N+1 presses: every press before the last swapped positions with a row the user cannot see, producing no visible change and no status message (the daemon reported a successful move). Routed sessions get fresh-now_mscreation positions, so they interleave with everything else, which is why the trigger felt nondeterministic.This is the same class of bug previously fixed for hidden subagents, the minibuffer, archived sessions, and forks — operators were the remaining hidden-row category.
Fix
Mirrors the fork fix:
Operator names are read from the definitions dir at move time via a new
known_operator_nameshelper that tolerates malformed TOML (reordering only needs to know which title prefixes are claimed). The name list is injected intomove_session_with_operator_namesso tests don't depend on process-global path discovery.Tests
Four new daemon regression tests alongside the existing fork/subagent/archived ones:
move_session_skips_operator_routed_sessions_in_flat_regionmove_session_reorders_routed_session_among_same_operator_siblingsmove_session_routed_session_is_noop_at_sibling_edgemove_session_treats_unmatched_operator_title_as_flatFull workspace suite: 2715 passed. Two known load-flaky tests (
web_ui_answers_the_tui_chord_keymapgoto-timeout,many_small_events_stay_fast_as_history_growsperf bound) failed once under full-parallel load and pass in isolation/rerun.🤖 Generated with Claude Code