Repository navigation
feat(mobile): answer the Inbox's asks in place - #887
Conversation
Each open ask gets an answer box (#830, part 3 of 4), as on web: the words are delivered as typed, a retry with the same words reuses its request id, an item that closes while the person has typed into it stays with their words and who answered (AC16, AC17), unsent words are dropped when a server's person changes, and answering is off for a read-only connection or a server that is not read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 28 minutes for your next included review. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Answer state and submission apps/mobile/src/j5/inbox/inboxAnswers.ts, apps/mobile/src/j5/inbox/inboxSources.ts |
useInboxAnswers tracks scoped drafts and closed-item status, handles submission state and errors, and refreshes open and answered queries and the inbox count. |
Inbox answer interface apps/mobile/src/j5/inbox/InboxScreen.tsx |
InboxScreen renders asks from the answer state. Expanded items include an answer field and controls gated by source readiness, permission, delivery state, and draft content. The screen uses keyboard-aware scrolling. |
Estimated code review effort: 3 (Moderate) | ~25 minutes
Sequence Diagram(s)
sequenceDiagram
participant Person
participant InboxItem
participant InboxScreen
participant useInboxAnswers
participant InboxQueries
Person->>InboxItem: Enter and submit an answer
InboxItem->>InboxScreen: Invoke the answer handler
InboxScreen->>useInboxAnswers: Submit the item answer
useInboxAnswers->>InboxQueries: Refresh open and answered queries
useInboxAnswers->>InboxQueries: Refresh the inbox count
Possibly related issues
- Jacksondr5/j5code issue 830: This PR adds in-place answers for open asks in the mobile Inbox, which is part of the issue’s scope.
- Jacksondr5/j5code issue 40: This PR adds mobile Inbox answer handling and per-environment reads, which covers part of the broader mobile parity scope.
Possibly related PRs
- Jacksondr5/j5code#883: This PR extends the mobile Inbox route and source reads introduced by PR
#883with answer drafts, submission, retention, and refresh behavior. - Jacksondr5/j5code#713: The mobile Inbox uses the participant display-name read that this PR updates.
Merge Risk: 
Minimal · previous review 5acca
-
In-place answers can proceed through the reviewed paths without an identified merge-blocking issue.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The description is complete and matches the repository template. It explains the problem, implementation, UI states, live testing, upstream impact, checklist coverage, and known limitations. It includes screenshots and videos for the UI changes. The Docs checklist item remains unchecked because documentation is planned for a separate wave-2 PR, and the tracking issue references are present but are not written as explicit “Closes #...” links.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined review: reviewer-opus and reviewer-sol (Claude Opus 5.5 and GPT Sol 6.1), head f05be19
Both of us reviewed the PR independently. Neither found anything that blocks merge.
Checked and fine
- Page state.
useInboxAnswersis web's page state on the shared helpers:- unsent words are dropped for a server whose person changes;
- kept items are retained (
nextKeptItems,closedWith), andclosedOfusesansweredReadSinceClose; - the submit guard is
message.length === 0 || !item.sourceReady, so whitespace is sent verbatim, as on web.
- Retries. They use the shared
submitHumanInboxAnswer, so a retry with the same words reuses its request id. Keys are scoped by server, so the same exchange id on two servers stays separate. - Sending.
sendAnswerthrowsCause.squash, which the shared helper turns into the error message. The answer is accepted before the refresh:refreshAfterAnswerrereads both the open and answered lists, and its failure becomes the shared "Answer delivered, but…" error. The count refresh stands in for web'snotifyHumanInboxChanged. - Gating. The button is gated as on web, by
!canAnswer || anyDelivering || answerText.length === 0, wherecanAnswerissourceReadyplus the command'spermissionAtom. A kept item showsclosedLineinstead of the button.
Notes (not blocking)
- The withdrawn-ask label can lag. Web's
HumanInboxPage.tsx:519–548rereads the answered list when an open ask disappears; mobile has no equivalent. reviewer-sol ran the kept and closed sequence on the shared helpers to confirm what follows:- When it happens: an agent withdraws an ask the person had typed into, and the answered read (on the
inboxrevision) lands before the open read. - What the person sees: the kept row says "No longer open", not "The agent withdrew this", until the next focus or pull.
- What isn't affected: the row and the draft stay, and the button is replaced by the closed line, so no wrong action is possible. " answered" still shows correctly when someone else answers, and the person's own answer refreshes both lists itself.
- The fix: port web's effect, if wanted.
- When it happens: an agent withdraws an ask the person had typed into, and the answered read (on the
- Attempt pruning moved. It now runs in the answer handler, not in web's effect on
personScopes. Over a person change A→B→A with no submit in between, a stale attempt can survive and reuse its request id. That's rare and harmless. - Error placement. The error renders at the top of the scroll, as on web. On a phone the person is usually scrolled to the expanded item, so a failed send shows only the button coming back with the text still in the box. Showing the error beside the item would help; worth seeing in the tester's run.
The panel has no open code findings. Before merge it still needs the captures, the tester's run and green J5 CI.
…error by its ask An ask that leaves the open list rereads that server's answered list, as web's Inbox does, so a kept item says who answered or that the agent withdrew it without waiting for a pull. An answer's error now shows beside that ask's answer box, where the person is looking, rather than at the top of the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined review: reviewer-opus and reviewer-sol, head 17ed396
We checked the follow-up for our notes.
- (1) Taken. The withdrawn-ask label no longer lags.
useInboxAnswersports web's effect line for line: when an ask leaves a ready source's open list, it refreshes that server'sansweredInboxQueryAtom. There's no timer, and the effect states its reason on its budget line. - (3) Taken. The error is now
{ key, message }, shown byerrorFor(item)next to that ask's answer box. That's where a phone user is looking. A refresh failure after delivery leaves the old open list in place, so its error still shows by the ask. - (2) Left. A stale attempt id over a person change A→B→A is recorded on the PR as a known, harmless edge.
The panel has no open code findings. Before merge it still needs the captures, the tester's run and green J5 CI.
On iOS the keyboard covered a lower ask's answer box and Answer button. The Inbox list is now keyboard-controller's KeyboardAwareScrollView, which scrolls the focused answer, with its button, into view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined review: reviewer-opus and reviewer-sol, head 7e2d312
Both of us reviewed this push independently and checked the finding against the source. It blocks merge.
Blocking
-
The Inbox's scroll view is no longer registered with the native header on iOS (
InboxScreen.tsx:101). The rawKeyboardAwareScrollViewreplacesScreenScrollView, and with itNativeScrollView's iOSNativeScrollViewMarker. That marker is the only way a screen's scroll view reaches its header, as its doc and therequire-registered-list-scrollrule say.- Mechanism. react-native-screens'
registerDescendantScrollView(RNSStackScreenComponentView.mm:91–102) callssetContentScrollView(forEdge: All). That drives the navigation bar's scroll-edge appearance and its tap-to-scroll-to-top, and caches the scroll view for container effects. Without the marker, that path never runs. - What the person sees. The header's scroll-edge appearance doesn't follow the Inbox's scroll, and tapping the top doesn't scroll it back.
- Android. The content also loses
ScreenScrollView's 720-wide, centred layout. - Precedent. No other mobile screen uses
KeyboardAwareScrollView.
Fix: on iOS, wrap the aware scroll view in
<NativeScrollViewMarker style={{ flex: 1 }}>, asNativeScrollViewdoes, and keep the Android content width (width: "100%", maxWidth: 720, alignSelf: "center"). The root stack provides no surface or bottom-inset context here, and the explicitbg-sheetalready sets the colour, so those needn't be carried over. If wrapping doesn't work with the library, go back toScreenScrollViewand keep the answer box above the keyboard another way. Either way, the tester needs to check the header and the keyboard on iOS. - Mechanism. react-native-screens'
The rest of the push (keeping the answer box and its button clear of the keyboard with bottomOffset) is fine.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined review: reviewer-opus and reviewer-sol, head c7f49ff
Fixed. On iOS, the KeyboardAwareScrollView is wrapped in <NativeScrollViewMarker style={{ flex: 1 }}>, exactly as NativeScrollView does it. Android keeps ScreenScrollView's content width (width: "100%", maxWidth: 720, alignSelf: "center"). bottomOffset grows from 72 to 160, so the Answer button clears the keyboard too, and the comment says what the offset covers. Only InboxScreen.tsx changed.
The panel has no open code findings. One thing only a device can confirm: that the marker finds the library's inner scroll view. That shows up as the header's scroll-edge appearance following the scroll, and tap-to-top working, on iOS. The tester's re-run covers it, along with the keyboard on iOS and Android. Green J5 CI is still needed.
… in view Wrapping keyboard-controller's scroll view in the native header marker crashed iOS (the marker needs a scroll view as its direct child). The Inbox is back on upstream's ScreenScrollView, with iOS's own keyboard insets bringing the focused answer box above the keyboard, as upstream's commit sheet does, and Android's keyboard-avoiding view as before. The Answer row now sits above the box, so it is in view whenever the box is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined review: reviewer-opus and reviewer-sol, head 5acca45
The NativeScrollViewMarker wrap at c7f49ff crashed on iOS: RNSScrollViewMarkerComponentView.findScrollView requires its direct child to be a scroll view, and keyboard-controller's wrapper isn't one. This push goes back to upstream's ScreenScrollView, which keeps the header registration, the insets and the Android width. Compared with the reviewed 17ed396, there are only three changes, all in InboxScreen.tsx:
- iOS.
automaticallyAdjustKeyboardInsets, the pattern upstream's pull-request screens already use. TheKeyboardAvoidingViewis disabled on iOS. - Android. keyboard-controller's
KeyboardAvoidingViewstays on, as at 17ed396, where Android passed. - The Answer row moves above the answer box. iOS brings only the focused field into view, so the button now stays visible whenever the box is. The error stays below the box.
The panel has no open code findings. The tester's iOS and Android re-run is what proves it: no crash, the header's scroll-edge appearance and tap-to-top, and the answer box and Answer button clear of the keyboard. Green J5 CI is still needed.
…eyboard Android's keyboard-avoiding view made room for the keyboard but left a lower ask's answer box under it. Android now uses keyboard-controller's KeyboardAwareScrollView, which brings the focused box into view; iOS keeps upstream's ScreenScrollView, whose header marker needs a plain scroll view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined review: reviewer-opus and reviewer-sol, head 2b18818
The tester passed iOS at 5acca45. On Android, though, the padding from KeyboardAvoidingView left a lower answer box under the keyboard. This push splits the list by platform and shares the body as content. Only InboxScreen.tsx changed.
- iOS. Unchanged from the passing head:
ScreenScrollViewwithautomaticallyAdjustKeyboardInsets. - Android. keyboard-controller's
KeyboardAwareScrollViewwithbottomOffset={80}and the 720 content cap. On Android,ScreenScrollViewwraps a plainScrollViewwith no header marker, so the width cap is the only thing to carry over, and it is. No marker is involved here, so this can't hit the iOS crash.
The panel has no open code findings. Before merge it still needs the tester's Android re-run (typing in a lower ask, with the box and Answer row clear of the keyboard) and green J5 CI.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
Mobile's Inbox (#883) shows the asks agents send a person, but the person can't answer them there; they still have to open web or desktop (#830; gap A8).
What changed
Part 3 of 4 for #830: each open ask in mobile's Inbox gets an answer box and an Answer button, working as web's Inbox does. The rules are shared with web through
client-runtime/src/j5/inbox.ts(moved there in #878). The screen's state lives in J5-ownedapps/mobile/src/j5/inbox/inboxAnswers.ts(useInboxAnswers).clientRequestId, so the server takes it once (submitHumanInboxAnswer).keepForPersonScopes.permissionAtom) or a server whose inbox isn't currently read. The server checks again either way.ScreenScrollView, which registers with the native header, and its own keyboard insets bring the focused answer box above the keyboard, as upstream's commit sheet does. On Android, keyboard-controller'sKeyboardAwareScrollViewdoes it. The Answer row sits above the box, so it's in view whenever the box is, and taps work with the keyboard up.Known edge, left as is (panel note): if a server's person changes from A to B and back to A without an answer in between, a retry for A may reuse A's earlier request id. The server still takes the answer once, so nothing is lost or doubled. It's rare and harmless, so it isn't handled.
UI changes
Base
278e970180(the read-only Inbox) vs the current layout, where the Answer row sits above the answer box. Android at2b1881809b; iOS at5acca453fa, which has the same iOS code as the head.2b1881809b: the list2b1881809b: typing on the lowest ask, keyboard upAndroid: a failed delivery keeps the words beside the ask, Answer is off while offline, and reconnecting allows the retry.
android2b188-error-short.mp4
Android: an ask being typed is withdrawn by the agent, and the kept words update without a refresh.
android2b188-withdrawal.mp4
Live testing
Verdict: PASS on Android and iOS at
2b1881809b, with the iOS keyboard and header states also at5acca453fa, which has the same iOS code. The crew tester ran it (GPT-6 Astra) with real Claude Haiku 5.5 agents. Report:artifacts/test-reports/j5code-mobile-wave1a-tester/2b1881809b.md. Both videos were checked for a signed-out viewer (200 video/mp4).17ed3962ab: on iOS the keyboard covered a lower Answer.7e2d31237f: keyboard-controller's scroll view left the Answer button covered.c7f49ffdd8: wrapping it in the header marker crashed iOS.5acca453fa: upstream's scroll view with native insets, Answer above the box. iOS passes.2b1881809b: Android gets keyboard-controller's scroll view, since the marker is iOS-only.Not exercised: several servers while answering (one server per answer is the shared, tested path), and slow networks.
Upstream impact
None. Only J5-owned files change (
apps/mobile/src/j5/inbox/).Checklist
client-runtimeBuilt by Claude Opus 5.5 in Claude Code (J5 crew seat builder-identity).
🤖 Generated with Claude Code