fix(@scripts/session-tools): 🐛 fix triage sorting for global priority display

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-05-17 06:05:11 -07:00
parent 13ff01a997
commit 7086061c83

View file

@ -421,7 +421,13 @@ cmd_resume() {
# picker even when triage produces > (35 - tmux_count) rows on a single # picker even when triage produces > (35 - tmux_count) rows on a single
# host that would otherwise crowd them out. # host that would otherwise crowd them out.
_tmux=$(scan_hosts | while IFS= read -r h; do list_tmux_on "$h"; done) _tmux=$(scan_hosts | while IFS= read -r h; do list_tmux_on "$h"; done)
_triage=$(scan_hosts | while IFS= read -r h; do list_triage_on "$h"; done) # Triage rows: col 4 = priority, col 9 = mtime. Each host's rows come
# pre-sorted by priority desc, but the per-host blocks are concatenated
# so a P5 on apricot would sit after all local rows and get truncated.
# Re-sort globally by (priority desc, mtime desc) so the top of the
# picker is the actual highest priority across the fleet.
_triage=$(scan_hosts | while IFS= read -r h; do list_triage_on "$h"; done \
| sort -t"$(printf '\t')" -k4,4nr -k9,9nr)
_t_count=0 _t_count=0
[ -n "$_tmux" ] && _t_count=$(printf '%s\n' "$_tmux" | wc -l | tr -d ' ') [ -n "$_tmux" ] && _t_count=$(printf '%s\n' "$_tmux" | wc -l | tr -d ' ')
[ -n "$_triage" ] && _d_total=$(printf '%s\n' "$_triage" | wc -l | tr -d ' ') [ -n "$_triage" ] && _d_total=$(printf '%s\n' "$_triage" | wc -l | tr -d ' ')