Skip to content

Extract independent web cleanup from mobile stack#2855

Merged
juliusmarminge merged 2 commits into
mainfrom
codex/mobile-independent-cleanups
May 28, 2026
Merged

Extract independent web cleanup from mobile stack#2855
juliusmarminge merged 2 commits into
mainfrom
codex/mobile-independent-cleanups

Conversation

@t3dotgg
Copy link
Copy Markdown
Member

@t3dotgg t3dotgg commented May 28, 2026

Summary

  • Extract independent web correctness fixes and small UI/performance cleanups from T3 Code Mobile [WIP] #2013.
  • Preserve zero-usage context snapshots, avoid oversized LRU entries, and make thread ordering robust to invalid timestamps.
  • Keep the mobile/client-runtime PR focused on platform, runtime, and protocol changes.

Validation

  • bun fmt
  • bun lint (passes with existing warnings)
  • bun typecheck
  • bun run test --filter=@t3tools/web --filter=@t3tools/shared

Stack

Note

Fix thread sorting, LRU cache, and context window snapshot handling in web app

  • deriveLatestContextWindowSnapshot in contextWindow.ts now accepts usedTokens === 0 as valid instead of skipping it.
  • LRUCache.set in lruCache.ts rejects entries whose size exceeds the memory budget, preserving any existing entry for that key.
  • Thread sorting in threadSort.ts now falls back to the first valid timestamp when createdAt or updatedAt is invalid.
  • ChatHeader in ChatHeader.tsx is made responsive, wrapping and truncating on small screens.
  • Several Array.includes membership checks are replaced with Set.has in ChatView.tsx and OpenInPicker.tsx.

Macroscope summarized 3ca1460.


Note

Low Risk
Targeted client-side logic and styling with added unit tests; no auth, API, or protocol changes.

Overview
This PR pulls web-only correctness and polish out of a larger mobile stack: behavior fixes, small performance tweaks, and responsive UI adjustments—without platform/runtime protocol work.

Data & sorting: deriveLatestContextWindowSnapshot now accepts usedTokens === 0 so empty usage still shows in the composer. LRUCache.set skips entries larger than the memory budget and leaves existing keys intact on oversized updates. sortThreads / getThreadSortTimestamp use getFirstSortableTimestamp so invalid ISO dates fall back (created_atupdatedAt, and the reverse where needed).

State & attachments: uiStateStore dedupes persisted project order and per-logical-key cwd lists with **Set**s. handoffAttachmentPreviews and OpenInPicker use Set membership instead of Array.includes.

UI: ChatHeader stacks on narrow viewports (title, badge, actions). Sidebar thread rows are slightly shorter on mobile; remote cloud icon and thread list padding are toned down.

Tests: New coverage for zero-usage context snapshots, LRU oversized entries, thread sort fallbacks, and stable trace file ordering in shared observability tests.

Reviewed by Cursor Bugbot for commit 3ca1460. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 53e1f509-0d07-416c-ba2f-c4ac90884b4c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/mobile-independent-cleanups

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels May 28, 2026
Comment thread apps/web/src/lib/lruCache.ts
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge marked this pull request as ready for review May 28, 2026 23:44
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 28, 2026

Approvability

Verdict: Approved

Low-risk cleanup PR containing mechanical performance optimizations (Array.includes → Set.has), minor responsive CSS tweaks, and small bug fixes with accompanying tests. All changes are self-contained with clear intent.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge juliusmarminge merged commit cf07d06 into main May 28, 2026
17 checks passed
@juliusmarminge juliusmarminge deleted the codex/mobile-independent-cleanups branch May 28, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants