feat(web): searchable session picker on Android share target#986
feat(web): searchable session picker on Android share target#986heavygee wants to merge 3 commits into
Conversation
Add search to the Android share-target picker so operators can attach shared content to inactive or older sessions, not just recent actives. Reuses sidebar search helpers; caps default active list with a search hint. Co-authored-by: Cursor <cursoragent@cursor.com>
Peer-stack specs live on fork main under e2e/peer/ only.
Peer-stack Playwright config stays on fork main; product worktree is web/ only. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Peer-stack Playwright + operator dogfood on driver soup (:3006) — share sheet → |
There was a problem hiding this comment.
Findings
- [Major] Inactive share targets can drop the pending transfer — search mode now returns inactive sessions, but selecting one still arms
sessionStorageand navigates straight to/sessions/:id.ShareSeedConsumerconsumes and removes that transfer id on the inactive session mount, then waits forsessionActive; if the operator reopens/resumes into a new session id, the keyed chat remount has no pending transfer left, so the shared text/files are never attached. Evidence:web/src/lib/sharePickerSessions.ts:26, related consumer behavior inweb/src/components/SessionChat.tsx:205andweb/src/components/SessionChat.tsx:214.
Suggested fix:useEffect(() => { if (!props.sessionActive) return if (consumedRef.current) return const transferId = consumeSharePendingTransfer() if (!transferId) return consumedRef.current = true void seedShareTransfer(transferId) }, [props.sessionActive, props.sessionId, assistantApi])
Summary
- Review mode: initial
- The searchable picker is mostly localized, but the newly reachable inactive-session path can lose the Web Share Target payload before the target session is active.
Testing
- Not run (automation):
bunis not available on this runner (bun: command not found).
| const normalizedQuery = normalizeSearch(query) | ||
| const sorted = sortByUpdatedAtDesc(sessions) | ||
|
|
||
| if (normalizedQuery) { |
There was a problem hiding this comment.
[MAJOR] This branch now makes inactive sessions selectable from the share picker, but the downstream share seeding path only works after SessionChat is active. Today ShareSeedConsumer consumes and removes the pending transfer id on first mount, then returns while props.sessionActive is false; if the user reopens/resumes into a new session id, the keyed chat remount no longer has the transfer in sessionStorage, so the shared text/files are lost.
Suggested fix:
useEffect(() => {
if (!props.sessionActive) return
if (consumedRef.current) return
const transferId = consumeSharePendingTransfer()
if (!transferId) return
consumedRef.current = true
void seedShareTransfer(transferId)
}, [props.sessionActive, props.sessionId, assistantApi])
Summary
Adds a searchable session picker to the Android Web Share Target (
/share) flow.SessionListSearch,sessionMatchesQuery) so inactive sessions are findable by title, machine label, or pathsharePickerSessions.test.ts)Builds on merged share-target work (#933, #932).
Test plan
bun typecheckcd web && bun run test(includessharePickerSessions.test.ts)e2e/peer/980-share-target-session-search.spec.tson fork main):3006— share sheet →/share→ search inactive sessionIssues
Fixes #980