Skip to content

feat(mobile): hold a send through a running compaction instead of refusing it - #1679

Merged
huichen merged 2 commits into
mainfrom
pr/huichen
Nov 24, 2026
Merged

huichen merged 2 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

The mobile composer used to disable Send for the whole of a manual context compaction, so a message written while the summary was being produced could not be handed over at all. It now takes the tap and holds it: the button stays live, the draft stays in the field, and the send leaves the moment the Agent closes the compaction fence.

Commits

  • feat(mobile): hold a send through a running compaction instead of refusing it — the composer keeps Send enabled during a compaction, useComposerSubmission waits for the fence to open and delivers the words the reader tapped with; a draft edited meanwhile is not sent, leaving the screen ends the wait without delivering, and the composer shows "Sending when compaction finishes…" while the tap is held.

Verification

Run in mobile/ on dev-huichen@8021fd1ad:

  • npx tsc --noEmit — passed
  • npx eslint . — passed
  • npx jest --runInBand — 174 suites / 3324 tests passed (includes the two new composer tests)

mobile/node_modules was missing @react-native/[email protected] (pinned by package-lock.json); it was unpacked locally to run the suite. No tracked file or lockfile changed.

User-visible changes

Mobile chat composer during a manual context compaction:

  • Before: Send was disabled for the entire compaction and read "Compacting"; a message written during a long compaction could not be sent.
  • After: Send stays enabled; a tap is held (button shows busy, composer says "Sending when compaction finishes…") and is delivered when the compaction ends. A draft edited while waiting is not sent; leaving the screen cancels the wait.
  • New i18n keys: chat.sendAfterCompaction (en / zh).
  • Rollback: c453c3eb1.

Notes

None.

…using it

A manual compaction owns the session for as long as the summary takes —
minutes on a long conversation — and the Agent refuses prompts meanwhile
(`session_busy`, `busy_reason: compaction`). The phone disabled the send
button for that whole window, so a message written during a compaction
could not be handed over at all.

The tap is taken now instead of dropped: the button stays live, the draft
stays in the field, `useComposerSubmission` waits for the fence to open
and sends the words the reader tapped with (a draft edited meanwhile is
not sent; leaving the screen ends the wait without delivering). While the
tap waits, the send button reads busy and the composer says
"Sending when compaction finishes…". The send path itself still refuses
a prompt mid-compaction, so the wait is the only new behaviour.
@huichen
huichen enabled auto-merge (squash) November 24, 2026 01:22
@huichen
huichen merged commit 081afd5 into main Nov 24, 2026
18 of 20 checks passed
@huichen
huichen deleted the pr/huichen branch November 24, 2026 01:50
huichen added a commit that referenced this pull request Nov 25, 2026
…nding it to the queue

A manual compaction owns the session for as long as the summary takes — minutes
on a long conversation. The Agent takes a prompt written meanwhile and runs it
when the fence opens (#1680), but that leaves the message in a queue this window
says nothing about: the draft vanished from the box and nothing arrived, which
reads as "my message disappeared".

Take the click instead, the way the phone already does (#1679): the draft stays
in the box, the send control reads busy, the control row says 压缩完成后发送…,
and the words that were there when the button was pressed go out when the
compaction ends. Four endings are not a send and all keep the draft — edited
during the wait (text, attachments or the card's answer), switched conversation,
a run taking the session meanwhile, or the window closing. The wait is local
state, not the Agent's queue: a held message dies with the window, which is the
behaviour the user picked for this surface.

The send path itself is untouched: compaction still is not a reason to disable
the button, and nothing about the Agent's compaction or queue semantics changes.

Verified: tsc --noEmit, eslint, and the whole desktop suite (442 files / 6296
tests) green; the new `Composer.compaction.test.tsx` fails outright with the
hold removed and separately with the "edited meanwhile" comparison removed.
Captured against the demo data in headless Chrome: the same click before (draft
gone, message queued silently) and after (draft kept, control busy, hint shown).
huichen added a commit that referenced this pull request Nov 25, 2026
…nding it to the queue (#1696)

A manual compaction owns the session for as long as the summary takes — minutes
on a long conversation. The Agent takes a prompt written meanwhile and runs it
when the fence opens (#1680), but that leaves the message in a queue this window
says nothing about: the draft vanished from the box and nothing arrived, which
reads as "my message disappeared".

Take the click instead, the way the phone already does (#1679): the draft stays
in the box, the send control reads busy, the control row says 压缩完成后发送…,
and the words that were there when the button was pressed go out when the
compaction ends. Four endings are not a send and all keep the draft — edited
during the wait (text, attachments or the card's answer), switched conversation,
a run taking the session meanwhile, or the window closing. The wait is local
state, not the Agent's queue: a held message dies with the window, which is the
behaviour the user picked for this surface.

The send path itself is untouched: compaction still is not a reason to disable
the button, and nothing about the Agent's compaction or queue semantics changes.

Verified: tsc --noEmit, eslint, and the whole desktop suite (442 files / 6296
tests) green; the new `Composer.compaction.test.tsx` fails outright with the
hold removed and separately with the "edited meanwhile" comparison removed.
Captured against the demo data in headless Chrome: the same click before (draft
gone, message queued silently) and after (draft kept, control busy, hint shown).
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.

1 participant