You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(mobile): attach photos to posts in a group room - #47361
A group room on the phone now opens as a web page, the way a chat does. That lets the room's + button pick photos, shrink them, and send them with the post.
Files
Added
Deleted
Net
Test
0
0
0
0
Prod
15
$\color{#1a7f37}{\Huge{\mathbf{+}}}$456
$\color{#cf222e}{\Huge{\mathbf{−}}}$296
$\color{#1a7f37}{\Huge{\mathbf{+}}}$160
What Changed
Before: the phone drew the group room as its own native screen. The composer had no + for photos. The photo shrink only runs inside the phone's web pages, so a native + would have failed every time with "Attach failed".
After: the room is a page route, as a chat is. The threads and tabs, the combined Items list, Manage members, the offline bar, other computers' answers and the "use " notice for mixed groups all look the same. The composer's + opens the photo library. Each photo is shrunk on the page and uploaded to the host under the group's first member's session, the same as the desktop's group composer. Each photo gets an [Image #N] in the text, and bots.groups.send carries its path, so the photo arrives with the post.
How it works:
Route.app/h/[hostId]/group/[groupId].tsx now mounts the page shell for /h/<host>/group/<group>. A .web sibling renders the room. mobile-web-page-routes.mjs declares the route: Back and item hops, Copy, and the three photo verbs, as a chat's.
Photos. The item comment's photo hook is now use-bot-draft-images.ts, shared by item comments and the room. It keeps its photos in chat's draft store. Uploads are gated on bots.group-attachments.v1, so an older host only takes text. A send takes its photos out of the draft at once, and a refused send puts them back after anything picked since.
Moving the room onto a page meant fixing what the page does differently:
Delete group.Alert.alert does nothing on a page, so the delete confirm is now a drawer. Home's group menu had the same silent bug (Delete group… did nothing), and it now uses the drawer too.
Keyboard. The page draws under the keyboard, so the room lifts its composer by the keyboard height the shell reports, as the chat dock does (useMobileSessionKeyboardLift).
Scrolling. The page's ScrollView reports no drags. A scroll right after a touch now counts as the reader's, so new replies no longer pull a reader back to the bottom.
Drafts. Each room is its own page, and its memory is gone after Back. Unsent text and photos are now saved like a chat tab's draft: one row per group, rooms as tabs, so a draft is still there when you come back.
Why
The photo shrink needs the page's canvas, so photos only work on a page. Moving the room keeps one copy of its code. The alternatives were sending photos without shrinking them (large phone photos fail the host's limits) or leaving photos out. Kelvin picked this option on 2026-11-23.
Pattern followed: the chat route's shell-mount and .web split (mobile/app/h/[hostId]/automations.tsx:10 and accounts.web.tsx:4); item comment photos (MobileBotItemCommentBox.tsx:185); the chat dock's keyboard lift (use-mobile-session-keyboard-lift.ts:8); a drawer instead of an alert (ConfirmModal, as MobileBotSettingsTab.tsx:180 does).
Linked Issue
None. This comes from the phone parity work (group posts with photos).
Visual Proof
Page harness: the real page bundle in Chromium, with a shell double for the phone, 393×852 at 2x. "Before" is main's room code on the same harness. On main the room is a native screen made of the same components.
Composer: + for photos (before / after)
Photo attached, then sent: the photo arrives with the post
Keyboard open (300 pt keyboard drawn in grey; before / after)
Home › group long-press › Delete group… (before: the menu closes and nothing happens; after: the confirm drawer)
In the room: Delete group…, and a draft with a photo still there after the page reloads
Testing
Page harness (real bundle in Chromium, shell double with this route's grants), dark and light:
The room, its menu, New thread, Items, Manage members, and a mixed group with other computers' answers all render.
picks a photo, uploads it to agentSessionAttachment.* under member session m-0, and bots.groups.send carries images: [path].
Delete in the room and from Home sends bots.groups.delete.
A draft with a photo comes back after a page reload (device store double).
Touch-scrolling up and then posting keeps the scroll position (scrollTop 341 → 341). Main's room code snaps to the bottom (340 → 1080).
build-mobile-web-app-bundle and verify-mobile-web-app-bundle pass: 11,366,495 of 11,436,032 eager bytes, 92 chunks.
pnpm check:changed passes, and so do mobile typecheck and oxlint.
Not run on a device: this Mac has no iOS simulator runtime installed. The native route file follows automations.tsx and accounts.tsx exactly.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
No tests added. The behaviour lives in page rendering and the shell, and was checked in the page harness above.
Performance
None measurable. The room's code was already in the page bundle, since every route file is bundled. The page grows by about 7.6 KiB of eager code. Draft saves reuse chat's debounced row writes, one row per group.
Risk
Level: Medium
Older desktops. A phone with this build opens a group on an older desktop, whose page bundle doesn't list this route. It sees the "update Orca on your computer" screen instead of the old native room. Every page route behaves this way (mobile-web-page-routes.mjs header; feat(mobile): draw the host Accounts screen from the desktop's page #30020 retired native fallbacks). Groups only shipped in v1.4.265, and desktops update quickly.
Older phones. Older phones keep their native room and see no change.
Back out with a plain revert. Saved group drafts stay in the device store as rows that nothing reads.
AI Disclosure
Review
Two review rounds (Codex and Claude). Fixed: drafts lost after Back, photo state around a send, one draft row per group, and reader scroll on the page. Not changed: the native fallback for older desktops. That is the page-route policy above, and the move was approved.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Mobile only. No host or RPC changes: the phone already had bots.groups.send with images and the attachment upload methods.
Cross-platform: the keyboard lift follows the chat dock on iOS and Android.
Remote/SSH: not affected.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
The group-room route now uses a mobile web shell and retains direct screen rendering on web. Group-room drafts are scoped by host, group, and room. The room and item-comment composers use shared image-draft handling, including upload, send, and refused-send behavior. Group deletion uses a confirmation component. Web transcript scrolling now reports distance from the tail and recent reader interaction.
Merge Risk: Low · up to ba7ac
Photo attachments in group rooms and item comments have a few edge cases: markers can point at the wrong photo after a refused send or a saved draft, and item comment images can mix across hosts when item IDs collide. These are small and fixable; address them before or soon after merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(mobile): attach photos to posts in a group room" matches the main change. The PR moves the mobile group room to a page route so the composer's + button can pick and shrink photos, and …
Description check
The description follows the repository template closely. It includes ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill upstream bounda…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "feat(mobile): attach photos to posts in a group room" matches the main change. The PR moves the mobile group room to a page route so the composer's + button can pick and shrink photos, and uploads them with the group post. The title is specific and concise, follows the conventional-commit style, and names the platform and feature.
Full details: Description check
Explanation
The description follows the repository template closely. It includes ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. It explains the before and after behavior, the mechanism, the alternatives considered, and the rollback path. The Linked Issue section says 'None' and gives a reason rather than an issue link, and the Level field under Risk is filled as Medium. The AI Disclosure section is empty, which the template permits for internal contributors. The template asks for a linked issue for outside contributors, so the missing issue link is the main gap.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Remap restored [Image #N] markers when photos were picked during the send.
A photo picked while a send is in flight can take [Image #1] in the composer. If that send is refused, the room appends the refused text after it, so the restored text keeps the old [Image #1] for photo A. returnRefused then places A after B, which gives the image order [B, A]. The restored text now has two [Image #1] markers, and [Image #1] resolves to B. A's caption refers to the wrong photo.
Restore the text and the images in the same final order. Each restored marker must match its image's position in the restored list. For this case, A's marker must become [Image #2]. When no photo was picked after A, keep [Image #1]. Apply the remap on the refusal path in MobileBotGroupRoom.tsx where the text is restored, and keep returnRefused in use-bot-draft-images.ts consistent with it.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Remap saved draft text to the photos that are saved.
saved() keeps the text's [Image #N] markers unchanged, but it saves only the photos that have a path and are not already in a send. A photo still uploading has a marker in the text but no saved image. After restore, the remaining markers point at the wrong photos, and a marker can point at a missing one. Remap the text from all current photo ids to the saved photo ids before it is stored.
Suggested fix
--- "a/mobile/src/session/native-chat/composer/drafts/mobile-native-chat-draft-store.ts"+++ "b/mobile/src/session/native-chat/composer/drafts/mobile-native-chat-draft-store.ts"@@ -260,14 +260,19 @@
const sending = new Set(
inFlight.flatMap((send) => [...send.images, ...send.files]).map((chip) => chip.path)
)
const inputs = readMobileNativeChatDraftInputs(scope)
- const text = userText(scope)+ const kept = inputs.images.filter(({ path }) => path && !sending.has(path))+ const text = queuedEditTextForKeptImages(+ userText(scope),+ inputs.images.map(({ id }) => id),+ kept.map(({ id }) => id)+ )
const draft: MobileNativeChatSavedDraft = {
text,
skills: text === '' ? [] : inputs.skills,
skillOrigin: text === '' ? undefined : drafts.get(scope)?.skillOrigin,
- // A photo still uploading (no path yet) is saved once it lands.- images: inputs.images.flatMap(({ path }) => (!path || sending.has(path) ? [] : [{ path }])),+ // A photo still uploading (no path yet) is saved once it lands; its marker is dropped now.+ images: kept.flatMap(({ path }) => (path ? [{ path }] : [])),
files: savedMobileNativeChatFiles(inputs.files).filter((file) => !sending.has(file.path)),
inFlight,
queued: savedMobileNativeChatOfflineSends(scope, inFlight)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Data Integrity & Integration · Quick win
Key image drafts by host as well as item UID.
The image draft key at line 196 uses only uid. The text draft at line 110 uses botItemCommentDraftKey(hostId, item.uid), because two hosts can hold items with the same ID. If two hosts have items with the same UID, an image attached on one host can appear in the other host's comment box. Sending then includes a path from the other host's session.
Use the same host-qualified key for the image draft:
Upstream's group room page (stablyai#47361) and item comment box pass the attach button's old
onAttachImage prop; renamed to onAttachImages. Tests upstream removed (stablyai#46786) stay removed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
A group room on the phone now opens as a web page, the way a chat does. That lets the room's + button pick photos, shrink them, and send them with the post.
What Changed
Before: the phone drew the group room as its own native screen. The composer had no + for photos. The photo shrink only runs inside the phone's web pages, so a native + would have failed every time with "Attach failed".
After: the room is a page route, as a chat is. The threads and tabs, the combined Items list, Manage members, the offline bar, other computers' answers and the "use " notice for mixed groups all look the same. The composer's + opens the photo library. Each photo is shrunk on the page and uploaded to the host under the group's first member's session, the same as the desktop's group composer. Each photo gets an
[Image #N]in the text, andbots.groups.sendcarries its path, so the photo arrives with the post.How it works:
app/h/[hostId]/group/[groupId].tsxnow mounts the page shell for/h/<host>/group/<group>. A.websibling renders the room.mobile-web-page-routes.mjsdeclares the route: Back and item hops, Copy, and the three photo verbs, as a chat's.use-bot-draft-images.ts, shared by item comments and the room. It keeps its photos in chat's draft store. Uploads are gated onbots.group-attachments.v1, so an older host only takes text. A send takes its photos out of the draft at once, and a refused send puts them back after anything picked since.Moving the room onto a page meant fixing what the page does differently:
Alert.alertdoes nothing on a page, so the delete confirm is now a drawer. Home's group menu had the same silent bug (Delete group… did nothing), and it now uses the drawer too.useMobileSessionKeyboardLift).Why
The photo shrink needs the page's canvas, so photos only work on a page. Moving the room keeps one copy of its code. The alternatives were sending photos without shrinking them (large phone photos fail the host's limits) or leaving photos out. Kelvin picked this option on 2026-11-23.
Pattern followed: the chat route's shell-mount and
.websplit (mobile/app/h/[hostId]/automations.tsx:10andaccounts.web.tsx:4); item comment photos (MobileBotItemCommentBox.tsx:185); the chat dock's keyboard lift (use-mobile-session-keyboard-lift.ts:8); a drawer instead of an alert (ConfirmModal, asMobileBotSettingsTab.tsx:180does).Linked Issue
None. This comes from the phone parity work (group posts with photos).
Visual Proof
Page harness: the real page bundle in Chromium, with a shell double for the phone, 393×852 at 2x. "Before" is main's room code on the same harness. On main the room is a native screen made of the same components.
Composer: + for photos (before / after)
Photo attached, then sent: the photo arrives with the post
Keyboard open (300 pt keyboard drawn in grey; before / after)
Home › group long-press › Delete group… (before: the menu closes and nothing happens; after: the confirm drawer)
In the room: Delete group…, and a draft with a photo still there after the page reloads
Testing
Page harness (real bundle in Chromium, shell double with this route's grants), dark and light:
agentSessionAttachment.*under member sessionm-0, andbots.groups.sendcarriesimages: [path].bots.groups.delete.build-mobile-web-app-bundleandverify-mobile-web-app-bundlepass: 11,366,495 of 11,436,032 eager bytes, 92 chunks.pnpm check:changedpasses, and so do mobile typecheck and oxlint.Not run on a device: this Mac has no iOS simulator runtime installed. The native route file follows
automations.tsxandaccounts.tsxexactly.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
No tests added. The behaviour lives in page rendering and the shell, and was checked in the page harness above.
Performance
None measurable. The room's code was already in the page bundle, since every route file is bundled. The page grows by about 7.6 KiB of eager code. Draft saves reuse chat's debounced row writes, one row per group.
Risk
Level: Medium
mobile-web-page-routes.mjsheader; feat(mobile): draw the host Accounts screen from the desktop's page #30020 retired native fallbacks). Groups only shipped in v1.4.265, and desktops update quickly.AI Disclosure
Review
Two review rounds (Codex and Claude). Fixed: drafts lost after Back, photo state around a send, one draft row per group, and reader scroll on the page. Not changed: the native fallback for older desktops. That is the page-route policy above, and the move was approved.
Agent skill upstream boundary
Notes
bots.groups.sendwithimagesand the attachment upload methods.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)