Skip to content

feat(mobile): a Captain's questions for you pin above its composer - #994

Merged
Jacksondr5 merged 3 commits into
j5/mainfrom
j5code/mobile-adjudication-dock
Nov 9, 2026
Merged

Jacksondr5 merged 3 commits into
j5/mainfrom
j5code/mobile-adjudication-dock

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Problem

On web, a Captain's open questions for the person are pinned above its composer: the Crews adjudication dock. On a phone they appear only in the Inbox, so someone working in the Captain's thread doesn't see what the Captain is waiting on. This is piece 6 of #836, the Crews-on-mobile scope Jackson set on 2026-11-08.

What changed

  • The dock. AdjudicationDock is the second row in J5ComposerControls (case 114), below the Crew proposal strip.
    • Folded, it is one row the height of the proposal strip: "Question for you · open 5m", the ask's title, and its urgency. Tap it to open about three lines of the question, an answer box, and Answer.
    • "Show full question" appears whenever the question, its records or its follow-ups run past those three lines. That is measured on screen rather than counted from characters, because a few short lines can still wrap past the excerpt on a phone.
    • With several open asks, a "N more questions" row switches between them, as on web.
    • Web shows the whole card at all times. On a phone that would stack a second text box above the composer and keyboard, which is the same reason the roster review opens its own screen.
  • The Inbox's own asks. The dock reads the same open-asks list and answers through the same flow as the mobile Inbox (useInboxAnswers), so answering in either place closes the one Exchange. The Inbox's behaviour comes with it:
    • An ask that closes while you're typing stays, with who answered.
    • A retry reuses its request id.
    • An error shows by the answer box.
  • Captains only. As on web (commandsACrew), only a thread that commands a Crew gets the dock. The Inbox is read only for such a thread.
  • Crew membership on mobile. apps/mobile/src/j5/crew/crewMemberships.ts is a store over listCrewMemberships using feat(mobile): a Captain's seats list under its row, with Stop crew #993's connections atom. It re-reads a thread's membership whenever the server's Crew revision moves, so a thread that becomes a Captain while open picks it up without a timer.
  • Shared logic. The dock's logic (adjudicationDock.logic.ts) and the membership replace moved from web to client-runtime, with their tests, and web imports them from there.
    • adjudicationAsks now sorts a fresh array with sort instead of toSorted, which Hermes lacks.
    • pickShownAsk now also returns next, the ask after the shown one, wrapping around. The "N more questions" row moves to it on web and mobile. Before, the row always picked the first of the others, so with three asks it switched between the first two and never reached the third. Web had the same bug, and the panel found it here.
  • Not on mobile: answer attachments and the owner's clear action, since the mobile Inbox has neither.

UI changes

Android. Before is trunk 8560586b99; after is daf9465062. The dock code is identical at the current head d6c168a715, a clean rebase.

State Before After
Captain with three open asks Captain with three open asks, before Captain with three open asks, after
Plain agent with an open ask: no dock Plain agent with an open ask: no dock, before Plain agent with an open ask: no dock, after
Pending Crew proposal above the composer Pending Crew proposal above the composer, before Pending Crew proposal above the composer, after

After only (the dock is new):

Short question wrapping past the excerpt, with Show full question, after

Short wrapped question opened in full, after

First of two similarly tall wrapped questions, after

Second wrapped question keeping Show full question after switching, after

Second wrapped question opened in full, after

Third ask reached from the more-questions row, after

Personal ask answered on web: the phone keeps its draft and reads Answered, after

Last ask answered: the dock is gone, after

Captain acknowledging the delivered answers, after

Inbox after all three asks were answered, after

Open ask in a thread awaiting Crew approval, after

Dock appearing once the Crew is approved, without leaving the thread, after

Opened dock with a typed composer above the keyboard, after

Dock answer field focused above the keyboard, after

Switching between two similarly tall wrapped questions and opening the second in full:

two-wrapped-daf9465-after-published.mp4

Cycling through three open asks and back to the oldest:

three-cycle-daf9465-after-published.mp4

Answering on web while the phone keeps its draft:

answered-elsewhere-daf9465-after-published.mp4

Answering the last ask from the dock, which then goes away:

answer-last-daf9465-after-published.mp4

Approving the Crew while the phone stays in the thread, and the dock appearing:

become-captain-daf9465-after-published.mp4

Live testing

Pass on Android at daf9465062, by the wave 4 Android tester (Sol 6.1), with real Claude Haiku 5.5 turns. It exercised:

  • three open asks, cycling oldest → second → third → oldest;
  • a short question that wraps past the excerpt;
  • switching between two similarly tall wrapped questions;
  • answers delivered to the Captain, and the last answered ask leaving both the dock and the Inbox;
  • a draft kept on the phone while the same ask was answered on web;
  • no dock for a plain agent's ask;
  • the Crew proposal strip, as a regression check;
  • a thread becoming a Captain while open, without leaving it;
  • both text fields above the real Gboard keyboard.

An ask answered elsewhere reads "Answered" and doesn't name who answered. That is expected: the server records the answerer only for an "everyone here" ask, and the Inbox reads it the same way.

The current head d6c168a715 is a clean rebase of daf9465062 onto trunk after #981. Its range-diff is identical, so it wasn't re-tested.

Not exercised:

  • an "everyone here" ask showing its answerer's name;
  • iOS, dark theme, desktop and remote/relay;
  • a failed delivery's error line.

Upstream impact

  • packages/client-runtime/package.json: the ./j5/adjudication-dock and ./j5/crew-memberships exports, recorded in case 114.
  • No new seam in an upstream mobile file: the dock mounts in J5-owned J5ComposerControls.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior: the moved adjudicationDock.test.ts and crewMemberships.test.ts; the mobile dock reuses the Inbox's tested answer flow
  • UI changes: before/after above, with videos for the interactions
  • Live testing: the section above says what ran live and what did not
  • Upstream-owned files: packages/client-runtime/package.json, recorded in FORK.md case 114
  • Upstream product: J5-owned feature; no change to upstream's product
  • Surfaces: mobile is the client here; web imports the moved logic unchanged; agents reach the same asks through the Inbox's tools
  • Docs: the Personas guide's sentence on the pinned question goes in the wave 4 docs PR

Built by Claude Opus 5.5 in Claude Code, as builder-timeline in the mobile catch-up Crew.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 9, 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 9, 2026 8:55am UTC

Request Review

@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Nov 9, 2026
@github-actions github-actions Bot added the size:L 100-499 effective changed lines (test files excluded in mixed PRs). label Nov 9, 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 (Claude Opus 5.5 and GPT Sol 6.1), head 12a761c

Both of us reviewed the PR independently and checked each finding against the source. Two findings block merge, and both have small fixes.

Blocking

  1. A third question can't be reached from the dock (AdjudicationDock.tsx:199).

    • Cause. pickShownAsk returns others in sorted order, without the shown ask, and the "N more questions" row always picks others[0].
    • Effect. With asks A, B and C, showing A gives others [B, C], so the tap picks B. Showing B gives others [A, C], so the tap picks A. C is never shown, though the row says "2 more questions". reviewer-sol ran the helpers and got A, B, A, B, A, B.
    • Fix. Advance to the ask after shown in asks, wrapping (A→B→C→A), or list the others as rows to choose from.
  2. A wrapped question can be cut off with no way to read it (:87–91, :130–155).

    • Cause. The opened preview is a ScrollView capped at maxHeight: 72, with scrollEnabled={false} until "Show full question". That link only appears when longer is true: hasMoreThanExcerpt (more than 3 newline-separated lines, or more than 240 characters), follow-ups, or a record. The heuristic counts characters and newlines, not rendered lines.
    • Effect. A question of three 70-character lines (210 characters) wraps to about 6 lines at phone width, overflows the 72px, can't scroll, and gets no link, so its end can't be read in the dock. reviewer-sol confirmed longer is false for it.
    • Fix. The smallest one is to always offer "Show full question" once the dock is open. Alternatively, measure the content with onContentSizeChange against the cap.

Checked and fine

  • The lift. adjudicationDock.ts and crewMemberships.ts move once, with their tests, and sort replaces toSorted on a fresh array. Web changes only its imports, and the two exports are recorded in case 114.
  • The Captain gate. The dock subscribes to nothing in the Inbox unless commandsACrew(useCrewMembership(ref)), and it hides without the answer permission or without asks.
  • Kept items. The mobile Inbox's useInboxAnswers retention keeps an ask that closed while typed into, with its closed line. Kept snapshots are still "open", so adjudicationAsks keeps them; that replaces web's separate refused list.
  • Membership. It's read through a createScopedThreadReadStore over listCrewMemberships, with a force re-read on the crew revision. The shared threadReadConnectionsAtom export is fine, and so are the lint reasons.
  • Tests. 9 focused runtime dock, membership and store tests pass.

Notes (not blocking)

  • A folded dock on a phone (you asked our view). It's right: the space above the composer is scarce, and the folded row still shows "Question for you", the intent and the urgency.
  • Records. The dock draws J5's records with the old inline panel. Once #992's mobile J5RecordPanel lands, use it here too, as web's dock does, so a persona draft's definition keeps its layout.
  • Naming. ofThisThread filters by environment only; the thread filter is in adjudicationAsks. It's correct, just misleadingly named.
  • Membership re-reads. useCrewMembership also force-re-reads whenever threadReadConnectionsAtom yields a new map, meaning any server's connection change. It's cheap, but chattier than needed.

The PR says honestly that the captures and docs are pending.

@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 32b7987

Blocker 1 is fixed on web and mobile. pickShownAsk returns next = asks[(index + 1) % length], and both "more questions" rows move to it. The new test walks first → second → third → first.

Still blocking: blocker 2, through the switcher

Measuring is the right fix, but one path still clips. React Native fires onContentSizeChange from the content container's onLayout (ScrollView.js:1259–1262, :1772–1775), so it fires only when the size changes. While the dock is open, the excerpt ScrollView is reused across asks. If the person switches from A to an equal-height B, for example two questions that each wrap to five lines, nothing fires, and overflowing still holds A's id. So longer is false for B, and B is cut off at 72px with no "Show full question". Opening the dock mounts the ScrollView fresh, so only switching while open is affected.

Fix: key={shown.exchangeId} on the excerpt ScrollView, so each ask mounts fresh and reports its own size.

Non-blocking points, as you've handled them: ofThisEnvironment is renamed; the J5RecordPanel switch is planned for after #992; keeping the membership re-read on a connection change is your call.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The mobile composer now includes an adjudication dock for Crew-commanding threads. The dock displays Inbox asks and submits answers through the Inbox flow. The change also adds shared client-runtime helpers for Crew memberships and adjudication asks.

Changes: Mobile Crew asks

Layer / File(s) Summary
Crew membership loading and replacement
packages/client-runtime/src/j5/crewMemberships.ts, packages/client-runtime/src/j5/crewMemberships.test.ts, packages/client-runtime/package.json, apps/web/src/j5/crew/CrewMembershipsClient.ts, apps/web/src/j5/crew/CrewMembershipsClient.test.ts, apps/mobile/src/j5/crew/crewMemberships.ts, apps/mobile/src/j5/crew/spawnedChildren.ts
The client runtime adds environment-scoped membership replacement, and the web client uses the shared implementation. Mobile adds a membership store and hook that requests membership as thread connections and Crew revisions change.
Shared adjudication helpers
packages/client-runtime/src/j5/adjudicationDock.ts, packages/client-runtime/src/j5/adjudicationDock.test.ts, packages/client-runtime/package.json, apps/web/src/j5/a2a/AdjudicationDock.tsx
The runtime exports the adjudication-dock module. Ask selection now provides the next ask, including wraparound. The web dock uses that result for the additional-question button.
Mobile dock and composer integration
apps/mobile/src/j5/a2a/AdjudicationDock.tsx, apps/mobile/src/j5/composer/J5ComposerControls.tsx, FORK.md
The composer renders the dock with its environment and thread IDs. The dock displays selected ask details, supports expanding content and selecting other asks, and submits answers when the source is ready, no delivery is pending, and the answer is non-empty. The documentation records the mobile dock and its limitations.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant J5ComposerControls
  participant AdjudicationDock
  participant InboxSources
  participant User
  participant InboxAnswerFlow
  J5ComposerControls->>AdjudicationDock: Render with environmentId and threadId
  AdjudicationDock->>InboxSources: Read open and answered asks
  InboxSources-->>AdjudicationDock: Provide asks for the environment
  AdjudicationDock-->>User: Display selected ask and answer controls
  User->>AdjudicationDock: Enter and submit an answer
  AdjudicationDock->>InboxAnswerFlow: Deliver the answer
Loading

Possibly related PRs

  • Jacksondr5/j5code#983: Adds the J5ComposerControls component that this PR updates to render AdjudicationDock.
  • Jacksondr5/j5code#993: Adds the thread-read connections atom that this PR exports and uses for mobile membership reads.

Suggested reviewers: bryantderosier

Merge Risk: Minimal · up to daf94

No actionable issue currently blocks the mobile ask dock from merging after normal checks.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(mobile): a Captain's questions for you pin above its composer" matches the main change: the PR adds an AdjudicationDock to mobile Captain threads, pinned above the composer and showing…
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 covers the Problem, What changed, UI changes, Live testing, Upstream impact, and Checklist sections of the template. It explains the dock's behavior, the moved shared logic, the pick-s…
Full details: Title check

Explanation

The title "feat(mobile): a Captain's questions for you pin above its composer" matches the main change: the PR adds an AdjudicationDock to mobile Captain threads, pinned above the composer and showing open asks. It is specific and follows conventional commit style. The title does not mention the moved shared logic or the Crew membership store, which are secondary to the main feature.

Full details: Description check

Explanation

The description covers the Problem, What changed, UI changes, Live testing, Upstream impact, and Checklist sections of the template. It explains the dock's behavior, the moved shared logic, the pick-shown-ask fix, and the Android before/after evidence. Live testing is reported as passed on Android at a named commit, with the untested areas listed. Upstream impact names the package.json exports and FORK.md case 114. The checklist is mostly ticked, and the one open item (the Personas guide docs sentence) is stated as deferred to a later PR. The 'Problem' section links tracking issue #836 but does not use the 'Closes #123' form, which is a minor gap since this is a piece of a larger issue. The description is complete enough to pass.

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.

Follow-up review: reviewer-opus, head daf9465

Fixed. The excerpt ScrollView has key={shown.exchangeId}, so switching asks while the dock is open remounts it and onContentSizeChange reports the new ask's own height, even an equal one. Blocker 2 is closed, so both blockers are fixed. It's a two-line change, and nothing else moved.

No open code findings from me. Still pending: the tester's captures (three asks, and a wrapped short question, with a switch between them while open) and green J5 CI.

Jacksondr5 and others added 3 commits November 9, 2026 03:53
web's adjudication dock does: the Inbox's own asks from this thread, answered through
the Inbox's answer flow, shown only for a thread that commands a Crew. Membership is
read through a mobile store over listCrewMemberships, re-read when the server's Crew
revision moves; the dock's logic and the membership replace move to client-runtime,
shared with web.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion opens in full

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…switches

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jacksondr5
Jacksondr5 force-pushed the j5code/mobile-adjudication-dock branch from daf9465 to d6c168a Compare November 9, 2026 08:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Additional comments: 1

apps/mobile/src/j5/a2a/AdjudicationDock.tsx: 1

55-61: Trivial · Performance & Scalability · Low value

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Recomputed arrays on every render may defeat stable-reference checks in useInboxAnswers.

ofThisEnvironment(mergeHumanInboxSources(...)) creates new items and answered arrays on every render. useInboxAnswers compares openSources by reference, not items. So the retention logic is not triggered by the new array identity. However, the work (merge, sort, filter) repeats on every render, including each keystroke in the answer box. The React Compiler may cache these values. If it does, no action is needed. Confirm that this file compiles under reactCompilerCoverage.test.ts.

Source: Coding guidelines

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 12a761c and daf9465.

Files selected for processing: 4

  • apps/mobile/src/j5/a2a/AdjudicationDock.tsx
  • apps/web/src/j5/a2a/AdjudicationDock.tsx
  • packages/client-runtime/src/j5/adjudicationDock.test.ts
  • packages/client-runtime/src/j5/adjudicationDock.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 4 reviews per hour.

This branch was successfully deployed

1 active deployment
Preview — d6c168a7 Deployed Nov 9, 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