Skip to content

feat(queue): edit queued messages with attachment badges - #201

Merged
nixuuu merged 1 commit into
feat/inline-attachments-2from
feat/inline-attachments-3
Nov 5, 2026
Merged

nixuuu merged 1 commit into
feat/inline-attachments-2from
feat/inline-attachments-3

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Stage 3 of 3, inline attachments: editing queued messages with attachment badges.

Queue editor

  • It uses the composer's text field, so a queued message shows its files as the same badges and its mentions as chips.
  • Backspace and Delete remove a badge as a whole, and Undo brings it back before you save.
  • A line under the field says what happens on save: "obrazek.png leaves the message when you save." or "2 files leave the message when you save."
  • Saving sends the editor's positions in the same format as SendMessage, with a new flag EditQueuedTurnRequest.mentions_complete (field 5, additive).
  • Older clients: an edit with neither positions nor the flag keeps working. The gateway finds the turn's existing badges in the new text by their [name] markers.
  • Queue row: the collapsed row shows badge names instead of [name] markers.
  • Unchanged: a message that has started cannot be edited, and an edit cannot bring in files the message did not have. Adding new files while editing is not part of this change.

Tests: two new gateway tests in attachments.test.ts:

  • a structured edit that reorders the files, drops one, then removes every badge;
  • a plain-text edit from an older client that keeps the badge left in the text.

Checked in a browser, light and dark, desktop and phone: remove a badge, Undo, Save. Two layout bugs in the new editor were fixed:

  • the field had no outline;
  • on a phone, Cancel and Save were pushed out of view.

check:tmp on the whole stack: 1324 passed, 0 failed.

Copy audit (§8): "‹name› leaves the message when you save." uses present tense and states one idea.

@nixuuu
nixuuu added this pull request to stack #202 November 5, 2026 16:21
@nixuuu
nixuuu marked this pull request as ready for review November 5, 2026 16:21
@nixuuu
nixuuu force-pushed the feat/inline-attachments-3 branch from 6ba3aa1 to 615f32c Compare November 5, 2026 16:24
The queue editor uses the composer's text field, so a queued message
shows its files as badges and its mentions as chips. Backspace and Delete
take a badge whole, Undo brings it back, and a line under the field names
the files that leave the message on save.

Saving sends the editor's positions with mentions_complete (new
EditQueuedTurnRequest field 5). Without the flag and without mentions, an
older client's plain-text edit, the gateway finds the turn's mentions in
the new text by their markers. The queue row shows chips by their names.
@nixuuu
nixuuu force-pushed the feat/inline-attachments-3 branch from 615f32c to 990acf3 Compare November 5, 2026 16:26
@nixuuu
nixuuu merged commit 75b858c into dev Nov 5, 2026
9 checks passed
@nixuuu
nixuuu deleted the feat/inline-attachments-3 branch November 5, 2026 16:35
nixuuu added a commit that referenced this pull request Nov 5, 2026
…231)

Stage 5 of 5, mobile UX: catch up with recent web features in the thread
view.

**Done**
- Full access with confirmation.
- The work group is open while the agent works and collapsed after the
turn (the default fold behaviour from #195).
- Tighter work rows in the `work` scale; commands in monospace.
- The shell command card and `!` mode in the composer (#194).
- "Starting" for a dispatched queued turn (#197).
- File badges in the message bubble.
- Finished subagents collapse into one count that opens the lineage
panel (#182).
- The type scale for overlays, chrome, work rows and the context row
(#174/#193).
- Rejected messages show their reason, instead of a generic retry note.

**Deferred**
- The work fold settings (per device on the web).
- Badges placed inline in the text and queue editing (#200/#201); files
stay as chips.
- Linked computers in pickers (needs `LinkedComputerSnapshot` merging).
- Worktree and ref in a new thread.
- Approval countdown and expiry cards.
- Connector errors.
- Mentions, side threads and goal editing.

**Checked** on the Android emulator, light and dark. `check:tmp`: 1425
passed, 0 failed. `expo lint` and `tsc` are clean.

**Copy audit (§8):**
- "Runs as a shell command when delivered."
- "Starting"
- "N finished subagents"
- "Set and manage goals in Canopy on the web."
nixuuu added a commit that referenced this pull request Nov 6, 2026
…ges (#237)

Stage 2 of 4, mobile parity round 2: the composer.

**Changed**
- **Inline badges:** a picked file goes into the text as a badge
`[name]` at the caret (an ATTACHMENT mention, as on the web since #200).
The text field renders mentions as tinted spans, so the characters stay
plain text.
- An edit that touches a badge removes all of it and its file; text
typed inside a badge lands after it.
  - Removing a file removes its badge.
- The field cannot show progress, so files that are uploading or failed
keep a chip above the text with the state and Remove. A stored file has
only its badge.
- Messages send `mentions` with the stored attachment ids; new threads
send `initial_mentions`.
- **Sent messages** show badges at their places (`Turn.mentions`); chips
remain only for files not placed in the text.
- **Queued messages** (as the web queue editor, #201): a "…" next to
"Queued" offers Edit message and Delete.
- The editor uses the same badges; deleting one shows "‹name› leaves the
message when you save." (or "N files leave …").
- Save sends `EditQueuedTurn` with the full positions and
`mentions_complete`; Delete sends `DeleteQueuedTurn`.
- The text and mentions model is `features/composer/message-value.ts`,
shared by the composer and the queue editor.

**Keyboard gap fix** (reported from a real Galaxy Z Fold, folded,
gesture navigation)
- **Bug:** with the keyboard open, the composer floated well above it,
with an empty band under it. Seen in bot chats and threads.
- **Cause, measured on the emulator** at phone width: window 841 dp,
keyboard top at y = 538, status bar 24 dp, nav-bar inset 32 dp.
  - The app runs edge-to-edge, so the window never resizes.
- `KeyboardAvoidingView` sat inside a `SafeAreaView` that kept the 32 dp
bottom inset, and `keyboardVerticalOffset={insets.top}` counted the
status bar again, since frames are already in window coordinates.
- The composer ended 24 dp plus its padding above the keyboard here,
more with a taller status bar.
- **Fix,** no new dependency: `ui/KeyboardArea.tsx` measures how far the
keyboard reaches up from the window's bottom edge (window height minus
the keyboard's `screenY`; on Android `height` leaves out the nav bar
under the keyboard).
- With the keyboard open, the composer sits directly on it with its
normal padding. With the keyboard closed, it keeps the bottom safe-area
inset.
- Applied to the thread screen, bot chat, New thread and Pair, whose
`SafeAreaView` now leaves out the bottom edge.
- The same gap was in `Overlay`'s bottom sheets (Rename, queue editor,
goal and side-thread forms): the sheet now sits on the keyboard and
drops its bottom inset while the keyboard is open.
- New thread on Android had no avoidance at all (the lower pills were
under the keyboard); it now shrinks and scrolls.
- On iOS the area follows `keyboardWillShow`/`Hide` with the keyboard's
own animation timing (instant with reduced motion). **iOS was not
checked on a device:** there is no iOS dev build, and building one did
not fit the Mac's disk budget.
- **Checked** on Canopy_Fold with the stock keyboard: phone width
(folded) and unfolded, keyboard open and closed, a four-line draft.
Thread, bot chat, New thread, Pair and a bottom-sheet form all sit flush
on the keyboard; with the keyboard closed, the composer keeps its inset
above the gesture bar.

**Not done**
- Undo: React Native's text field has no undo stack.
- Tapping a badge to preview the file, and moving queued messages or
switching queueing from the menu.

**Checked**
- Gates clean, as in stage 1.
- Android emulator, light and dark, unfolded and phone width:
  - a badge inserted after typed text, and a long file name wrapping;
  - Backspace into a badge removes the badge and its file;
- a message with a badge in the queue, then sent and shown with the
badge in place;
  - edit and save of a queued message;
- a badge removed in the editor with the "leaves the message" line,
saved without the file.

**Copy audit (§8)**
- "Edit message", "Delete", "Queued message actions", "Edit queued
message", "Cancel", "Save": verbs first; the web's labels.
- "‹name› leaves the message when you save." / "N files leave the
message when you save.": the web's text, one idea, present tense.
nixuuu added a commit that referenced this pull request Nov 13, 2026
nixuuu added a commit that referenced this pull request Nov 13, 2026
Queued messages repeated inline attachment filenames in their preview
and rendered large attachment chips below the row. Web and mobile now
share a plain preview that removes attachment tokens, preserves normal
mention labels, and replaces citation tokens with `citationTokenLabel`.

Muted, pluralised counts (`2 images · 1 file · 1 citation`) sit beside
the preview. Content-only messages use those counts as the preview.
Pressing the summary opens a scrollable list of filenames and citation
labels. Rows retain their existing height and fixed actions;
model/effort/access metadata truncates before the actions.

## Validation

- With `nice -n 19`: install, generated-code check, repository typecheck
(including web/mobile), lint, formatting check and web build pass.
- Three shared-helper regression tests pass: mixed and adjacent tokens,
citation plain labels, preserved typed filenames/normal mentions,
invalid ranges, content-only drafts, pluralised counts and unchanged
source data.
- All CI checks for this head pass, including all four test shards and
the aggregate `Typecheck, tests, builds` check. The PR is ready for
review.
- Full local `nice -n 19 bun run check:tmp`: **2717 pass, 166 skip, 4
fail** across 509 files (1846.06 s); its checked temporary directory is
clean. The failures are in unchanged harness/link code: the Grok
session-recovery test in `bots-harness.test.ts` exceeded its 5 s
timeout, and runs 10/20, 11/20 and 12/20 of the thread-move scenario in
`computer-moves.test.ts` failed on a disconnected peer or missing mirror
update. The isolated Grok `check:tmp` retry passes (1 pass / 0 fail,
3.08 s, no temporary files left). The full local run is **not green**,
despite successful CI. No gateway/worker behavior is changed by this PR.
- No UI tests were added. Native UI has not been exercised on a device.
- Remote install and web builds pass. Reviewed real production queue
components in an isolated temporary fixture: 1/3/12 queued rows at
1440/700/390 px, both themes, text-only/content-only/mixed messages and
long names. All 18 configurations have no horizontal overflow or
attachment filename leak; row heights remain 32 px desktop / 48 px
phone, and action coordinates match across rows. Summaries use muted
11.5 px desktop / 13 px phone text. Checked filename/citation lists,
wrapping, Escape/focus return and the zero-gap composer seam. Chromium
screenshots also ran on the second machine. The disposable checkout,
server, browser profile and remote artifacts are removed; no database
containers were needed. This is a component fixture review, not a live
gateway delivery test.

## Copy audit — docs/copy.md §8

- Filename previews plus repeated blue chips → message text and muted `1
image` / `2 images`, `1 file` / `2 files`, `1 citation` / `2 citations`:
each part has one purpose; counts use the citation glossary and correct
plurals.
- `(only files)` / `(only quotes)` → actual content counts: useful
content replaces an implementation-oriented placeholder. `1 quote` → `1
citation` names the token consistently.
- New disclosure labels: `Show message content: {summary}`, `Message
content`, `Close message content`. Action labels start with a verb; all
use sentence case, short phrases and no terminal punctuation.
- Criteria 1–8 and 10: English copy, sentence case and glossary checked;
no new errors, empty states, missing-data warnings, internal jargon or
“soul” lines. Named controls and readable counts provide meaning without
relying on color or icons. Full filenames remain in details.
- Criterion 9: checked short (`Short.png`), typical and long
filenames/citation labels at desktop, narrow and phone widths in both
themes. Row text truncates to one line; long names wrap in details
without overflow. Counts stay compact and actions remain aligned.

Fixes: #201
Fixes: #398
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