Skip to content

[Bug]: Mobile 2.3.0 (Android): messages sent before the app goes to background are only delivered when it is reopened #38861

Closed as not planned

Description

@Alb11747

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. In T3 Code Mobile 2.3.0 on Android, open a thread on a remote desktop server.
  2. Send a message, then a second one, and put the phone away (lock it or switch apps) soon after.
  3. Leave the app in the background for several hours.
  4. Reopen the app.

Expected behavior

Both messages reach the server shortly after I press Send, whether or not the app stays in the foreground. If a message can't be sent before the OS suspends the app, the thread shows it as not sent yet, so I know to reopen the app.

A message that waited too long should not be sent automatically when the app reopens. By then it can be out of date: the agent may have moved on, or I may have sent the same request another way. Past a cutoff (configurable, or a sensible default such as about an hour), reopening should show it as not sent, with Send now, Edit and Discard actions, instead of delivering it on its own. Inside the cutoff, automatic delivery is fine.

Actual behavior

I sent two messages on the evening of Nov 18. The server received them only when I next opened the app: the first at 2026-11-19 02:39:53Z, the second about 5 s later. The first started a run; the second was queued and then steered into that run at 02:40:23Z. Each arrived exactly once, with no duplicates. Until then, nothing told me they hadn't been sent, so the agent sat idle on work I thought I had asked for. On the server, both messages carry the delivery time, not the time I wrote them. So the transcript also hides the delay.

This looks like the background half of #5436. That issue is closed, but its comments say #6543 fixed only the foreground case, and the outbox in apps/mobile/src/state/thread-outbox-model.ts on main (410109d) still holds unsent messages on the device. It drains only while the app runs.

Possible fixes:

  • Finish the send before the app suspends: an iOS background task, or Android WorkManager or expedited work.
  • Show queued messages as "not sent yet" in the thread.
  • On resume, hold messages older than a cutoff for confirmation (Send now / Edit / Discard) instead of draining them automatically.
  • Send the client's createdAt with the message, so the server can show when it was written.

Impact

Major degradation or frequent failure

Version or commit

Mobile 2.3.0 (store build). The server is a desktop nightly on Windows 11, but the delay is in the client outbox.

Environment

T3 Code Mobile 2.3.0 on Android, talking to a remote desktop server; Claude provider thread.

Logs or stack traces

No client logs. Server-side, both messages first appear at the reopen time above, about 5 s apart, with nothing before.

Activity

  1. changed the title [-][Bug]: Mobile 2.3.0: messages sent before the app goes to background are only delivered when it is reopened[/-] [+][Bug]: Mobile 2.3.0 (Android): messages sent before the app goes to background are only delivered when it is reopened[/+] on Nov 19, 2026
  2. Alb11747 commented on Nov 19, 2026

    @Alb11747
    ContributorAuthor

    I traced this in the code on main (99be1f6) and on the tagged Android 2.3.0 builds (mobile-android-build/2.3.0/*, for example d1909d6 and f3b168b).

    Delivery. Send saves the message to a local outbox on the phone. An in-app worker then delivers it once the connection is usable (apps/mobile/src/state/threadOutboxDelivery.ts, thread-outbox-model.ts). #6543 removed the active-turn gate. Android still has no OS-scheduled delivery for a message that is pending when the app is suspended: I found no WorkManager job, foreground service or headless task wired to the outbox. iOS has a short grace task from #26540. On Android the outbox runs only while the app's JS is alive and connected. On resume, apps/mobile/src/connection/platform.ts and app-state-wakeups.ts probe the connection, and the outbox drains. That fits this report. Delivery is safe from duplicates because the outbox reuses the command ID and the server replays receipts.

    Indicator. The sending phone shows a local Pending row (apps/mobile/src/features/threads/pending-thread-feed.ts). It is easy to miss if you put the app away right after sending, and other clients can't show it at all.

    Timestamp. The outbox records the send time, but packages/client-runtime/src/operations/commands.ts builds message.dispatch without it. The V2 contract has no field for it, so the transcript shows the server's acceptance time. The V1 path sent createdAt; it was lost in the V2 migration (#2829).

    Possible fix. When an outbox entry is saved, also schedule an Android WorkManager job that needs the network (expedited where allowed). It should share the command IDs and acknowledgment handling with the foreground path. Show "Waiting to send" until the server acknowledges. Carry a separate client send time through message.dispatch and the projection, and keep server receipt time for ordering.

    Inferred, not verified on a device: what exactly stopped the send in this case. The app process may have been frozen, the connection lost or stale, or the process restarted.

  3. juliusmarminge commented on Nov 19, 2026

    @juliusmarminge
    Member

    Thanks for writing this up. It asks for new behaviour rather than reporting a defect, so it does not belong in the bug tracker and I'm closing it as not planned here. Feature ideas are discussed in Discussions: please post it there.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions