Skip to content

feat(attachments): preview images and text files - #398

Merged
nixuuu merged 1 commit into
devfrom
feat/attachment-previews
Nov 9, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/attachment-previews

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Hovering or focusing an attachment now shows a compact preview; clicking opens an image or text viewer. This covers inline sent-message chips, composer drafts, queued messages and the queue editor. Markdown uses the existing timeline renderer, with a device-persisted Rendered/Source choice. Mobile sent messages and uploaded drafts reuse the native text/Markdown viewer.

Text reads are lazy, session-cached and limited to 128 KiB / 2,000 lines. The additive owner-scoped GetAttachment preview flag bounds the SQL read and follows qualified attachment IDs to their home computer. Downloads retain the complete file. UTF-8 replacement decoding rejects binary content; HTML stays text and web SVG stays in an img.

Validation

  • bun install; bun run gen:check; bun run typecheck; bun run lint; bun run format:check; web build.
  • Focused attachment/queue checks after rebasing: 56 pass / 0 fail across 8 files, including composer/queue steer delivery with files, ownership, restart recovery, bounded reads/full downloads, linked-home routing and binary/UTF-8/content limits. No test temp files left.
  • Full bun run check:tmp after rebasing: 1,886 pass / 161 skip / 0 fail across 334 files (945.25 seconds), using a private disk-backed TMPDIR under /var/tmp; no test temp files left.
  • Real-browser checks in light/dark at desktop, narrow and phone widths: short/long names, small/large/tall/wide images and SVG; text, JSON, a large log, Markdown headings/code/tables/links, binary renamed .txt; composer, queue and queue editor. Checked hover intent, pointer transfer, keyboard focus/Escape/modal focus return, wrapping, copy action, unchanged chip geometry and no horizontal overflow. Full log download was 370,000 bytes; the preview was bounded. Script content stayed inert.
  • No UI test suites or screenshots added. Touch input, native-device interaction and OS save/share sheets were not exercised; mobile typecheck and the JS-only fingerprint checks passed. Existing mobile SVG export behavior remains.

Native fingerprints

Ran in apps/mobile for each platform:
bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive

Before = after:

  • iOS: 2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3
  • Android: c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d

Both commands were rerun after rebasing; both hashes remain unchanged.

Rebase verification

Rebased onto dev through #393 and #399. Regenerated the combined protobuf descriptor to resolve the only conflict. Reviewed composer, queue Steer now, steered timeline attachments and mobile delivery: steering with files and previews are both retained. Updated the attachment documentation to describe text previews alongside steering. All static checks, focused tests, full tests and the web build passed after integrating #393. The final rebase added only #399's Windows workflow/documentation changes; application and test code are identical to the checked tree. #394–#396 were still open at the final pre-push check.

Copy audit — docs/copy.md §8

  • Name/size tooltip or immediate download → content preview with Open / Download actions: labels describe the attachment action.
  • No Markdown mode → Rendered / Source: short mode labels, remembered on this device.
  • Unbounded file display → “Showing up to 128 KB and 2,000 lines. Download for the full file.”: states the limit and next action.
  • No binary/error preview state → “No text preview. Download the file to open it.” and “Could not load the preview. Check the connection, then retry.”: explain the outcome and recovery; Retry, Wrap lines, Copy text, Zoom in/out and platform Save/Share use action labels.
  • Audited all new/changed strings for sentence case, active voice, glossary consistency, length, duplicate facts, loading/error guidance and accessible labels/state. No new glossary term or decorative sentence. Short/long names were checked at desktop and phone widths; information does not rely on color or position.

@nixuuu
nixuuu force-pushed the feat/attachment-previews branch from cc18be6 to 492cb30 Compare November 9, 2026 10:59
@nixuuu
nixuuu merged commit 729124d into dev Nov 9, 2026
10 checks passed
@nixuuu
nixuuu deleted the feat/attachment-previews branch November 9, 2026 12:44
nixuuu added a commit that referenced this pull request Nov 9, 2026
Mobile now answers thread secret requests and revokes saved grants. The
write-only sheet masks input, disables autofill and suggestions, clears
its native field and JS reference on send/close/background, and displays
only grant metadata and expiry.

Linked threads route the existing answer/revoke RPCs directly to their
home. Secret values stay excluded from relays and mirrors. No new RPC,
proto, native module, dependency or configuration change.

Validation:
- Paired-device secret integration: 2 passing tests, including owner
isolation, revoked devices, expiry metadata, decline, revoke, and
absence of values in responses/streams/tool results.
- Linked-thread integration passes, including routing qualified request
IDs home without putting values in mirrors.
- Full gate passes on the rebased top branch: install, gen:check,
typecheck, lint, format:check, check:tmp and web build. The full run
finished with 1,890 pass, 161 skip, zero failures and clean temp
cleanup. No UI tests or native builds.
- Production fingerprints before/after, EAS CLI 27.4.1: iOS
`2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3`; Android
`c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d`. Both unchanged.

Copy audit — docs/copy.md §8:
- Before: secret requests had no mobile action. After: “Provide secret”,
“Save securely”, “Decline”, “Revoke”, and an explicit 24-hour
explanation. Each action names its result; saved values have no display
control.
- Errors say what failed and how to retry, without transport details or
secret content. Existing glossary and sentence case retained; no
decorative copy or colour-only state.
- Static review covered short/typical/long labels and wrapping. The
device matrix below remains manual; native visuals were not verified in
this checkout.

Manual checks after a compatible OTA is available:
1. At 360/390 dp phone and 600/768 dp Fold widths, light/dark and
reduced motion, use 1/30/160-character labels. Check wrapping, compact
sheet scrolling, keyboard avoidance and fixed button alignment.
2. In a test gateway, save a non-sensitive test value, decline another
request, and revoke a saved grant. Confirm the field remains masked,
clears after sending, and saved values never appear; grant expiry is
readable.
3. Close/reopen the sheet, background the phone, and disconnect the
thread's home while typing. Confirm the field is cleared and unavailable
actions are disabled.
4. Repeat against a linked computer and a revoked paired device; the
automated owner-scoping tests cover rejection independently.

This is layer 1 of the independent normal-thread parity stack. The
latest rebase targets dev at `8fb894e4`, including #388–#390, #393, #398
and #399. Existing bases and ready-for-review states are preserved.
nixuuu added a commit that referenced this pull request Nov 9, 2026
Normal thread work is available from mobile: one shared action sheet
opens from the header or sidebar long press, queued messages can move or
steer immediately, and thread details expose usage, paths, grants,
schedules, worktrees and background tasks.

The action sheet respects confirmation preferences and uses the existing
lifecycle RPCs. Thread and queued-message deletion provide an 8-second
Undo; deleting an open thread or its parent navigates away and Undo can
reopen it. Queue ordering preserves platform turns and leaves the
default steer/queue preference unchanged.

Details show own-turn token/cost totals, label partial totals as “loaded
turns”, show the latest reported context window, and copy
directory/worktree paths with expo-clipboard. Schedule links filter the
existing editor to this thread. The worktree link opens the current
worktree without bulk cleanup controls. Paged snapshots retain
background task items outside the loaded turn window, so the list
survives reopening.

Validation:
- Gateway history integration: 7 passing tests, including background
task retention outside the tail page, reopening and page deduplication.
- Full gate passes on the rebased top branch: install, gen:check,
typecheck, lint, format:check, check:tmp and web build. The full run
finished with 1,890 pass, 161 skip, zero failures and clean temp
cleanup. No UI tests or native builds.
- Production fingerprints before/after, EAS CLI 27.4.1: iOS
`2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3`; Android
`c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d`. Both unchanged; no
dependencies or native configuration changed.

Copy audit — docs/copy.md §8:
- Before: queue edit/delete and “Steer now”. After: “Move up”, “Move
down”, “Move to top”, “Move to bottom” and “Undo” name the added
actions. Existing “Steer now” and “Move to a computer” wording is
preserved.
- “Delete thread?” repeats its verb in “Delete thread”; its description
explains side threads, stopped work, cancelled schedules and Undo.
“Usage · loaded turns” avoids claiming complete totals.
- Empty states and errors are short, actionable and use existing terms.
Long text wraps or truncates with full paths selectable; state also has
words. Static copy review completed; the visual matrix remains manual.

Manual checks after a compatible OTA is available:
1. Check 360/390 dp phone and 600/768 dp Fold widths, light/dark,
reduced motion, 1/30/160-character titles and 240-character paths. Check
overlays, scrolling, clipping and reserved control space.
2. Open actions from both entry points. Pin/unpin, regenerate, rename,
read/unread, archive/unarchive and delete; vary all three confirmation
preferences. Delete an open child through its parent and Undo. Confirm
the active goal has no duplicate menu control. Open “Move to a computer”
for a local thread and verify the existing preview/placement flow.
3. Queue four own messages with an intervening platform message. Move
each direction and to both ends; steer text and a message with files
during a running turn. Delete/Undo and edit a queued message, then
verify the delivery default still matches Settings. Send files with both
delivery choices and check the delivery note from a home that cannot
steer attachments. Open the landed image/text attachment previews.
4. Copy both paths and open schedules/current worktree. Check thread
scoping, add/edit/pause/resume/cancel a schedule, and verify worktree
status/removal still requires the existing safety confirmation.
5. Start background work, finish its foreground turn and reopen a long
thread. Stop the task from details and use “Show full output”; the
shared full-screen viewer reads inline or blob output and offers
Copy/Quote. Close it to return to details. Compare usage before/after
loading earlier turns.

The final rebase includes #377–#378 and #385. Background tasks now reuse
the landed TextViewer; there is no timeline-link fallback or separate
output viewer. Existing quote and send behavior is preserved.

Layer 2 of 3. Rebased onto dev at `8fb894e4`: preserves #393 attachment
steering, #398 previews and #388–#390 bot/settings parity, including the
local thread move action. Existing bases and ready-for-review states are
preserved.
nixuuu added a commit that referenced this pull request Nov 9, 2026
The phone update row now checks, downloads and explicitly applies
compatible OTA updates through the installed expo-updates APIs. Settings
and the update center share state, progress, errors and next-launch
deferral; the sidebar update indicator includes this phone.

Apply checks every mounted composer synchronously, including composers
under Settings, uploads, quote-only drafts, queued-message edits and
secret entry. Unsent work defers the update and explains how to proceed.
No automatic reload is introduced. “Apply next launch” keeps the current
session running.

Release notes use the same public GitHub release bodies as the desktop
changelog. The selected OTA manifest supplies the exact JS version;
missing metadata or rollback never substitutes a newer channel release.
Notes include retry and a GitHub link. No dependencies, native modules
or configuration changes.

Validation:
- Full gate passes on the rebased top branch: install, gen:check,
typecheck, lint, format:check, check:tmp and web build. The full run
finished with 1,890 pass, 161 skip, zero failures and clean temp
cleanup. No UI tests, native builds, EAS builds or APKs.
- Production fingerprints before/after, EAS CLI 27.4.1: iOS
`2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3`; Android
`c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d`. Both unchanged.
- Final stack fetched/rebased onto origin/dev at `8fb894e4`, including
#388–#390, #393, #398 and #399, before the full gate. Runtime behavior
and visuals require the manual checks below because installed simulator
clients cannot run this checkout.

Copy audit — docs/copy.md §8:
- Before: “Updates apply after you close and reopen Canopy.” After:
distinct “Check this phone for updates”, “Download update”, “Apply
update” and “Apply next launch” actions; the row distinguishes Not
checked / Available / Downloading / Ready / Next launch.
- Deferral explains the unsent draft/files and the next action. Errors
explain failure and retry; release notes identify the actual target and
handle unavailable notes explicitly. No new glossary term, decorative
copy or colour-only state.
- Static review covered short/long channel and version strings and
multiline messages. Native short/typical/long text and theme/width
checks remain manual.

Manual checks on a compatible production-runtime test client:
1. At 360/390 dp phone and 600/768 dp Fold widths, light/dark and
reduced motion, open both About and Updates. Check wrapping with long
versions, progress, fixed action columns and compact overlay scrolling.
2. Check with no update, offline, and with a compatible update.
Download, inspect the exact version's GitHub notes, defer, and confirm
the current session keeps running. Retry notes while offline and after
reconnecting.
3. With unsent text, a quote-only draft, a picked/uploading file, and a
draft in a composer underneath Settings, press Apply. It must defer
without reloading or losing work. Include a bot composer and a
queued-message edit where reachable.
4. Send or discard the unsent work, then Apply. Confirm one restart and
the expected JS version. Repeat by choosing next launch and fully
closing/reopening the app.
5. Check development builds show no OTA action; for rollback/missing
version metadata, confirm notes say unavailable and offer GitHub rather
than presenting an unrelated release.

Layer 3 of 3. Rebased onto dev at `8fb894e4`, including #388–#390, #393,
#398 and #399. Quote editing guards and quote-only OTA blockers coexist.
Existing bases and ready-for-review states are preserved; no OTA was
published manually.
nixuuu added a commit that referenced this pull request Nov 9, 2026
Linked-thread attachment metadata can remain readable while its home is
unavailable. The previews added in #398 passed the attachment URL
straight to an image element, which hid the BFF's 409 reason behind a
broken thumbnail. Image and text previews now show the public failure
message, offer Retry, and reload when the home reconnects.

Fixes: #398

### Diagnosis and behavior

- The two-gateway reproduction returns RPC `Unavailable` (14), marked
with `canopy-error-scope: computer`; the BFF maps that to HTTP 409. Both
hover and modal now show `Available when <computer> is connected.`. The
BFF logs the RPC code, read variant and sanitised public message,
without attachment IDs, payloads, credentials or transport causes. Error
responses are JSON with `Cache-Control: no-store`.
- IDs received in the thread snapshot and inline mentions are correctly
qualified. A plain UUID stays local and returns 404; it is never
searched on other computers. The home still enforces ownership,
including fallback reads.
- A home predating #398 ignores the additive `preview` field and returns
full bytes. The receiving gateway caps text preview responses at 128 KiB
and sets `truncated`; full downloads retain their bytes. A stale
thumbnail flag falls back only for the exact missing-thumbnail error,
using the same home and owner check.
- Mobile uses the same gateway path. Its image/file viewers preserve
public RPC failure reasons and retry after home/transport reconnection.
Changes are JS/TS only; no dependency, native configuration, schema or
protocol change.
- Version skew by itself did not reproduce an online 409. The fixture
simulates the older capability set and the old full-byte read behavior;
it does not run an archived binary. The new route log identifies other
refusal reasons if the reported Macs fail while connected.

### Validation

`bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`,
`bun run format:check` and the web production build passed. The
full-suite gate is GitHub CI on isolated runners, as agreed for this
parallel work session.

The first full run hit default 5-second timeouts in unchanged
plugin/worktree tests, followed by errors from the timed-out
asynchronous tests (1904 pass, 161 skip, 10 fail, 4 errors; temp cleanup
passed). The second full run used a 15-second default timeout but still
hit existing internal deadlines in shell interruption and environment
synchronization while eight test runners shared the machine (1912 pass,
161 skip, 2 fail; temp cleanup passed). No tests or assertions are
removed, and no code in those unrelated areas is changed.

`composer-shell.test.ts` also hit the same 10-second Stop/steer deadline
in isolated runs here, including on untouched `origin/dev` (`4dfb2f85`).
The requester independently ran that same base in an unloaded checkout
and reported **17 passed, 0 failed**. This is load-sensitive timing, not
a deterministic base failure. Opening this PR with that local exception
is explicitly agreed; isolated GitHub CI is the full-suite gate.

The final focused two-gateway attachment test passed alone: 1 test, 114
assertions, no temp leftovers. It also passed in both full runs.

Each affected file is also run alone:

| File in `tests/integration/` | Isolated result |
| --- | --- |
| `agent-plugins.test.ts` | 11 passed, default timeout |
| `worktree-automation.test.ts` | 6 passed, 15-second default timeout |
| `worktree-lifecycle.test.ts` | 18 passed, 15-second default timeout |
| `worktree-merged.test.ts` | 3 passed, 15-second default timeout |
| `worktrees.test.ts` | 15 passed, 15-second default timeout |
| `composer-shell.test.ts` | Loaded isolated runs here: 16 passed, 1
timed out, also on untouched base. Requester's unloaded run of the same
base: 17 passed, 0 failed |
| `config-sync-environment.test.ts` | 8 passed, 15-second default
timeout |

Real-browser checks used two isolated linked gateways and a BFF on
private ports, with the home ignoring `preview`. Checked light/dark,
desktop/390 px phone widths, short/typical/long filenames, hover and
modal loads, offline error messages, no broken image or horizontal
overflow, and automatic recovery in the still-open hover/modal after
reconnection. No UI test suites were added. Native mobile interaction
was not exercised.

Production fingerprints, EAS CLI 27.4.1, before = after:

- iOS: `2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3`
- Android: `c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d`

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

- Broken image or generic failure → the BFF's public reason and `Retry`:
names the actual dependency and gives one recovery action.
- No loading feedback → `Loading image…`: an accessible status while
bytes load.
- Decoder failure → `Could not show the image. Download it to open it.`:
plain language and a next action; Retry remains available.
- Checked sentence case, active voice, glossary, action verbs and
accessible status/alert text. No new glossary term, decorative sentence
or meaning conveyed only by colour.
- Checked short, typical and long names at desktop and phone widths in
light/dark. Long computer names wrap within the compact error panel.
nixuuu added a commit that referenced this pull request Nov 9, 2026
Bot composer text was held by the mounted component, so leaving Bots
could discard the message. Bot drafts now live in the owner's gateway
database and restore on web, desktop and mobile. Bot chats also accept
images and deliver them to the official worker harness.

- Persist text, structured mentions, quotes/comments and uploaded image
metadata with revision checks. Keep pending uploads through navigation,
preserve failed sends and their request IDs, and clear only the
acknowledged draft revision.
- Reuse attachment uploads, configured file/count/message limits,
thumbnails and viewers. Web/desktop support paste, drop and Attach
images; mobile uses the existing paste/photos/files intake. This scope
supports PNG, JPEG, GIF and WebP only; other file types can follow.
- Deliver verified, normalized images as native Claude SDK, Codex
app-server and Grok ACP image parts. Bots gain no filesystem tools.
Resumed sessions receive current images; rebuilt sessions also receive
bounded historical images, with a note for omissions. Preserve #429's
Canopy MCP approval override on Codex start/resume, Grok MCP allow rule,
actionable failures and shared approval labels; gateway authorization
remains authoritative.
- Add `bot_images_v1` and `remote_bot_composer_v1` capability gates.
Linked draft/upload/send operations remain owner-scoped. Moving a bot
preserves its draft, images and thumbnails; an older destination is
refused before cut-over.
- Add migration `0102_bot_composer` (latest dev migration was 0101 when
opening this PR), additive RPC/fields and generated contracts. Polish
docs cover persistence, native delivery, schema and mobile behavior.

Validation: `bun install --frozen-lockfile`, `bun run typecheck`, `bun
run lint`, `bun run format:check`, `bun run gen:check` and `bun run
--filter @canopy/web build` passed.

Focused tests rerun on dev ecb20e4 (#429): 52 passed across
bot-composer, bots-harness-context, bots-harness-approvals, worker
isolation/Grok transcript and DB schema (282 assertions). The official
Codex MCP approval regression also passed (4 assertions). The bot
computer-move case was previously verified during implementation (20
assertions). Coverage includes restart durability, structured draft CAS
and lost acknowledgements, send idempotency, owner scoping,
MIME/size/count limits, active-turn blob authorization, all three native
image adapters, resume/rebuild and historical image limits. The move
case also exercises draft/upload/send through a linked computer.

Manual browser check used an isolated gateway with the fake Codex
harness: Threads/Bots navigation, full reload, picker, clipboard/drop
events, dropping on an existing chip, uploaded draft restoration,
send/clear, message thumbnails and viewer. The harness recorded five
native image parts across two sends. Checked light/dark at desktop and
phone widths, including long filenames; no console errors. No UI tests
were added. Native device UI and live provider accounts were not
exercised.

Mobile changes are JS/TS only. Both `bunx [email protected]
fingerprint:generate --platform <ios|android> --build-profile production
--json --non-interactive` results match current dev (ecb20e4, including
#427/#428/#429):
- iOS: `6ddec9ef559ee0095ac33e94ff9418a942053b17`
- Android: `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`

Full `check:tmp` was intentionally left to CI as requested for the
shared machine. An upload still in progress when the application closes
must be added again; completed uploads are durable.

Copy audit (§8): “Attachments are coming soon” → “Attach images” for the
implemented action; new “Drop images to attach” describes the supported
intake; “Load saved draft” names the recovery result. Conflict copy
tells the user to copy edits before loading the saved version;
upload/send errors explain recovery. Labels use English sentence case
and action verbs, existing attachment terms and limits are reused, and
controls have text/accessibility labels independent of icons or colour.
No new empty states or decorative sentences. Short, typical and long
filenames were checked at desktop and phone widths.

Related: #398, #421
nixuuu added a commit that referenced this pull request Nov 10, 2026
Bot conversations now accept the same files as threads. A bot can read
text and PDFs without filesystem tools, then pass selected conversation
attachment references to `start_thread` or `send_message`. The gateway
copies references to the existing blobs and uses the normal thread
delivery pipeline.

Forwarding validates the owner, current bot conversation, duplicates and
current limits before approval and again during execution. It shares the
action's existing approval; the card lists filenames, types and sizes.
File copies, thread input, bot attribution, durable confirmation and
tool result commit together. The read-only `list_attachments` tool
exposes only sent files in that conversation.

| File type | Claude | Codex | Grok |
|---|---|---|---|
| Images | Native image parts | Native image parts | Native image parts;
CLI image capability required |
| UTF-8 text, Markdown, code, JSON, CSV | Bounded turn text | Bounded
turn text | Bounded turn text |
| PDF | Native document blocks | Extracted text | Extracted text |
| Archives and other binary files | Metadata and forwardable references
| Metadata and forwardable references | Metadata and forwardable
references |

Text is capped at 64,000 characters per file and 128,000 per turn, with
truncation notes. PDF extraction reads at most 50 pages, without OCR;
unreadable or image-only PDFs retain their original forwardable
references. Nonimage bot input requires worker capability
`bot_files_v1`; images retain `bot_images_v1`. No wire fields or
migrations were added.

Web/desktop retain the common picker, paste, drop, chips and previews.
Mobile changes are TypeScript only, including ordinary attachment
previews under bot-attributed thread input. The bot conversation records
“Sent report.md to ‘Thread’”. Forwarding to another linked computer is
explicitly refused before approval; users can choose a thread on the
bot's computer.

Validation:

1. `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run
lint`, `bun run format:check` and the web build pass.
2. Focused tests pass: `bot-files.test.ts` (9), `bot-composer.test.ts`
(7), `bots-remote.test.ts` (7), and the four affected harness
adapter/stop files (10). Coverage includes real gateway/worker transport
with fake provider CLIs, native versus extracted input, shared blobs and
worker paths, ownership/conversation refusal, approval denial and
execution-time revalidation, old-worker refusal and linked-target
refusal. Multi-gateway files ran separately.
3. Real-browser check on isolated fixture services: attach MD/PDF/PNG,
inspect Markdown/image previews and PDF file controls, fake-harness
forwarding, durable bot confirmation, normal thread attachment preview
and bot attribution. Checked light/dark at desktop and phone widths,
including a long filename. No UI test suite was added.
4. Requested EAS CLI 27.4.1 production fingerprints equal current `dev`:
iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`.

Copy audit (§8): “Attach images” → “Attach files” and “Drop images to
attach” → “Drop files to attach”, matching the accepted input. New
forwarding confirmation names the file and destination; refusal and
limit errors state the problem and next action. Existing file
vocabulary, verb-led controls and accessible labels are reused; no new
empty state or decorative copy. Short, typical and long filenames were
checked on desktop and phone. Long file chips and previews truncate or
wrap within the viewport.

Remaining gate: CI runs the full suite, including `check:tmp`; it was
intentionally not run locally. Live provider inference and native mobile
device interaction were not exercised.

Related: #449, #398, #421, #429
nixuuu added a commit that referenced this pull request Nov 10, 2026
Hovering an attachment in the bot composer could briefly flash a preview
and close it while the pointer stayed on the chip. Keep the selected
attachment and anchor stable when pointerover reaches the same chip
again.

Bot and thread composers already use the same `EditorAttachmentPreview`
and `AttachmentPreview`. When loaded content increases the card's
height, the card can briefly cross the pointer before repositioning.
Returning to the chip recreated `selected`, reran the anchor effect and
closed the preview during cleanup. Pointer movement between the chip's
icon and text had the same failure path. The shared component now
updates selection only for a different chip or attachment key. Existing
300 ms open / 180 ms close delays, keyboard focus, Escape, viewers and
motion tokens are preserved.

Validation:

1. `bun install --frozen-lockfile`, `bun run typecheck`, `bun run lint`,
`bun run format`, `bun run format:check`, and `bun run --filter
@canopy/web build` passed. No UI tests were added or run.
2. Real Chromium browser with an isolated gateway, database and scripted
model: Markdown, PDF metadata and PNG previews in the bot composer, sent
messages and actual bot-forwarded thread messages, light/dark at desktop
width. Verified pointer transfer to the card, keyboard focus and Escape.
Phone-width clicks open the Markdown viewer, PDF metadata actions and
image lightbox in both themes. Long filenames remain within the
viewport. The thread composer also retains its preview while moving
repeatedly between the chip's icon and text; leaving closes it at the
existing delay.
3. Hover evidence includes eight sampled screenshot frames per theme and
100 ms visibility samples showing the card remaining open for at least
two seconds. Evidence is outside the repository under
`/var/tmp/canopy-bot-attachment-hover/`.
4. Requested EAS CLI 27.4.1 production fingerprints are byte-identical
before/after: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Native mobile already shares
`AttachmentChips` between bots and threads. No native or mobile source
changes.

Native device interaction remains unverified: device support twice
returned “Could not communicate with device support. Try refreshing
devices.” Phone-width browser interaction was checked. Full
integration/temporary-directory checks and generated-contract checks
were left to CI; this change only touches the shared web editor preview.
Copy audit: no UI copy changed.

The faulty selection assignment was introduced by the attachment-preview
implementation in #398; verified in its original diff. Bot attachment
PRs reused that component.

Fixes: #398
Related: #449, #469
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
nixuuu added a commit that referenced this pull request Nov 24, 2026
Measure the full preview before choosing a side, then scale the thumbnail to the available height.

Fixes: #398
nixuuu added a commit that referenced this pull request Nov 24, 2026
## What changed

- Choose the side of the attachment using the preview's full height,
including after scrolling or reopening.
- Scale the entire thumbnail to the available height without cropping or
scrolling. Truncate long filenames in the hover preview and show the
full name in the image viewer.
- Keep the load error and Retry reachable when vertical space is tight.

Fixes: #398

## Verification

- Chromium with the production attachment chip and a local image
response. Checked both sides of the anchor, repositioning during scroll,
a 340 × 220 viewport, a long filename, keyboard activation, the image
viewer, load failure and Retry, and a text attachment.
- Web typecheck, lint and formatting of changed source files, and `git
diff --check` passed.
- UI copy is unchanged. The full required checks run in GitHub CI.
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