Order orchestration pills by status (attention first, done by recency)#11363
Order orchestration pills by status (attention first, done by recency)#11363advait-m wants to merge 3 commits into
Conversation
Sorts both the pinned and unpinned sections of the orchestration pill bar by a status-priority key so attention-needing agents bubble to the start and finished agents sink to the end. Within the trailing 'done' section (Cancelled + Success share one bucket), the tiebreaker is the conversation's most-recent activity timestamp so the freshest finish renders leftmost. Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
- Pull DONE_STATUS_KEY into a named const so render code and tests share one source of truth. - Factor pill_secondary_sort_key so the render loop and tests use the same helper instead of parallel implementations. - saturating_neg for the recency key so an unrealistic i64::MIN timestamp can't panic. - Restore the per-field unused-orchestrator comments. - Add the missing blank line below pill_done_recency_key. - Use (.., pill) tuple destructure in the row push loops. Co-Authored-By: Oz <oz-agent@warp.dev>
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR updates the orchestration pill bar to sort pinned and unpinned child pills by attention state first and by completion recency inside the done bucket, while preserving the orchestrator-first and pinned-divider layout. The implementation adds focused sort-key helpers, carries last-modified timestamps into pill specs, and covers the intended ordering rules with unit tests.
Concerns
- No blocking correctness, security, or spec-alignment concerns found.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Loom: https://www.loom.com/share/e011f21848864c4282c699fa426780a4
Fixes https://linear.app/warpdotdev/issue/QUALITY-739/move-done-agents-to-the-end-of-pill-bar
Description
The orchestration pill bar should surface attention-needing agents and push inert agents out of the way, rather than rendering everything in spawn order.
This PR sorts both the pinned and unpinned sections of the pill bar by a status-priority key. The orchestrator pill is still first, the pinned/unpinned divider still appears between the two sections — only the order within each section changes.
Ordering rules
Lower = closer to the start of each section (= more important to the user):
Within the non-done buckets the tiebreaker is spawn order, so freshly-spawned siblings stay where they were and don't shuffle while they run.
Within the done bucket the tiebreaker is recency: the most recently finished agent renders leftmost (based on the conversation's
last_modified_at— latest exchange'sfinish_time). Pills with no known finish time sort to the trailing edge of the done section. Cancelled and Success share the same bucket key on purpose — once an agent is done, the only signal that matters for ordering is how recently it finished, not how it finished.Why these specific rules
BlocklistAIHistoryEvent::UpdatedConversationStatus, so status transitions (Blocked → InProgress when permission is granted, InProgress → Success when an agent finishes) reflect in the bar immediately. No extra plumbing needed.Implementation
pill_status_sort_key(Option<&ConversationStatus>) -> u8helper (Blocked=0, Error=1, InProgress=2, Done=3).pill_done_recency_key(Option<i64>) -> i64helper that returns the negation of the last-modified epoch-ms so larger timestamps (newer) sort first; missing timestamps sort last.PillSpecgains alast_modified_ms: Option<i64>field, populated viaAIConversation::last_modified_at().(status_key, secondary_key, spawn_index, Box<dyn Element>)tuples per bucket andsort_by_keys each independently.secondary_keyis the recency key for done pills and0everywhere else, so spawn order is the natural tiebreaker outside the done bucket.Testing
Five unit tests in
orchestration_pill_bar_tests.rs:pill_status_sort_key_orders_attention_then_in_progress_then_done— Blocked < Error < InProgress < Done, with Cancelled == Success.pill_status_sort_key_treats_none_as_in_progress— orchestrator'sNonestatus safety default.pill_done_recency_key_puts_most_recent_first_and_unknown_last— direction of the recency key + None handling.sort_pills_bubbles_attention_in_progress_keeps_spawn_done_uses_recency— end-to-end mixed-status sort with recency tiebreaking inside done.sort_pills_is_stable_within_in_progress_bucket— InProgress pills keep spawn order regardless of input order.sort_pills_done_bucket_orders_by_recency_regardless_of_completion_type— an old Cancelled sinks behind a fresh Success.