Skip to content

feat(mobile): sort chats needing attention first on Workspaces home - #388

Merged
sambitcreate merged 3 commits into
mainfrom
feature/mobile-needs-attention-sort
Oct 9, 2026
Merged

sambitcreate merged 3 commits into
mainfrom
feature/mobile-needs-attention-sort

Conversation

@sambitcreate

@sambitcreate sambitcreate commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

Item P1 #5 from the Hermex ↔ Aiden Mobile deep dive (matrix #23). This change is client-only. There is no server or protocol change and no contract revision bump.

On the iOS and Android Workspaces home, chats are now ordered by triage tier. Within each tier they keep the existing recency order.

  1. Needs approval
  2. Needs input (a pending question)
  3. Working
  4. Everything else

The tiers mirror desktop's SIDEBAR_ATTENTION_TIERS from #311. The Unread tier is left out, so idle chats stay in plain recency order.

  • Pure function on each platform: aidenNeedsAttentionFirst plus attentionRank.
  • Stable: ties keep the incoming recency order, so rows don't jitter. Swift breaks ties on the enumeration offset, because sorted isn't guaranteed to be stable.
  • One call site per platform: the Workspace sidebar projection (projectAidenWorkspaceSidebar / AidenWorkspaceSidebarProjection.make).
    • It covers the per-workspace sections, including the 20-row preview, and the Recent list.
    • Workspace section order is unchanged. newestActivityAt now uses the newest chat time, because the first row is no longer always the newest.
  • No section headers. Desktop labels tiers only in its separate Needs attention view. The default Workspaces and Recent views just sort, and the existing Approve/Reply pills and the Working spinner already mark each row.
  • Pins: mobile chat rows have none, and desktop's sidebar organization doesn't pin chats either, so there is nothing to preserve.
  • Bots unchanged. Bots home is a contact list of bots, not chat rows, and feat(chats): chat row states and honest unread markers #280 excluded bot chats from row states. It is also being reworked in Bots rework: Grok-style single-thread bots + Pi Durable sessions #377.

This diff avoids the screen files touched by #374 and #377. It changes only the pure functions, the projection, and tests.

Tests

  • Android AidenChatRowStatusTest adds 4 tests. They check that:
    • an approval chat older than a running chat sorts above it, then input, then working, then idle in recency order;
    • ties keep the incoming order, including an active chat with no row state from an older Mac;
    • a stale attention state on an idle chat does not promote it;
    • the sidebar projection puts attention first in both the workspace sections and Recents while keeping workspace order. That last check fails without the newestActivityAt fix.
  • iOS AidenAppearanceTests in AidenChatTests.swift adds the same 4 tests.
  • Local runs:
    • ./gradlew :app:testDebugUnitTest (full Android unit suite) passes.
    • xcodebuild test with Xcode-beta on the iPhone 17 Pro simulator: the AidenChatTests and AidenAppearanceTests classes pass (the 4 new tests included).
  • No new test files, so no registry changes.

CI notes

  • The first CI run failed on the legacy source-grep check in scripts/check-ios-shipping-target.test.mjs, which expects let regularChats = chats … filter. Commit 0f4fa2e95 fixes it without changing behaviour by applying the ordering to a separate triagedChats binding. npm run test:ios-release passes locally.
  • The iOS simulator job then failed twice on head 0f4fa2e95, each time on a different test that this PR doesn't touch. It is listed here per the flaky-test policy. The rerun was used, so I did not rerun again.

🤖 Generated with Claude Code

CI flake log

  • iOS build and simulator tests failed on 0f4fa2e95: AidenNativeIntegrationTests.testBinaryContractRejectionsEmitExactlyOneDiagnosticEach() after the simulator reported "Failed to launch app with identifier: sbtbiswas.AidenOnTheGo" (same symptom as feat(remote): let phones observe and control runs started elsewhere #359). Unrelated to this diff. Reran failed jobs once: https://github.com/sambitcreate/aiden-agent/actions/runs/37724264025

  • Rerun (attempt 2) failed on a different pre-existing test: AidenChatTests.testDraftRestorationDoesNotResumeAfterRemovingAnUploadedAttachment() — XCTAssertFalse failed - The held read must be released by the test (AidenChatTests.swift:3687, 18.7 s; the held-disk-read helper timed out on the CI simulator), again followed by "Failed to launch app". Neither test touches the sidebar projection. Same run link, attempt 2. Rerun budget used; not rerunning again.

Chats waiting on an approval or a question now sort above working chats,
which sort above idle chats, in both the per-workspace sections and the
Recent list on iOS and Android. Tiers mirror the desktop Needs attention
view and rank by the existing displayRowState, so stale server attention
on an idle chat never promotes it. The sort is stable, so rows within a
tier keep their recency order. Workspace section order is unchanged; its
newest-activity time now uses the newest chat rather than the first row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@very-hermes-bot very-hermes-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline review — 1 finding(s) anchored to the diff. See the pinned summary comment for the overview.

Comment on lines +591 to +597
let regularChats = aidenNeedsAttentionFirst(
chats
.filter { workspaceByID[$0.workspaceId] != nil }
.sorted { left, right in
left.updatedAt == right.updatedAt ? left.id < right.id : left.updatedAt > right.updatedAt
}
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2 · logic] Shipping target test scripts/check-ios-shipping-target.test.mjs fails due to exact regex match on let regularChats = chats
Confidence: 0.95

In scripts/check-ios-shipping-target.test.mjs:862, the test asserts /var chats: \[AidenChatSummary\][\s\S]*?let regularChats = chats[\s\S]*?filter \{ workspaceByID\[\$0\.workspaceId\] != nil \}/u, which fails because chats is now wrapped in aidenNeedsAttentionFirst(...).

Repair: Update the regex in scripts/check-ios-shipping-target.test.mjs:862 to match let regularChats = aidenNeedsAttentionFirst( so npm run test:ios-release passes in CI.

@very-hermes-bot

very-hermes-bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Hermes Review Bot

Confidence: 5

Engine: agy/gemini-3.8-flash-high
Review mode: medium
Head: 0f4fa2e953481fbcb1979c6cf173c4b17d91680a
Generated: 2026-10-08T03:52:50+00:00
Reviews: 1

Summary

Mobile chat lists across the iOS and Android Workspaces home are now triaged into urgency tiers (needs_approval > needs_input > working > idle), preserving recency order within each tier. The sorting logic is implemented as pure, stable functions (aidenNeedsAttentionFirst and attentionRank) wired into each platform's sidebar projection (projectAidenWorkspaceSidebar on Android and AidenWorkspaceSidebarProjection.make on iOS). In addition, workspace section newestActivityAt calculation is updated from inspecting the first chat to computing the maximum timestamp across all chats, preventing attention sorting from altering workspace ordering. Maintainers should double-check that omitting the unread tier from mobile triage ordering matches the desired cross-platform UX contract (unread chats remain in plain recency order among idle chats).

Confidence Score: 5/5

Both Android and iOS implementations, pure sorting functions, projection models, call sites, and unit test suites were traced and verified end-to-end against desktop parity and edge cases.

📁 Important Files Changed
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/workspaces/AidenChatRowStatus.kt: Defines AidenChatRowState.attentionRank() and aidenNeedsAttentionFirst to stably sort chat summaries by triage tier.
  • android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/workspaces/AidenWorkspaceHomeViewModel.kt: Applies triage sorting within projectAidenWorkspaceSidebar and computes section newestActivityAt using allChats.maxOfOrNull { it.updatedAt }.
  • ios/AidenOnTheGo/Models/AidenChat.swift: Defines AidenChatRowState.attentionRank and stable aidenNeedsAttentionFirst using enumerated offset tie-breaking.
  • ios/AidenOnTheGo/Features/Remote/AidenWorkspaceShellView.swift: Integrates triage sorting into AidenWorkspaceSidebarProjection.make and calculates newestActivityAt via allChats.map(\.updatedAt).max().
  • android/app/src/test/java/sbtbiswas/AidenOnTheGo/features/workspaces/AidenChatRowStatusTest.kt & ios/AidenOnTheGoTests/AidenChatTests.swift: Comprehensive unit tests validating tier precedence, stability/recency tie-breaking, idle suppression of stale attention states, and workspace ordering preservation.
  • .memory/chat-row-states.md: Records design decisions, Hermex deep-dive context (matrix feat: add Telegram remote control #23), and triage ordering semantics.

Findings

No findings.

Sequence Diagram

Unchanged or not applicable for this change.

[]

Last reviewed commit: 0f4fa2e95348
Reviews (1) · Comment /hermes review to trigger a new review · /hermes review full for full re-review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The iOS projection change breaks npm run test:ios-release through a stale source-pattern assertion. Fix that validation failure before merging; no sorting correctness issues were found.

Reviewed changes across both native clients, including the sidebar projections, screen consumers, and behavioral tests.

  • Attention ordering: Approval, input, and working chats precede idle chats, preserving recency within each tier and using the existing activity-authoritative display state.
  • Sidebar integration: Workspace previews and Recents inherit the ordering, while maximum chat timestamps preserve workspace section order. Search, ownership filtering, and pagination storage remain unchanged.
  • Coverage and validation: Both clients add four behavioral tests. The focused Android suites report 34 passing tests; iOS release validation fails on the assertion noted inline. Native XCTest execution was unavailable on this Linux runner.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

sambitcreate and others added 2 commits October 7, 2026 23:40
…attention-sort

# Conflicts:
#	android/app/src/main/java/sbtbiswas/AidenOnTheGo/features/workspaces/AidenChatRowStatus.kt
Apply the attention ordering to a separate triagedChats binding so the
existing iOS shipping-target contract still finds the owned-chat filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes since the prior Pullfrog review, focusing on the iOS validation fix and the intervening merge from main.

  • Restored shipping validation: Kept the recency-sorted regularChats intermediate and applied attention ordering through triagedChats, preserving the ordering in both workspace sections and Recents.
  • Integrated main changes: Updated the Android activity-indicator import and test accessor without changing attention ranking.
  • Verified the fix: Ran npm run test:ios-release; all 20 Ruby tests and 32 Node tests passed. Inspected the existing behavioral projection tests; native XCTest execution remains unavailable on this Linux runner.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@sambitcreate
sambitcreate merged commit 008c21a into main Oct 9, 2026
58 of 62 checks passed
@sambitcreate
sambitcreate deleted the feature/mobile-needs-attention-sort branch October 9, 2026 00:48
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.

2 participants