Skip to content

[Bug]: Mobile compacts before every send after a provider switch, using the previous provider's stale context usage #41310

Closed as duplicate

Description

@potatobutter

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/mobile

Steps to reproduce

  1. Keep idle compaction enabled ("When you return" or "Before the cache expires").
  2. Use a thread with Codex until its context usage goes above 200K tokens (here: 293,703 / 475,000).
  3. Leave it idle for longer than the prompt cache TTL (70 minutes by default).
  4. Switch the same thread to the Claude Agent provider and keep working. Its own context stays well below 200K (here: ~60–85K / 1,000,000).
  5. Send a message from the mobile app.
  6. Send a message to the same thread from the desktop app.

Expected behavior

Mobile decides whether to compact before sending from the context usage of the active provider thread (Claude, ~80K). It does not compact, like desktop.

Actual behavior

Every send from mobile queues a /compact (message id <messageId>:compact, idleCompaction: "onReturn", creationSource: "mobile") about 150 ms before the real message. Each send pays for a 20–30 s compaction run, even though the active context is ~80K.

Desktop does not compact when sending to the same thread.

The thread's state DB has two provider threads:

provider contextUsage updatedAt status
codex 293,703 / 475,000 6 days earlier idle
claudeAgent 68,282 / 1,000,000 current active

The stale Codex value satisfies the pre-send check: provider is claudeAgent, at least 200K tokens, and older than the cache TTL. So mobile appears to read context usage from the non-active (previous provider) thread, while desktop reads the active one.

The first send right after switching to Claude did not compact, because the Claude provider thread had no contextUsage yet. Every send after that did. Other threads that never went above 200K never compact from mobile, so the threshold works. Only the source of the usage value is wrong.

Possibly related: the mobile pre-send path added in #27935 / #34247 (shouldCompactBeforeSend).

Impact

Minor bug or occasional failure

Version or commit

Mobile app 2.3.0; T3 Code desktop 0.1.11

Environment

Android mobile app; desktop app and server on Windows 11; Codex provider, then Claude Agent provider (claude-opus-5-5, 1M context)

Logs or stack traces

Screenshots, recordings, or supporting files

No response

Workaround

Send from desktop, start a new thread, turn on "Keep full history" for the thread, or set idle compaction to "Never" (which disables it everywhere).

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Nov 23, 2026
  2. juliusmarminge commented on Nov 23, 2026

    @juliusmarminge
    Member

    This is the same problem as #28581, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions