Skip to content

feat(mobile): answer the Inbox's asks in place - #887

Merged
Jacksondr5 merged 9 commits into
j5/mainfrom
j5code/inbox-answer
Nov 1, 2026
Merged

Jacksondr5 merged 9 commits into
j5/mainfrom
j5code/inbox-answer

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

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-owned apps/mobile/src/j5/inbox/inboxAnswers.ts (useInboxAnswers).

  • Delivered as typed. The words go to the agent exactly as written, and Answer is disabled while the box is empty. While the answer is sending, the button reads "Delivering…" and the other answers wait.
  • Retry safely. If delivery fails, the error shows beside that ask's answer box, where the person is looking, and the words stay. A retry with the same words reuses the same clientRequestId, so the server takes it once (submitHumanInboxAnswer).
  • Kept while typing (AC17). If an ask closes while the person has typed into it (someone else answered, or the agent withdrew it), it stays in the list with their words. In place of Answer it says who answered ("You answered", "Priya answered"; AC16), "The agent withdrew this", or "No longer open".
  • The right person. Unsent words for a server are dropped when that server's person changes, through keepForPersonScopes.
  • Who may answer. Answer is disabled for a read-only connection (the command's permissionAtom) or a server whose inbox isn't currently read. The server checks again either way.
  • After an answer, the server's open and answered lists and its open count are read again. As on web, an ask that leaves the open list re-reads that server's answered list, so a kept item learns who answered or that the agent withdrew it without waiting for a pull. The server's inbox signal also re-reads them on other clients.
  • Keyboard. On iOS the list stays on upstream's 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's KeyboardAwareScrollView does 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 at 2b1881809b; iOS at 5acca453fa, which has the same iOS code as the head.

State Before After
Android: an ask to the person, expanded Android ask expanded without an answer box, before Android ask expanded with Answer above its answer box, after
Android: an ask to everyone here, expanded Android everyone-here ask without an answer box, before Android everyone-here ask with Answer above its answer box, after
iOS: an ask expanded (light) iOS ask expanded without an answer box, before iOS ask expanded with Answer above its answer box, after
Android: typing on the lowest ask, keyboard up new Android lowest ask typed with the box and Answer above the keyboard, after
iOS: typing on the lowest ask, keyboard up (light) new iOS lowest ask typed with the box and Answer above the keyboard, light, after
iOS: typing on the lowest ask, keyboard up (dark) new iOS lowest ask typed with the box and Answer above the keyboard, dark, after
Android: Delivering… new Android answer delivering, after
Android: answered, on the Answered shelf new Android ask on the Answered shelf after answering, after
Android: someone else answered while typing new Android kept draft with Taylor Base answered, after
Android: the agent withdrew an ask being typed new Android kept draft reading The agent withdrew this, after
Android: delivery failed, offline: error by the ask, Answer off new Android delivery error beside the ask with Answer disabled offline, after
Android: reconnected, Answer back new Android reconnected with the kept words and Answer enabled, after
iOS at the head 2b1881809b: the list new iOS Inbox list at the final head, after
iOS at the head 2b1881809b: typing on the lowest ask, keyboard up new iOS lowest ask typed with Answer above the keyboard at the final head, after
iOS: the list under the native header (dark) new iOS Inbox list under the native header, dark, after
iOS: scrolled, header scroll edge (dark) new iOS Inbox scrolled with the header's scroll edge, dark, after
iOS: after tapping the status bar (dark) new iOS Inbox back at the top after tapping the status bar, dark, after

Android: 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 at 5acca453fa, 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).

  • iOS at the head: a fresh launch and the Inbox deep link open without a crash. Focusing the lowest ask's box reveals the typed line and the whole Answer row, and one tap with the keyboard up delivered the exact words once. On iOS, the unused lower part of a multi-line box can sit behind the keyboard; the line being typed and Answer are always visible.
  • Delivery: Answer is disabled while the box is empty, the agent's thread receives the exact words, and the ask moves to the Answered shelf.
  • Keyboard: on the lowest ask, typing scrolls the box and the Answer row above the keyboard, with no manual scroll, on Android and iOS. One tap on Answer with the keyboard up delivers.
  • Kept while typing: Taylor Base answered an everyone-here ask from web, and the phone kept the words with "Taylor Base answered". When the agent's thread was archived, a kept item read "The agent withdrew this" without a refresh.
  • Failure: with the server stopped, the error shows beside the ask and the words stay. Reconnecting enables a retry that delivers exactly one answer (database count 0 → 1). A thread-only person on an offline server has Answer disabled.
  • iOS header: the first card is below the header, with the native scroll edge and tap-to-top.
  • How the layout got here:
    • 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

  • One concern: answering from mobile's Inbox
  • Tests: the answer, retry and kept logic is shared and tested in client-runtime
  • UI changes: Android and iOS before/after screenshots above, and videos of the failure-and-retry and withdrawal sequences
  • Live testing: the section above says what is pending
  • Upstream-owned files: none edited
  • Upstream product: no change
  • Surfaces: iOS and Android; several servers, each answer going to its own server; a read-only connection; the server checks again. Web is unchanged.
  • Docs: in the wave-2 docs PR

Built by Claude Opus 5.5 in Claude Code (J5 crew seat builder-identity).

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Nov 1, 2026 10:18pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

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.

Check out review usage here.

View limit details

Limit details: You’ve used all 3 included reviews currently available. Your 49 included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 5acca45 and 203c97c.

Files selected for processing: 2
  • apps/mobile/src/j5/inbox/InboxScreen.tsx
  • apps/mobile/src/j5/inbox/inboxAnswers.ts

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 278e970 and 5acca45.

Files selected for processing: 3
  • apps/mobile/src/j5/inbox/InboxScreen.tsx
  • apps/mobile/src/j5/inbox/inboxAnswers.ts
  • apps/mobile/src/j5/inbox/inboxSources.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

Walkthrough

The mobile Inbox now displays answerable asks, retains closed asks, and supports in-place answer submission. It tracks drafts, delivery state, and errors, and refreshes open and answered data and the inbox count after submission.

Changes: Mobile Inbox Answers

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
Loading

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 #883 with 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: Passed 4
Check name Status Explanation
Title check Passed The title clearly identifies the main change: adding in-place answers for asks in the mobile Inbox.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed 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 includ…
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 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. useInboxAnswers is web's page state on the shared helpers:
    • unsent words are dropped for a server whose person changes;
    • kept items are retained (nextKeptItems, closedWith), and closedOf uses answeredReadSinceClose;
    • 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. sendAnswer throws Cause.squash, which the shared helper turns into the error message. The answer is accepted before the refresh: refreshAfterAnswer rereads both the open and answered lists, and its failure becomes the shared "Answer delivered, but…" error. The count refresh stands in for web's notifyHumanInboxChanged.
  • Gating. The button is gated as on web, by !canAnswer || anyDelivering || answerText.length === 0, where canAnswer is sourceReady plus the command's permissionAtom. A kept item shows closedLine instead of the button.

Notes (not blocking)

  1. The withdrawn-ask label can lag. Web's HumanInboxPage.tsx:519–548 rereads 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 inbox revision) 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.
  2. 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.
  3. 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>
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Nov 1, 2026

@Jacksondr5 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. useInboxAnswers ports web's effect line for line: when an ask leaves a ready source's open list, it refreshes that server's answeredInboxQueryAtom. There's no timer, and the effect states its reason on its budget line.
  • (3) Taken. The error is now { key, message }, shown by errorFor(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.

@github-actions github-actions Bot added the size:L 100-499 effective changed lines (test files excluded in mixed PRs). label Nov 1, 2026
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 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. The Inbox's scroll view is no longer registered with the native header on iOS (InboxScreen.tsx:101). The raw KeyboardAwareScrollView replaces ScreenScrollView, and with it NativeScrollView's iOS NativeScrollViewMarker. That marker is the only way a screen's scroll view reaches its header, as its doc and the require-registered-list-scroll rule say.

    • Mechanism. react-native-screens' registerDescendantScrollView (RNSStackScreenComponentView.mm:91–102) calls setContentScrollView(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 }}>, as NativeScrollView does, 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 explicit bg-sheet already sets the colour, so those needn't be carried over. If wrapping doesn't work with the library, go back to ScreenScrollView and keep the answer box above the keyboard another way. Either way, the tester needs to check the header and the keyboard on iOS.

The rest of the push (keeping the answer box and its button clear of the keyboard with bottomOffset) is fine.

Jacksondr5 and others added 2 commits November 1, 2026 16:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Jacksondr5 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. The KeyboardAvoidingView is disabled on iOS.
  • Android. keyboard-controller's KeyboardAvoidingView stays 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 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: ScreenScrollView with automaticallyAdjustKeyboardInsets.
  • Android. keyboard-controller's KeyboardAwareScrollView with bottomOffset={80} and the 720 content cap. On Android, ScreenScrollView wraps a plain ScrollView with 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>
@Jacksondr5
Jacksondr5 merged commit ba3dc4e into j5/main Nov 1, 2026
32 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/inbox-answer branch November 1, 2026 22:33

This branch was successfully deployed

1 active deployment
Preview — 203c97c4 Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant