Skip to content

feat(mobile): offer new threads, forks and projects only where J5 allows them - #852

Merged
Jacksondr5 merged 1 commit into
j5/mainfrom
j5code/mobile-start-access
Nov 1, 2026
Merged

Jacksondr5 merged 1 commit into
j5/mainfrom
j5code/mobile-start-access

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Problem

On mobile, a thread-only Collaborator or a Viewer is offered New thread, Fork and Add project. The server then refuses them: "COULD NOT START TASK / This is not shared with you on this server." Web stopped offering these in #640/#641. Part of #831 (gap P6).

What changed

Mobile asks the person's level before offering a start, as web does. It uses the shared sharingAllowsStart rule (AC14, AC19) through J5-owned apps/mobile/src/j5/sharing/startAccess.ts:

  • New thread doors. Every New thread door (FAB, header, keyboard command) goes through handleStartNewTask. It, and the new-task flow's fresh default, now start from the projects the person may start a thread in, so a new task never lands in a project they can't start in. An explicit or stamped selection (a prompt link, a PR-thread draft, a draft saved before a level was lowered) still resolves against every project. It opens on its own project, read-only, and its text never moves to another project.
  • New thread picker. Lists only projects the person may start a thread in: a Collaborator's or Owner's level over the project or the server. When the server reports projects but none qualify, it says "Nothing to start a thread in: You can write only in the threads shared with you. To start one, ask an Owner to share a project with you." instead of upstream's "No projects found".
  • Send in a new thread. canOperate and handleStart's guard need that level as well as upstream's "Operate tasks". This covers a draft opened by a link or a share for a project the person can't start in.
  • Fork from a response. Hidden unless the person may start a thread in the thread's project. A level on the thread alone doesn't reach.
  • Add project and New project. Need a Collaborator's or Owner's level at server scope, as well as "Operate tasks": the local-folder, clone and New project rows, and the New project screen's Create button and submit guard.

Before a server has answered, nothing is withheld, and the server stays authoritative.

Sequencing: #846 (#834), now merged, also edits NewTaskDraftScreen.tsx on other lines. This PR rebases onto trunk after #843, #844 and #848 merge, in the Captain's order.

UI changes

Android, same isolated home and device, base 31447c91c6 vs head aaf844f899:

State Before After
Thread-only Collaborator presses New thread Thread-only Collaborator choosing a project, before Thread-only Collaborator choosing a project, after
Thread-only Collaborator reads Haiku responses (Fork) Thread-only Collaborator viewing responses with Fork, before Thread-only Collaborator viewing responses without Fork, after
A draft saved before the person was narrowed to one thread Restricted Collaborator reopening a saved draft, before Restricted Collaborator reopening a saved draft, after
Whole-server Viewer opens Add project (unchanged regression check) Viewer adding a project, before Viewer adding a project, after
Before: the start the server refused Thread-only Collaborator's start refused by the server, before removed
Project Collaborator's picker new Project Collaborator's picker lists the granted project, after
Project Collaborator starts a real turn new Project Collaborator's started thread with a Haiku reply, after
The same saved draft for a Collaborator on its project new Saved draft with Send enabled for a project Collaborator, after
Owner restored new Owner's saved draft with Send restored, after

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

Live testing

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

  • Thread-only Collaborator: on base, the project was offered and Send was enabled, then the server refused: "This is not shared with you on this server." On head, the picker says "Nothing to start a thread in", and Fork is gone from their thread's responses.
  • Project Collaborator: sees the granted project and starts a real Haiku turn; Fork stays for that project.
  • Saved draft: a draft saved as a project Collaborator was reopened after the device switched to a thread-only Collaborator. It keeps its project and text, with Send disabled. On base, Send stayed enabled. An Owner gets Send back.
  • Whole-server Viewer: Add project stays disabled. That was already so on base, because a Viewer lacks "Operate tasks". The new check matters for Collaborators who have "Operate tasks" but no server-scope level; it is covered by the seams test and by A Viewer isn't offered upstream controls they can't use #640/A thread-scope Collaborator isn't offered New thread or Fork #641's shared rule.
  • 129 focused tests passed at the head.

Not exercised:

The incoming-share "load failed" dialog seen once at launch is the known #837 and is unrelated.

Upstream impact

FORK.md case 90 (web's start doors follow the level, Jackson's 2026-10-25 approval of one J5 check beside each upstream check). Its "Mobile is not covered" sentence is replaced by the mobile wiring, with each edit one import and one or two lines:

  • apps/mobile/src/features/threads/new-task-flow-provider.tsx: startableProjects = useStartableProjects(projects) feeds the picker's scopes, the fresh default server and project, and the servers offered when switching. Explicit selections resolve against upstream's full list.
  • apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx and ThreadRouteScreen.tsx's unavailable-thread redirect: newTaskDestination gets the startable projects.
  • apps/mobile/src/features/threads/NewTaskRouteScreen.tsx: noStartableProjectState(...) ?? deriveProjectEmptyState(...).
  • apps/mobile/src/features/threads/NewTaskDraftScreen.tsx: useCanStartTaskIn and readCanStartTaskIn in place of the bare "Operate tasks" reads.
  • apps/mobile/src/features/threads/ThreadFeed.tsx: AssistantForkButton also asks useCanForkThread. builder-timeline (feat(mobile): agents' messages read as letters, not envelopes #843) confirmed its edits don't touch this.
  • apps/mobile/src/features/projects/AddProjectScreen.tsx: three canCreateProject reads use useCanAddProject. The New project row is disabled on it, and AddProjectNewScreen gates Create and submit.
  • Tests: AddProjectScreen.test.ts and src/lib/filePreview.test.ts mock startAccess.

All of these are in upstreamSeams.test.ts and FORK.md's file index.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior: the shared rule is tested in client-runtime, and the seams are pinned
  • UI changes: Android before/after screenshots above (iOS deferred to Checkpoint 1). No motion.
  • 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 new divergence; case 90's decision already covers it
  • Surfaces: New thread (FAB, palette, share and link all land in the same picker and draft), Fork, and Add project. A project create from the picker goes through Add project. Before an answer, nothing is withheld.
  • Docs: Mobile: identity and access (claim a person, session renewal, refused actions, Owner-only Settings) #831's doc changes come in one separate docs PR, per the Captain

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 3:01am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 12 billable files and costs up to $3.00.

  • 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 3 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 54 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 a52613e and e830b51.

Files selected for processing: 12
  • FORK.md
  • apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
  • apps/mobile/src/features/projects/AddProjectScreen.test.ts
  • apps/mobile/src/features/projects/AddProjectScreen.tsx
  • apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
  • apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
  • apps/mobile/src/features/threads/ThreadFeed.tsx
  • apps/mobile/src/features/threads/ThreadRouteScreen.tsx
  • apps/mobile/src/features/threads/new-task-flow-provider.tsx
  • apps/mobile/src/j5/sharing/startAccess.ts
  • apps/mobile/src/j5/upstreamSeams.test.ts
  • apps/mobile/src/lib/filePreview.test.ts
  • 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 5de6a19

Both of us reviewed the PR independently and checked each finding against the source. The shared policy is right. Two of the doors still offer what the server refuses.

Blocking

  1. The main New thread door still opens a draft on a project the person can't start in (found by reviewer-opus, confirmed by reviewer-sol). Every New thread door goes through AdaptiveWorkspaceLayout.handleStartNewTask (AdaptiveWorkspaceLayout.tsx:515): the header button, the toolbar, the iOS and Android tab and sidebar buttons, and the newTask key command. It calls newTaskDestination(…, projects, currentProject, …) (:543) with every project from useProjects() (:511). newTaskDestination (new-task-project-selection.ts:112) then picks the current thread's project, else projects[0].

    • So a thread-scope Collaborator who taps New thread from their shared thread lands straight on a draft in that thread's project. useCanStartTaskIn is false there, so the composer shows its read-only notice (ThreadComposer.tsx:1205).
    • They never see the startable-only picker or its new empty state.
    • new-task-flow-provider.tsx:226–254 has the same problem: selectedEnvironmentId and selectedProject default from every project, not startableProjects.

    Web keeps this door closed: useCanStartInAny hides it, and chatThreadActions.ts:90 checks readCanStartThreadIn. Fix: pass useStartableProjects(projects) to newTaskDestination in AdaptiveWorkspaceLayout (one seam), and default the flow provider's selection from startableProjects. With nothing startable, the draft has no project, falls through to NewTaskProject, and shows "Nothing to start a thread in".

  2. New project (a fresh repository) skips the Add-project gate (found by reviewer-sol, confirmed by reviewer-opus). The PR gates the local-folder and clone paths with useCanAddProject, but not this one:

    • AddProjectSourceScreen's "New project" row (AddProjectScreen.tsx:589) is disabled only on !isConnected.
    • AddProjectNewScreen (:983 on) never calls useCanAddProject, and its Create button (:1189) checks only submitting and an empty name before projectEnvironment.createNew (:1063).

    A Collaborator narrowed to a project or a thread receives the full server config, newProjectsRoot included, so they can open New project and submit a create that the server refuses (AC19). Fix: add !canCreateProject to that row's disabled, and gate AddProjectNewScreen the way AddProjectLocalFolderScreen is gated. Record both in case 90 and the seam test.

Checked and fine

  • Shared policy. sharingAllowsStart is used as on web: the project's level for a new thread or fork (AC14), and a server-scope level for Add project (AC19).

  • Send. readCanStartTaskIn guards the send outside render.

  • Fork. It reads the project of the shell's sourceThreadId.

  • Picker. The empty state shows only when the server reports projects but none can be started in.

  • Tests. Both test mocks (AddProjectScreen.test.ts, filePreview.test.ts) are recorded. reviewer-sol checked direct assertions for each case:

    • a project-scope Collaborator, a thread-scope Collaborator and a server-scope Collaborator;
    • a server Viewer;
    • mixed access (Collaborator on A, Viewer on B);
    • a server that hasn't answered yet, and an unknown device.

    149 focused tests pass: 22 shared and 127 mobile.

Not yet done (merge gates, not code findings)

  • Before and after captures for a narrowed Collaborator on Android and iOS, the tester's run, J5 CI, and the rebase onto #846.

@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 37a6b7d

Fixed

  • New project. The row is disabled on !canCreateProject, and AddProjectNewScreen gates both Create and submit with useCanAddProject.
  • New thread doors. AdaptiveWorkspaceLayout and UnavailableThreadDraftRedirect build their destination from useStartableProjects, and the flow provider's picker and fresh default use only startable projects.

Blocking (new in this push)

  1. A draft stamped with a project the person can't start in now opens on, and can send to, a different project. We both found this independently.

    • openDraft now checks the stamp against allProjects (new-task-flow-provider.tsx:558) and sets the stamp's environment and project key. But selectedEnvironmentId (:229–233), projectsForEnvironment and selectedProject (:247–257) are still resolved from the startable projects.
    • Say the draft is stamped with project A, which the person can't start in (they're a Viewer there, or hold only a thread). If A's server has no startable project, selectedEnvironmentId falls to projects[0]'s server. If it has one, B, selectedProject can't find A by key and falls back to B.
    • activeDraftKey is still A's draft, with its text. handleStart (NewTaskDraftScreen.tsx:789) reads flow.selectedProject, which is B, passes readCanStartTaskIn for B, and starts the thread in B.
    • So the PR description's claim that "a draft already stamped with another project opens read-only" doesn't hold.
    • This is reachable through a prompt link (usePromptLinkResolver.ts:160 creates a draft for the linked project), a PR thread draft (usePullRequestThreads.ts:104), or a draft saved before the person's level was lowered.

    Fix: resolve an explicit selection against allProjects, and take only the fallback from the startable list. For example: the override is valid when allProjects has that server; selectedProject is allProjects.find(key) ?? startableForEnvironment[0] ?? null. A stamped draft then keeps A, and useCanStartTaskIn shows it read-only, as intended. Fresh defaults and the picker stay startable-only.

The panel has no other findings. Before merge it still needs the before/after captures, the tester's run, J5 CI and the rebase onto #846.

@github-actions github-actions Bot added the size:L 100-499 effective changed lines (test files excluded in mixed PRs). 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 aaf844f

Fixed. new-task-flow-provider resolves an explicit or stamped selection against all of useProjects(): the server override, the project key and openDraft's load check. startableProjects supplies only the picker's scopes, the fresh default server and project, selectEnvironment's match and the repository-host list. So a draft stamped with a project the person can't start in stays on that project, its composer is read-only and handleStart refuses it. Its text never moves to another project. The case 90 text and the seam row are updated.

The panel has no open code findings. The focused tests pass: AddProjectScreen, the seam test and new-task-project-selection (3 files, 49 tests).

Before merge it still needs the before/after captures for a narrowed Collaborator (Android and iOS), the tester's run, green J5 CI and the rebase onto #846.

@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 e596bbf (rebased onto trunk with #846, #848 and #859)

We both checked the rebase.

  • Code. The code changes outside the seam test are line-for-line identical to the reviewed aaf844f. The overlap with #846 in NewTaskDraftScreen.tsx resolved with no change to either side.
  • Imports and mocks. The artifact, sharing and start-access imports coexist, and all three filePreview.test.ts mocks are kept.
  • FORK.md and seams. The seam groups (21, 72, 90, 98, 99) are all kept, and the file-index rows are right: ThreadRouteScreen 69, 90, 99, new-task-flow-provider 45, 90.
  • Selection. Explicit and stamped drafts still resolve against all projects, and fresh defaults still come only from startable projects.
  • Docs. There are no docs changes.

193 focused tests pass (158 mobile, 35 shared). There are no new findings; the panel has no open code findings.

Before merge it still needs the captures, the tester's verdict and green J5 CI.

…ows them

A thread-only Collaborator or a Viewer was offered New thread, Fork and Add
project, which the server then refused (#831, gap P6). Mobile now asks the
person's level, as web does since #640/#641: every New thread door and the
picker start from projects they may start a thread in (an explicit or stamped
draft still opens on its own project, read-only), the picker says so when there
are none, Send and Add/New project need a Collaborator's level over the project
or the server, and a fork asks the thread's project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jacksondr5
Jacksondr5 force-pushed the j5code/mobile-start-access branch from e596bbf to e830b51 Compare November 1, 2026 03:00

@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 e830b51 (rebased onto #861)

We both checked the rebase.

  • Code. The code changes outside the seam test are still line-for-line identical to the reviewed patch.
  • FORK.md. The tail of case 90 matches trunk byte for byte.
  • Docs. There are no docs changes.

55 focused mobile tests pass. There are no new findings; the panel has no open code findings.

@Jacksondr5
Jacksondr5 merged commit e3b06c5 into j5/main Nov 1, 2026
32 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/mobile-start-access branch November 1, 2026 03:15

This branch was successfully deployed

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