Skip to content

fix(daemon): reordering no longer needs multiple C-x C-n/C-x C-p presses near operator-routed sessions - #1254

Merged
edwin-zvs merged 1 commit into
mainfrom
reorder-skip-operator-routed
Aug 16, 2026
Merged

fix(daemon): reordering no longer needs multiple C-x C-n/C-x C-p presses near operator-routed sessions#1254
edwin-zvs merged 1 commit into
mainfrom
reorder-skip-operator-routed

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

Problem

In the TUI session list, reordering with C-x C-n / C-x C-p sometimes 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's move_session still 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_ms creation 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:

  • 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 shows "no other session under this operator to swap with", mirroring the fork edge message.
  • A title that merely looks routed with no matching operator defined stays a flat row, matching client behavior.

Operator names are read from the definitions dir at move time via a new known_operator_names helper that tolerates malformed TOML (reordering only needs to know which title prefixes are claimed). The name list is injected into move_session_with_operator_names so 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_region
  • move_session_reorders_routed_session_among_same_operator_siblings
  • move_session_routed_session_is_noop_at_sibling_edge
  • move_session_treats_unmatched_operator_title_as_flat

Full workspace suite: 2715 passed. Two known load-flaky tests (web_ui_answers_the_tui_chord_keymap goto-timeout, many_small_events_stay_fast_as_history_grows perf bound) failed once under full-parallel load and pass in isolation/rerun.

🤖 Generated with Claude Code

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.
@edwin-zvs
edwin-zvs merged commit 914ad11 into main Aug 16, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the reorder-skip-operator-routed branch August 16, 2026 18:54
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.

1 participant