Skip to content

feat(mobile): an Owner keeps or removes a Crew's kept worktrees from the Inbox - #1037

Merged
Jacksondr5 merged 2 commits into
j5/mainfrom
j5code/mobile-1013
Nov 14, 2026
Merged

Jacksondr5 merged 2 commits into
j5/mainfrom
j5code/mobile-1013

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Problem

On the phone, an Owner's worktree cleanup item was read-only (#991): it listed the worktrees a Crew's archive kept and sent the Owner to web or desktop to keep or remove them. Jackson chose the full flow on the phone. Closes #1013.

What changed

The mobile item now answers as web does (Inbox definition, Worktree cleanup):

  • Keep all clears the item and changes nothing.
  • Tap worktrees to pick them, or Select all, then Remove selected (n). A destructive confirmation says that removing discards uncommitted changes and keeps the branches.
  • The item then shows what was removed, kept, skipped or failed, with the reason under each skipped or failed worktree. Decided cleanups join the Answered shelf as a one-line count, as on web. A refused second answer shows the server's "already answered" message on the decided item.

It's Owner-only through the existing answerCrewWorktreeCleanup command and its permission atom. A session that can't answer sees web's "only an Owner of this server can answer" line, with the actions disabled. No server change. There's no Menu and no new modal, so Android's Menu-behind-Modal problem doesn't arise; the confirmation is the platform alert.

Which items stay in place after an answer (placeWorktreeCleanups) moves from web's hook into client-runtime, so both clients share it, with a test. Web's behaviour is unchanged.

Docs (for the wave docs PR)

  • docs/j5/product/features/inbox.md line 38: replace "An Owner's worktree cleanups are listed read-only there and finished on web or desktop." with "An Owner answers worktree cleanups there as on web: keep all, or pick worktrees and remove them after a confirmation, then see what was removed, kept, skipped or failed."
  • inbox.md History: "- — the mobile Inbox answers an Owner's worktree cleanups as web does: keep all, or remove the picked worktrees after a confirmation, with the result in place (Jackson, #1013)."
  • docs/j5/user/personas.md line 123: replace "On the mobile app the item is read-only: finish it on web or desktop." with "On the mobile app, removing asks you to confirm first."

UI changes

iOS

A one-worktree cleanup, expanded:

iOS before iOS after
A one-worktree cleanup, expanded, iOS before A one-worktree cleanup, expanded, iOS after

A two-worktree cleanup, expanded:

iOS before iOS after
A two-worktree cleanup, expanded, iOS before A two-worktree cleanup, expanded, iOS after

Worktrees picked:

Worktrees picked, iOS after

The confirmation before removing:

The confirmation before removing, iOS after

After Keep all, kept in place:

After Keep all, kept in place, iOS after

After Remove selected: one removed, one skipped as changed:

After Remove selected: one removed, one skipped as changed, iOS after

Both answered cleanups on the Answered shelf:

Both answered cleanups on the Answered shelf, iOS after

A Viewer session: no access to the server's Inbox items:

A Viewer session: no access to the server's Inbox items, iOS after

A Collaborator session: no cleanup item:

A Collaborator session: no cleanup item, iOS after

iOS after (played at 2× speed): Keep all, picking, Cancel then Remove, the results, and the Answered shelf:

ios-cleanup-owner-flow-2x-after.mp4

Android

The Inbox with the filed cleanup:

Android before Android after
The Inbox with the filed cleanup, Android before The Inbox with the filed cleanup, Android after

The cleanup expanded, with its actions:

Android before Android after
The cleanup expanded, with its actions, Android before The cleanup expanded, with its actions, Android after

All three worktrees picked, with Select all disabled:

All three worktrees picked, with Select all disabled, Android after

The confirmation before removing:

The confirmation before removing, Android after

Cancel keeps the two picked rows:

Cancel keeps the two picked rows, Android after

One removed, one kept and one skipped, in place:

One removed, one kept and one skipped, in place, Android after

The mixed result on the Answered shelf after reopening the Inbox:

The mixed result on the Answered shelf after reopening the Inbox, Android after

A Viewer session's Inbox, with no cleanup:

A Viewer session's Inbox, with no cleanup, Android after

Live testing

iOS: PASS at db9e1d631d against base 2d3250db7c (crew tester, report test-reports/pr-1037/ios-db9e1d631d.md). Real Haiku Crew archives filed the cleanups.

  • Rows pick and unpick, and Select all works. Keep all cleared its item with the worktree kept.
  • Remove selected asks for confirmation with the platform's destructive alert, which warns about uncommitted changes and kept branches. Cancel kept the selection.
  • Confirming gave "1 removed · 1 skipped" with "Changed since this was filed" on the worktree changed after filing. On disk, the removed path is gone, the skipped one remains, and every branch is kept.
  • Both answered cleanups join Answered after leaving and returning to the Inbox.
  • A Viewer session can't open the server's Inbox items, and a Collaborator sees no cleanup item, so neither can answer.

Not exercised on iOS: a failed removal, the already-answered refusal, and a failed read of answered cleanups. These need a forced failure or a second device in a race. The "only an Owner can answer" line wasn't reachable with normal grants either: non-Owners don't get the item at all.

Android: PASS at db9e1d631d against base 2d3250db7c (crew tester, report test-reports/pr-1037/db9e1d631d.md, stills only because recording is broken, #1034). A real Haiku Captain with three Haiku workers, each leaving an uncommitted file in its J5 worktree. The archive filed all three, and one file was changed after filing.

  • Select all picks everything and then disables itself; tapping a row unpicks it.
  • Remove selected (2) shows the destructive warning. Cancel keeps the selection.
  • Confirming gives exactly Removed, Kept "Not picked", and Skipped "Changed since this was filed". On disk, the removed directory is gone, its branch is kept, and the other worktrees and files are intact.
  • Leaving and reopening the Inbox puts "1 removed · 1 kept · 1 skipped" on the Answered shelf.
  • A Viewer session sees no cleanup.

Not exercised on Android: a second Keep all item (Keep all passed on iOS), the already-answered race, a forced failure to read answered cleanups, dark theme, and offline.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior: placeWorktreeCleanups (client-runtime)
  • UI changes: before/after above, and a video for motion or interaction
  • Live testing: the section above says what ran live and what did not
  • Upstream-owned files: none
  • Upstream product: no change
  • Surfaces: mobile (iOS and Android); web already answers, and its hook now uses the shared helper; Owner-only on both
  • Docs: lines above, for the wave docs PR

Claude Opus 5.5 in J5 Code (Claude Code harness).

🤖 Generated with Claude Code

…the Inbox

The phone listed a worktree cleanup read-only and sent the Owner to web
or desktop. It now answers it as web does: Keep all, or pick worktrees
(or Select all) and Remove selected after a confirmation that says
uncommitted changes are discarded and branches kept. The item then shows
what was removed, kept, skipped or failed, and decided cleanups join the
Answered shelf.

Which items stay in place after an answer moves from web's hook into
client-runtime, so both clients share it and it has a test.

Closes #1013

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Nov 14, 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 14, 2026 5:24pm UTC

Request Review

@github-actions github-actions Bot added vouch:trusted 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 14, 2026
@Jacksondr5

Copy link
Copy Markdown
Owner Author

Panel review: reviewer-opus and reviewer-sol, at 0920329

Verdict: approve once one small fix lands.

Should fix

Decided cleanups are missing from the Inbox notices (apps/mobile/src/j5/inbox/InboxScreen.tsx, the notices list).

  • The list collects source notices from open asks, answered asks, crew requests and open cleanups. It leaves out the new decidedWorktreeCleanupSourcesAtom.
  • When the decided read fails, the screen says nothing:
    • The Answered shelf loses its cleanups without a word.
    • A refused second answer is held back (its value is null) until the decided read arrives. With that read failed, the item and its "already answered" error both disappear.
  • The same gap hides a failed reread after an answer. readWorktreeCleanupSources returns its Failures, and answer ignores them. Web shows "The inbox could not be refreshed. The list may be stale." in that case. On mobile, the failed source would show its notice once it is in this list.
  • Fix: add decidedCleanupSources.sources to notices, next to cleanupSources.sources. One line.

Checked and fine

  • placeWorktreeCleanups matches web. It is web's old placement logic unchanged, including the single pendingKey, and its test covers placement in place, the shelf, and a refused answer.
  • Owner-only: the actions are gated on answerCrewWorktreeCleanup.permissionAtom and sourceReady. The unavailable line shows otherwise.
  • Selection and confirm:
    • Nothing is picked at first.
    • Keep all sends [].
    • Remove selected goes through a destructive Dialog.confirm, and the paths are read before the dialog opens.
  • Result in place: the item keeps its key, so it stays expanded and switches to the result after the answer.
  • Rereads after an answer: open cleanups, decided cleanups and the bell count, for that server only.
  • Scope: J5-owned files only. No server, contract or upstream edit, so FORK.md and the seams test need no change.
  • Layout: no Menu or Modal. Sizes use icon size props, not rem-scaled height classes.

Left as is

The Remove button says "Removing…" while Keep all is pending. Web says the same, so mobile follows web.

Checks run on the PR head

  • git diff --check: clean.
  • client-runtime crewWorktreeCleanup.test.ts: 12 passed.
  • Web src/j5/a2a: 59 passed.
  • Mobile reactCompilerCoverage and upstreamSeams: 1149 passed.
  • Typecheck of mobile, web and client-runtime: clean.
  • Lint: clean.

The tester's device pass is still to come.

— Claude Opus 5.5 (reviewer-opus) and GPT 6.1 Sol (reviewer-sol), J5 Code

@Jacksondr5

Copy link
Copy Markdown
Owner Author

Panel re-check at db9e1d6: approved. The one should-fix is resolved. The decided cleanup sources now feed the Inbox notices, so a failed read or reread shows its notice. The delta is only those two lines. Mobile typecheck is clean and git diff --check is clean.

— Claude Opus 5.5 (reviewer-opus) for the panel with GPT 6.1 Sol (reviewer-sol), J5 Code

This branch was successfully deployed

1 active deployment
Preview — db9e1d63 Deployed Nov 14, 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 Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile: act on a worktree cleanup from the phone

1 participant