Add session position indicator in header and refactor sibling logic
I often get lost when switching between subagents. This just adds a simple indicator so that we can see at a glance where we're at.
- Add [current/total] indicator in session header to show position among parent/siblings
- Extract duplicate sibling-finding logic into sync.session.siblings() helper
- Update header.tsx to display position indicator for sessions with siblings
- Refactor moveChild() in index.tsx to use centralized siblings() method
- Improves navigation awareness when working with multiple subagent sessions
@rekram1-node any chance of a review on this? Relatively minor change for a pretty convenient feature
/review
lgtm
Hmm this PR merged last night has slightly modified the logic: https://github.com/sst/opencode/pull/5680
The PR changed the ordering to be backwards and I'm trying to understand why - it felt fine to me previously. But the merge has made it so the parent node is now N/N instead of 1/N. I can modify the logic of this PR to reflect the ordering change, but I want to get a better understanding of why it changed before I do that.
Until then I don't think this is ready to merge
@rekram1-node
On my quick investigation:
PR #5680 changed subagent navigation from chronological (oldest→newest) to reverse-chronological (newest→oldest).
Before the merge:
- Array sorted descending by ID:
[main, sub1, sub2](oldest first) - Pressing "Next" from main → goes to sub1, then sub2
- Position indicator would show: main=1/3, sub1=2/3, sub2=3/3
Now:
- Subagent IDs use descending timestamps (newer session = smaller ID)
- Array sorted ascending by ID:
[sub2, sub1, main](newest first) - Pressing "Next" from main → jumps to sub2 (newest)
- Position indicator shows: main=3/3, sub1=2/3, sub2=1/3
I understand the idea of switching from main directly to the newest agent by pressing
It sort of breaks my mental model of having a list of agents though where
Which navigation order provides better UX I wonder? Personally I prefer the previous logic.