Repository navigation
fix(omp): attach desktop and mobile images through file mentions - #21674
Conversation
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe change adds shared agent-aware image path formatting and paste-write handling. Desktop native chat and mobile session flows now pass the selected agent through image attachment and terminal-send paths. OMP uses portable Priority: ➖ Normal 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation Issue Resolution Remove the agent-specific formatting and related tests and golden updates from the mobile terminal-drop and clipboard-accessory paths. Keep this pull request limited to the scoped desktop composer send path and mobile Native Chat send path, or move the excluded mobile surface changes to a follow-up. Full details: Docstring CoverageExplanation Docstring coverage is 16.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 27 files. (1 skipped: 1 unsupported.) Comment |
|
CI static analysis failed on two pre-existing base files, unrelated to this PR:
The same full-repo lint gate is outside this PR's changed files; local changed-code quality remains 0 findings across 27 files. I am leaving the PR unmerged until the repository gate is either repaired or an authoritative baseline waiver is applied. |
There was a problem hiding this comment.
Important
The mobile agent derivation can fall through to a null/'unknown' agent, turning terminal image paste into a file mention where the previous behavior was a native attachment. One inline comment.
Reviewed changes
- Shared image-paste module. New
src/shared/agent-image-paste.tscentralizesgetAgentImageHandling,formatAgentImagePath,agentImagePasteWrites, and the movedformatNativeChatFileReference; desktop native chat and mobile terminal/native-chat paste now route through it. - OMP file mentions.
omppaths with whitespace/@and both quote kinds become@"file://…"mentions; otherwise attachment agents get the raw path and unsupported agents get@path/@"path"/@'path', with a separator after each mention. - Composer gate removed.
useNativeChatComposerPasteno longer rejects image paste for unsupported agents; every clipboard image becomes a chip and is formatted at send time. - Path and catalog plumbing.
filesystemPathToFileUrino longer rewrites\in POSIX absolute paths; the runtime-required English catalog gains the now-unreferencedimageUnsupportedkey; route-parity hashes refresh. - Tests. New shared, mobile-terminal-paste, and e2e OMP specs, plus signature updates across the desktop/mobile suites.
ℹ️ Nitpicks
UseNativeChatComposerPasteArgs.agentis still a required prop but the hook no longer reads it (the destructuring dropped it), whileNativeChatComposer.tsxand the probe test still pass it. Drop it from the type and callers, or document why it is retained.components.native-chat.composer.imageUnsupportednow has no code reference. Because the catalog generator keeps unreferenced keys, this PR ships the orphaned string inen-runtime-required.json(boot bundle). Remove the key from the locale catalogs instead.native-chat-image-paste.tsre-exportsgetAgentImageHandlingandAgentImageHandling, but no production code consumes either — only the test importsgetAgentImageHandling.formatAgentImagePath's OMP branch only file-URL-encodes paths that also match/[\s@]/, so an absolute path containing both quote kinds but no whitespace or@(e.g./tmp/a"b'c.png) falls through to a bare@paththat still contains quotes.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const agent = | ||
| activeSessionTab && 'agentStatus' in activeSessionTab | ||
| ? (activeSessionTab.agentStatus?.agentType ?? nativeChatController.nativeChatAgent) | ||
| : nativeChatController.nativeChatAgent |
There was a problem hiding this comment.
For a terminal tab that is not in chat view, nativeChatController.nativeChatAgent is null (activeChatResolution requires tabWantsChat, which is false off-chat), and agentStatus.agentType can be absent or the 'unknown' sentinel. Both resolve to 'unsupported', so buildMobileImagePastePayload now emits @path instead of the raw bracketed path — a file mention where the previous behavior was a native attachment (and an unusable path in a plain shell). The existing resolveMobileTerminalTabOwnedAgentId already covers exactly these states.
Technical details
# Mobile terminal image paste resolves a null/unknown agent
## Affected sites
- `mobile/src/session/use-mobile-session-attachments.ts:42-45` — `agentStatus.agentType ?? nativeChatController.nativeChatAgent` has no `launchAgent`/`'unknown'` handling.
- `mobile/src/session/use-mobile-native-chat-active-resolution.ts:38-47` — `nativeChatAgent` is `null` whenever `tabWantsChat` is false (terminal view).
- `mobile/src/session/mobile-clipboard-image.ts:182-187` and `mobile/src/session/mobile-image-attachment.ts:56-59` — consume `agent` for the payload.
## Required outcome
- A terminal running an attachment agent must send the raw bracketed path even when `agentStatus.agentType` is absent or `'unknown'`; only genuinely non-attachment agents should get a file mention.
## Suggested approach
- Derive `agent` with the existing resolver, e.g. `resolveMobileTerminalTabOwnedAgentId(activeSessionTab) ?? nativeChatController.nativeChatAgent` (`mobile/src/session/mobile-terminal-tab-agent.ts:25`), which filters `'unknown'` and falls back to `launchAgent`.
- Add a focused test for the terminal-paste path with a null/`'unknown'` `agentStatus` so this stays pinned.There was a problem hiding this comment.
Important
The re-recorded goldens are still pinned to a baseline that predates this PR's product change, so the RPC recording pin check fails. Details in the section below.
Reviewed changes
Re-reviewed the re-record commit de4e392 on top of 1006ad6, the behavior change it refreshes.
- Refreshed image-paste recordings. The nine
nativeChat.image-pasteandclipboard.image-terminal-attachmentgoldens now record@path(for example\x1b[200~@/tmp/a.png\x1b[201~) instead of the raw bracketed path, with matchingpilot-scenarios.jsonexpectations andscenarioSha256values. - Bumped provenance on a subset.
lockfileSha256moves to the currentmobile/pnpm-lock.yamldigest on those nine files only; the other 778 goldens keep the previous digest.baselineis unchanged everywhere.
⚠️ Re-recorded goldens are pinned to a baseline that cannot produce them
The refreshed goldens and scenario expectations are still pinned to baseline: 889c2b56, the main commit this branch forked from, which does not contain the @-prefix behavior change. The RPC recording pin job replays the candidate corpus against that pin and fails with Request params mismatch: terminal.send#N on all nine image-paste goldens.
Technical details
# Repin `baseline` before re-recording
## Affected sites
- `mobile/rpc-foundation/pilot-scenarios.json:3` — `baseline` is still `889c2b562f15b9c98604b28267d8a0aaf1aa361a`; it must name the commit that carries the product change (`1006ad670aa347d0bcaecddb6c41b8caa245b358`, or the branch tip after merging main).
- `mobile/rpc-foundation/goldens/*.json` — every golden's `baseline` header. The repin rewrites all 787, so the re-record must cover the whole corpus, not the nine image-paste files.
## Evidence
- `RPC recording pin` (Mobile Checks) failed at `de4e392e`: ancestry passes (`Recording pin 889c2b56… is an ancestor of HEAD`), then `reproduce --if-changed-since b0ec11f5b0` throws `Request params mismatch: terminal.send#1/#2` for `clipboard-image-attachment-anonymous`, `clipboard-image-attachment-pasted`, `native-chat-image-paste-single`, `-two-images`, `-stops-on-rejection`, `-trailing-image`, and both `matrix-nativechat.image-paste-terminal.send-*` goldens.
- Only nine goldens carry the new lockfile digest (`afafc16f…`); the other 778 still carry `45686333…`, confirming a subset refresh rather than a corpus re-record.
## Required outcome
- The pinned tree's `mobile/src`, `src/shared` and `mobile/pnpm-lock.yaml` must be the tree that produces the committed goldens, so `reproduce` replays clean.
- After the repin, re-record the whole corpus so no golden is pinned to a different tree.
## Suggested approach
- Set `baseline` in `pilot-scenarios.json` to `1006ad67`, then run `ORCA_BACKGROUND_LAUNCH=1 RPC_FOUNDATION_RECORD=1 pnpm --dir mobile exec tsx scripts/rpc-recording.mts --record`. The nine image-paste goldens keep their bodies; every other golden moves only its `baseline` header (and lockfile digest). See "Recording a behaviour change" in `mobile/src/test-support/rpc-recording/README.md`.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Hosted verification update: the main workflow is green (including all 8 test shards, package/package-windows, static analysis, typecheck, E2E, and verify). The separate RPC recording pin gate failed with 8 request-parameter mismatches in the image-paste family/pilot recordings because the refreshed goldens were generated from the changed source while the scenario baseline still pointed at the old pinned tree. I am correcting the provenance and will rerun the pin gate before merge. |
…21690) #21674 re-recorded the corpus with `baseline` set to its own branch commit `1006ad670a`, which the squash merge left unreachable from main. The pin guard on the push to main fails, and so does the pin job on every open pull request, since the merge ref cannot reach that commit either. Repin to main's tip `e8a7be4ce2` and re-record from that tree. Every golden's body is byte-identical to the one #21674 recorded; only the two header lines move: `baseline` (788 files) and `lockfileSha256` (778 files), the latter because #21652 changed `mobile/pnpm-lock.yaml` after that branch recorded. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ng pin The recording pin guard found the pull request that keeps a squash-dropped pin by walking main's first-parent history for the commit that wrote the pin into the manifest and reading "(#n)" off its subject. A merger who edits the squash title loses the number, and the push to main turns red anyway. That already happened on main: of the 22 squashes that left a pin outside main's history, #21674's title had no "(#n)". The guard now asks GitHub for the pull requests associated with the pinned commit (GET /repos/{owner}/{repo}/commits/{sha}/pulls) and, for each in turn, fetches refs/pull/<n>/head and accepts only when git proves the pin is an ancestor of that head. GitHub only nominates candidates, so a wrong answer can fail the guard but never pass it. The endpoint named the right pull request for all 22 historical cases, #21674 included, and names none for commits a force-push orphaned. This removes the pickaxe walk, its 600 s budget and its lazy blob fetches in a blobless clone, the first-parent subtlety, and the subject regex. A revert that restores an older pull-request-only pin now resolves too, because the lookup is by the pin itself rather than by the commit that last wrote it. CI passes the job token to both guard steps and grants the job pull-requests: read. Local runs work without a token on this public repo and send GITHUB_TOKEN or GH_TOKEN when set. A failed lookup throws with the HTTP status, and names the rate limit when an unauthenticated call is refused.
… pull request (#23720) * fix(ci): keep a squash-merged RPC recording pin reachable through its pull request Main's "RPC recording pin" check has been red since #22762: that branch pinned the recording corpus to its own commit 03995ae, and the squash-merge left that commit out of main's history. Every behaviour-change squash did the same, and each needed a hand-made repin PR to clear it (#23565, #23535, #23046 and more). The guard now accepts a pin that is either in this history or in the head of the pull request whose squash wrote it into the manifest. It finds that pull request from the `(#n)` subject of the commit that added the pin and fetches `refs/pull/<n>/head`, which GitHub keeps after the branch is deleted. The reproduce step uses the same lookup, so it can still check the pinned tree out. * fix(ci): give the recording pin lookup room to walk a blobless clone In CI's blobless clone, `git log -S` fetches the manifest's blobs one commit at a time, a few seconds each. Under the 30 s process default the walk was killed after a handful of manifest commits, which main's history already exceeds (up to 7 manifest commits between a pin landing and the next pin change), and the guard then failed with an empty "Could not find the commit that pinned" error. The lookup and the pull request fetch now carry explicit budgets and say when they timed out. The not-an-ancestor instruction now names the pull request whose head was checked, or says the commit that pinned it names none. Adds the two merge-preview shapes the guard runs on: a branch opened after a squash resolves main's pin through the squash's pull request, and a branch whose rebase dropped its own pinned commit fails on its pull request instead of on main. * fix(mobile): tell a missing recording pin apart from product drift After a squash the pinned commit can live only in its pull request's head, so a clone that never fetched it makes `git diff --quiet <baseline>` exit 128. The recorder reported that as "Product sources or lockfile differ from the pinned main baseline", which sends the developer to repin a tree that may match. It now prints git's error and the command that fetches the pin. * fix(ci): ask GitHub which pull request holds a squash-dropped recording pin The recording pin guard found the pull request that keeps a squash-dropped pin by walking main's first-parent history for the commit that wrote the pin into the manifest and reading "(#n)" off its subject. A merger who edits the squash title loses the number, and the push to main turns red anyway. That already happened on main: of the 22 squashes that left a pin outside main's history, #21674's title had no "(#n)". The guard now asks GitHub for the pull requests associated with the pinned commit (GET /repos/{owner}/{repo}/commits/{sha}/pulls) and, for each in turn, fetches refs/pull/<n>/head and accepts only when git proves the pin is an ancestor of that head. GitHub only nominates candidates, so a wrong answer can fail the guard but never pass it. The endpoint named the right pull request for all 22 historical cases, #21674 included, and names none for commits a force-push orphaned. This removes the pickaxe walk, its 600 s budget and its lazy blob fetches in a blobless clone, the first-parent subtlety, and the subject regex. A revert that restores an older pull-request-only pin now resolves too, because the lookup is by the pin itself rather than by the commit that last wrote it. CI passes the job token to both guard steps and grants the job pull-requests: read. Local runs work without a token on this public repo and send GITHUB_TOKEN or GH_TOKEN when set. A failed lookup throws with the HTTP status, and names the rate limit when an unauthenticated call is refused.

ELI5
When you paste an image into OMP chat, Orca now sends it as an image attachment that OMP understands. Ordinary text paste stays unchanged, and agents without native attachment support receive a safe file mention.
What changed
Proof
pnpm tc:node: passed.pnpm --dir mobile typecheck: passed.pnpm run check:code-quality:changed: 0 new findings across 27 changed files.git diff --check: passed.The repository-wide mobile test typecheck currently reports pre-existing errors across unrelated test files under the current TypeScript/React Native dependency set; the changed production/mobile typecheck passes, and focused runtime tests pass.
Readiness
Closes #20389.
Supersedes stale #21651, whose branch was based on an older main.