Skip to content

Jump over collapsed projects when reordering sessions#255

Merged
edwin-zvs merged 1 commit into
mainfrom
reorder-skip-collapsed-project
May 27, 2026
Merged

Jump over collapsed projects when reordering sessions#255
edwin-zvs merged 1 commit into
mainfrom
reorder-skip-collapsed-project

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

Problem

In the TUI session view, reordering a session over a collapsed project (C-x C-n / C-x C-p, or Shift+Up/Shift+Down) swapped the session with each hidden member of that project one keypress at a time. Because the project's members are hidden, the session appeared to get "stuck" inside the collapsed project for several keypresses before emerging on the other side.

Fix

The reorder logic lives in the daemon (move_session), not the TUI. At a region boundary a session would enter the adjacent group and then swap through its members.

A movable session is always in a visible region (ungrouped, or an expanded group) — you can't select a session hidden inside a collapsed group — so the only collapsed groups a moved session ever meets are the adjacent regions it would step into. The fix is therefore localized to the boundary step:

  • Added group_collapsed plus region_above_skipping_collapsed / region_below_skipping_collapsed, which loop past collapsed groups and return the first visible region in the move direction.
  • move_session now uses these at region boundaries.

Net effect: moving a session toward a collapsed project jumps the entire project in one step, landing at the top/bottom edge of the next visible region instead of interleaving with hidden members. If the only thing in the move direction is a collapsed group (e.g. it's the last group), the move is a no-op rather than burying the session inside it — to drop a session into a collapsed project, expand it first.

Test

Added move_session_jumps_over_collapsed_project covering the down-jump (ungrouped → past collapsed group → top of next expanded group, collapsed members untouched) and the symmetric up-jump back to the ungrouped region.

cargo test -p agentd --bin agentd move_session
test session::tests::move_session_jumps_over_collapsed_project ... ok
test session::tests::move_session_ignores_hidden_subagents_in_reorder_region ... ok

No protocol/client/TUI changes — the collapsed state is already authoritative on the daemon (TUI collapse toggle persists via set_project_collapsedset_group_collapsed).

🤖 Generated with Claude Code

Reordering a session over a collapsed project (C-x C-n / C-x C-p)
previously swapped it with each hidden member one keypress at a time, so
the session appeared to get stuck inside the collapsed project.

A movable session is always in a visible region (ungrouped or an
expanded group), so the only collapsed groups it meets are adjacent
regions it would step into. Add collapse-aware region helpers and use
them at move boundaries so the session jumps the whole collapsed project
in one step, landing at the edge of the next visible region.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@edwin-zvs
edwin-zvs merged commit 463b77d into main May 27, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the reorder-skip-collapsed-project branch May 27, 2026 15:59
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