Skip to content

feat(mobile): ask whose device it is and renew the session on a level change - #844

Merged
Jacksondr5 merged 6 commits into
j5/mainfrom
j5code/mobile-identity-access
Nov 1, 2026
Merged

Jacksondr5 merged 6 commits into
j5/mainfrom
j5code/mobile-identity-access

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Problem

On mobile, a device paired with a link that names no person lands on an empty "No projects found" and can't say whose it is. And when an Owner changes a person's level, the phone is cut off until someone pairs it again by hand. Web handles both. Part of #831 (gaps P1 and P2).

What changed

  • Ask whose device it is (P1). Mobile now asks "What should people and agents on call you?" the same way web's NameDialog does. It asks when a saved server can't place the device (pick an existing person or name someone new), and when the first owner has no name yet. It's a full-screen modal that can't be swiped away, because the device reaches nothing on that server until it's answered. The rule for which server asks (serverToAskNameFor), plus offeredLevel, levelLabel, the name-refusal messages and nameIsInUse, now live in packages/client-runtime/src/j5/sharing.ts, so web and mobile share one copy. Web imports them from there; its behaviour is unchanged.
  • Renew the session on a level change (P2). Mobile's connection runtime adds J5's existing @t3tools/client-runtime/j5/session-renewal layer, as web's does. When J5 ends a saved server's bearer session for a level change, the phone renews it with its old token and reconnects once. Claiming a device goes through the same path: the server ends the unknown device's session and the phone renews into the claimed person.
  • No "pair again" for a renewed person. Upstream's "Permissions have changed… Pair again using a new link" notice treats a Viewer's renewed one-permission session as legacy. Mobile now skips it for a connection J5 places as a person, as web has since case 73. permissionNoticeApplies moves into client-runtime.
  • Mobile's j5Sharing now re-reads access when the server's sharing revision moves, as web's does. A scope added while the connection stays open is then picked up.

Managing sharing (Share, People, Leave, Rename) stays on web and desktop (#609).

UI changes

Before After
Android: a device paired with a link that names no person Android: a device paired with a link that names no person, before Android: a device paired with a link that names no person, after
Android: after claiming as a new person, the session renews and threads load new Android: after claiming as a new person, the session renews and threads load, after
Android: unnamed first owner on an empty server Unnamed first owner on an empty server, before Unnamed first owner on an empty server, after
Android: claiming an existing person new Claiming an existing person, after
Android: a name someone else has new Duplicate-name error on the name question, after
Android: a name the server won't take new Unusable-name error on the name question, after
Android: Owner lowered to Viewer, session renewed new Viewer after renewal, draft cannot be sent, after
Android: Viewer raised to Collaborator, session renewed new Collaborator after renewal, draft can be sent, after
Android: a removed device is refused new Removed device refused on renewal, after

iOS is deferred to Checkpoint 1, per the Captain's wave-1 Simulator hold.

Live testing

Verdict: PASS on Android 16 at head 640526e8a7. The crew tester ran it (GPT-6 Astra) against isolated test servers, with a real Claude Haiku 5.5 turn. Report: artifacts/test-reports/j5code-mobile-wave1a-tester/640526e8a7.md.

  • Claim: claiming a new person and an existing person both succeed. The screen stays on "Saving…" until the renewed session closes it, with no credential-error flash. A taken name and an unusable name both show clear inline errors; those were run at bbd364827e, and that logic is unchanged since.
  • First owner on an empty --fresh home: asked for a name only, with Continue disabled while the field is empty. Saving closes the question. Base 31447c91c6 vs head, as above.
  • Owner → Viewer: renewal returns HTTP 200, the thread stays readable, and Send is disabled. Upstream's wrong "Permissions have changed… Pair again" notice no longer appears.
  • Viewer → Collaborator: Send is enabled without pairing again. A real Haiku turn completed after promotion.
  • Removed device: renewal is refused (401), and the app says the server did not accept the device.
  • 53 focused tests passed at the head.

Not exercised: iOS (deferred to Checkpoint 1), relay, tunnel and DPoP routes (never renewed, as on web), and several servers asking at once. No native video: the change has no motion beyond the modal opening.

I also ran a smaller check myself at 2891176a03: claiming a new person on Android, with before/after captures (the first rows above).

Upstream impact

  • apps/mobile/src/App.tsx: one import and one <NameQuestionHost /> beside Dialog.Host. FORK.md case 70.
  • apps/mobile/src/connection/runtime.ts: one import and one Layer.provideMerge(J5SessionRenewal.layer), as web's runtime does. FORK.md case 70, plus a new file-table row.
  • apps/mobile/src/features/connection/permissionUpdateNotice.ts: one import and one condition, web's case-73 rule. FORK.md case 73, plus a new file-table row.
  • All three are listed in apps/mobile/src/j5/upstreamSeams.test.ts. Neither changes what upstream's product does: J5's own people model is what asks and renews.

Checklist

  • One concern: the description has no "also". Claim and renewal are one flow: a claimed device reaches the server only through renewal.
  • Tests cover the changed behavior: serverToAskNameFor tests moved to client-runtime and pass. Renewal is covered by sessionRenewal.test.ts, and the seams test pins both wirings.
  • UI changes: Android before/after screenshots above (iOS deferred to Checkpoint 1). No motion beyond the modal opening.
  • Live testing: the section above says what ran live and what did not.
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR.
  • Upstream product: no change to what upstream's product does.
  • Surfaces: mobile is the client changed and web's behaviour is kept. The name question covers every saved server, one at a time. Renewal covers bearer connections (local, Tailscale, tunnel); a T3 Connect/DPoP route is never renewed, as on web. Reverse states: a refused renewal leaves the device for manual pairing, as on web.
  • Docs: per the Captain, Mobile: identity and access (claim a person, session renewal, refused actions, Owner-only Settings) #831's doc changes (People and access AC17, the Later list and History, and the user doc) come in one separate docs PR once the code PRs settle

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

🤖 Generated with Claude Code

@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 1:36am 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 21 billable files and costs up to $5.25.

  • 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 23 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 53 included PR review attempts over the past 7 days set your current allowance at 2 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 640526e and 8e9c9b1.

Files selected for processing: 21
  • FORK.md
  • apps/mobile/src/App.tsx
  • apps/mobile/src/connection/runtime.ts
  • apps/mobile/src/features/connection/permissionUpdateNotice.ts
  • apps/mobile/src/j5/sharing/NameQuestion.tsx
  • apps/mobile/src/j5/sharing/guestAccess.ts
  • apps/mobile/src/j5/sharing/identity.ts
  • apps/mobile/src/j5/sharing/upstreamNotices.ts
  • apps/mobile/src/j5/upstreamSeams.test.ts
  • apps/web/src/j5/sharing/NameDialog.tsx
  • apps/web/src/j5/sharing/SharingDialogHost.tsx
  • apps/web/src/j5/sharing/nameDialog.logic.test.ts
  • apps/web/src/j5/sharing/nameDialog.logic.ts
  • apps/web/src/j5/sharing/people.logic.ts
  • apps/web/src/j5/sharing/shareLink.logic.ts
  • apps/web/src/j5/sharing/sharingManage.ts
  • apps/web/src/j5/sharing/upstreamNotices.logic.test.ts
  • apps/web/src/j5/sharing/upstreamNotices.logic.ts
  • apps/web/src/j5/sharing/upstreamNotices.ts
  • packages/client-runtime/src/j5/sharing.test.ts
  • packages/client-runtime/src/j5/sharing.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 31447c9 and 640526e.

Files selected for processing: 21
  • FORK.md
  • apps/mobile/src/App.tsx
  • apps/mobile/src/connection/runtime.ts
  • apps/mobile/src/features/connection/permissionUpdateNotice.ts
  • apps/mobile/src/j5/sharing/NameQuestion.tsx
  • apps/mobile/src/j5/sharing/guestAccess.ts
  • apps/mobile/src/j5/sharing/identity.ts
  • apps/mobile/src/j5/sharing/upstreamNotices.ts
  • apps/mobile/src/j5/upstreamSeams.test.ts
  • apps/web/src/j5/sharing/NameDialog.tsx
  • apps/web/src/j5/sharing/SharingDialogHost.tsx
  • apps/web/src/j5/sharing/nameDialog.logic.test.ts
  • apps/web/src/j5/sharing/nameDialog.logic.ts
  • apps/web/src/j5/sharing/people.logic.ts
  • apps/web/src/j5/sharing/shareLink.logic.ts
  • apps/web/src/j5/sharing/sharingManage.ts
  • apps/web/src/j5/sharing/upstreamNotices.logic.test.ts
  • apps/web/src/j5/sharing/upstreamNotices.logic.ts
  • apps/web/src/j5/sharing/upstreamNotices.ts
  • packages/client-runtime/src/j5/sharing.test.ts
  • packages/client-runtime/src/j5/sharing.ts
Files with no reviewable changes: 4
  • apps/web/src/j5/sharing/upstreamNotices.logic.test.ts
  • apps/web/src/j5/sharing/upstreamNotices.logic.ts
  • apps/web/src/j5/sharing/nameDialog.logic.test.ts
  • apps/web/src/j5/sharing/nameDialog.logic.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 2 reviews per hour.

Walkthrough

The PR centralizes J5 sharing helpers in client-runtime, adopts them in web sharing, and adds mobile identity prompts and permission-notice filtering. It also adds J5 session renewal to the mobile connection runtime.

Changes: J5 Sharing and Identity Prompts

Layer / File(s) Summary
Shared J5 sharing helpers
packages/client-runtime/src/j5/sharing.ts, packages/client-runtime/src/j5/sharing.test.ts
Client-runtime adds helpers for name-prompt selection, offered access levels, name messages and conflicts, and permission notices. Tests cover prompt selection and notice conditions.
Web adopts shared helpers
apps/web/src/j5/sharing/*
Web sharing imports the shared helpers and removes their former local implementations and associated tests.
Mobile identity prompts
apps/mobile/src/j5/sharing/identity.ts, apps/mobile/src/j5/sharing/NameQuestion.tsx, apps/mobile/src/j5/sharing/guestAccess.ts, apps/mobile/src/App.tsx
Mobile adds identity commands and environment selection for naming prompts. The app mounts a prompt for device claims and first-owner naming. Successful saves refresh connection access. Sharing data is configured to reread on sharing changes.
Mobile permission-notice filtering
apps/mobile/src/j5/sharing/upstreamNotices.ts, apps/mobile/src/features/connection/permissionUpdateNotice.ts
Mobile derives environment IDs that meet the permission-notice predicate and requires a matching ID when filtering sessions with legacy permissions.

Mobile Session Renewal

Layer / File(s) Summary
Provide session renewal to the mobile runtime
apps/mobile/src/connection/runtime.ts, apps/mobile/src/j5/upstreamSeams.test.ts, FORK.md
The mobile connection runtime provides J5 session renewal before the provided client connection layer. The seam checks cover the runtime and related mobile integrations. Case 70 records manual pairing when an offline mobile session outlasts its lifetime.

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

Sequence Diagram(s)

sequenceDiagram
  participant NameQuestionHost
  participant nameToAskAtom
  participant identityCommands
  participant DeviceOwner
  participant ConnectionAccess
  NameQuestionHost->>nameToAskAtom: Read selected environment and prompt kind
  nameToAskAtom-->>NameQuestionHost: Return environment and prompt kind
  NameQuestionHost->>identityCommands: Query claimable people
  identityCommands-->>NameQuestionHost: Return claimable people
  DeviceOwner->>NameQuestionHost: Choose a person or enter a name
  NameQuestionHost->>identityCommands: Submit device claim or first-owner name
  identityCommands-->>NameQuestionHost: Return command result
  NameQuestionHost->>ConnectionAccess: Refresh access after success
Loading

Possibly related issues

  • Issue 40 includes mobile pairing and daily-use parity; this PR adds mobile device-owner prompts and session renewal.
  • Issue 831 specifies mobile device-owner prompts and session renewal after access-level changes; this PR adds the prompts and session-renewal layer.
  • Issue 609 tracks mobile sharing and guest-access work; this PR changes sharing-data rereads and access-related notices.

Suggested reviewers: bryantderosier

Merge Risk: Minimal · previous review 64052

Mobile now asks who a device belongs to and renews the session after a level change, while the name-question helpers are shared with web. No concrete defect was found in the changed code. Refused renewal and iOS behavior were not exercised, so a quick device check of those paths is worthwhile before release.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title "feat(mobile): ask whose device it is and renew the session on a level change" matches the main changes in the changeset. The changes add a name-question host that asks for a person name for…
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 follows the repository template. It has Problem, What changed, UI changes, Live testing, Upstream impact, and Checklist sections, and each is substantively filled. It states the proble…
Full details: Title check

Explanation

The title "feat(mobile): ask whose device it is and renew the session on a level change" matches the main changes in the changeset. The changes add a name-question host that asks for a person name for unplaced devices and unnamed first owners, plus a J5 session-renewal layer wired into mobile's connection runtime for level changes. The title also names the two primary behaviors. It omits the shared client-runtime move and the permission-notice change, which are secondary details and acceptable to omit.

Full details: Description check

Explanation

The description follows the repository template. It has Problem, What changed, UI changes, Live testing, Upstream impact, and Checklist sections, and each is substantively filled. It states the problem (mobile devices paired without a person name, and no session renewal on level change) and links the tracking issue as part of #831. It lists the code changes and the upstream-owned files, with their FORK.md cases (70 and 73). It gives Android before/after screenshots and live test verdicts with commit hashes, and it names what was not exercised (iOS, relay, tunnel, DPoP, and several servers at once). The Checklist has one unchecked item, the Docs item, which the author defers to a separate docs PR. The template asks for a closing line naming the model and harness. The description ends with 'Built by Claude Opus 5.5 in Claude Code', which satisfies that. Minor gaps: the Problem section does not use a 'Closes #123' line, because the work is part of #831 rather than a single issue, and the Docs item is unchecked with a stated deferral. Neither gap leaves the description largely incomplete.

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 added a commit that referenced this pull request Nov 1, 2026
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 effective changed lines (test files excluded in mixed PRs). labels 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 (Claude Opus 5.5 and GPT Sol 6.1), head 2891176

Both of us reviewed the PR independently. Neither found anything that blocks merge.

Checked and fine

  • P1, the name question. NameQuestion matches web's NameDialog step for step:
    • the same serverToAskNameFor rule, now shared and covered by the new sharing.test.ts cases;
    • the claim list with each person's highest level, plus "Someone new";
    • the isPersonName check before sending, and the name-in-use refusal;
    • after a claim, the session ends for renewal; the first owner's access is read again (refreshConnectionAccess, as web's refreshSharing does).
  • P2, session renewal. J5SessionRenewal.layer sits at the same place in mobile's connection runtime as in web's. The native Runtime.layer supplies HttpClient, and the connection storage supplies the credential get and put the renewal needs. T3 Connect (DPoP) routes are excluded by bearerOf, as on web.
  • Rereading. j5Sharing now rereads on the sharing revision, as web's does, so a level change reaches mobile's access atoms without a reconnect.
  • Moved helpers. The helpers lifted into client-runtime/j5/sharing.ts are unchanged, and web imports them from there. The web tests for the moved helpers are running on reviewer-sol's side; the shared tests (27) and mobile seam tests (21) pass.
  • FORK and docs. Case 70's text and file-index rows, and both new rows in upstreamSeams.test.ts, are present. The AC17 rewrite and the History entry match Jackson's 2026-10-31 decision on #831.

Note, not blocking

  • The full-screen modal blocks the whole app, not only the server that asks, and has no way out. This follows the spec ("can't be put off") and web. On a phone with several saved servers, though, pairing a second server from a link that names no person locks every server until the question is answered. If that server then becomes unreachable, Continue fails and Settings → Remove server is behind the modal. We aren't asking for a change here, because claiming as "Someone new" always works while the server is reachable. It's one for Jackson to try at Checkpoint 1.

Not yet done (merge gates, not code findings)

  • The before/after captures (Android and iOS: this adds a screen), the tester's run of P1 and P2 on a device, and green J5 CI.
  • This PR edits docs/j5/product/features/people-and-access.md and docs/j5/user/people-and-sharing.md.

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

The only change since 2891176 removes the edits to docs/j5/product/features/people-and-access.md and docs/j5/user/people-and-sharing.md. #831's docs move to their own PR. The code is unchanged, so our review of 2891176 stands: the panel has no open code findings. The merge-order note about the docs conflict with #848 no longer applies, though the FORK.md file-index rows still overlap.

Before merge it still needs the before/after captures (Android and iOS), the tester's run of P1 and P2, and green J5 CI.

@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 640526e

Both of us reviewed the two commits that fix the tester's findings. Neither found anything that blocks merge.

  • 82efaa9, no "Pair again" after a renewal. permissionNoticeApplies moves from web into client-runtime/j5/sharing.ts unchanged, with its tests. A person, an unknown device or a server that hasn't answered gets no notice. A server from before people, or a service session, keeps upstream's notice. Mobile's permissionNoticeEnvironmentIdsAtom mirrors web's. The edit to upstream's permissionUpdateNotice.ts is one import and one condition, recorded in case 73 with a file-index row and a seam row.
  • 640526e, the name question stays on "Saving…". A failure clears busy and shows the error. A success keeps "Saving…" until the re-read access unmounts the question, and the claimable list's error is hidden while saving, so the error no longer flashes during renewal.
  • Note, not blocking: after a success, the only way out is that unmount. If the server refuses the renewal, or the first owner's re-read fails, the question stays on "Saving…". It was just as stuck before (only showing an error), so we're not asking for recovery code.

The focused tests pass: 31 shared tests (sharing and renewal) and 22 mobile seam tests.

The panel has no open code findings. Before merge it still needs the before/after captures, the tester's re-run and green J5 CI.

Jacksondr5 and others added 6 commits October 31, 2026 21:34
… change

Mobile now asks the name question when a pairing link names no person, or
when the first owner has no name (People and access AC5, AC6), and renews a
saved server's session when J5 ends it for a change of level (AC17), as web
does. The name-question rule moves into client-runtime so both clients share it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream's notice reads a Viewer's renewed one-permission session as legacy and
told the person to pair again. Mobile now skips it for a connection J5 places as
a person, as web does (case 73); the rule moves into client-runtime.

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

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

This branch was successfully deployed

1 active deployment
Preview — 8e9c9b1e 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