Skip to content

feat(mobile): a Captain's Crew and spawned agents move into the thread's Agents sheet - #1016

Merged
Jacksondr5 merged 3 commits into
j5/mainfrom
j5code/mobile-crew-in-agents-sheet
Nov 11, 2026
Merged

Jacksondr5 merged 3 commits into
j5/mainfrom
j5code/mobile-crew-in-agents-sheet

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Problem

At Checkpoint 4, Jackson found the "› N seats" count on a Captain's row in mobile Chats too small to be useful. Closes #1009.

What changed

  • The count and the seats under Chats rows are gone. thread-list-v2-items.tsx is back to upstream's bytes, apart from the persona chip. Members still stay off the top level of Chats, and pinned members stay at the top (register D22, unchanged).

  • The Agents sheet lists the thread's spawned agents. Upstream's in-thread sheet (ThreadAgentsSheet) now shows them above its provider subagents:

    • one block per Crew: its name and summary, plus Stop crew while a seat runs, for people who can operate;
    • one Peer Agents block for agents spawned outside a Crew.

    Rows follow upstream's agent-row look (status dot, title · status, chevron). Status reads Working, Needs you or Failed, otherwise Not started, Replaced by …, Completed, Interrupted or Idle. Tapping a row opens the member through upstream's own openChildThread. Upstream's "No agents in this turn." shows only when both lists are empty.

  • The Agents pill counts them. Live = provider subagents working + spawned agents with an active turn; total = both lists. While anything works it reads live/total, otherwise "N agents". A Captain with an idle Crew keeps the pill between turns, where upstream alone would hide it.

  • Data: the spawned-children read mobile already keeps for D22, now also read for the open thread, on open and whenever a crew or fleet revision moves. The pill counts come from a per-thread atom that changes only when a count does. The pill counts and row statuses (j5AgentsPillSegment, crewAgentStatus) are pure functions in client-runtime, with tests.

UI changes

Android, head e0c3d61e24 against trunk bed54fa2fc; same data and light theme.

State Before After
Chats: the Captain's count is gone, and a pinned member stays at the top Chats with the Captain count and pinned reserve, before Chats without the Captain count, pinned reserve retained, after
An idle Captain with an older provider-subagent turn: the pill now counts all six agents Idle Captain with an older provider-subagent turn and no Agents pill, before Idle Captain showing six combined agents, after
A plain thread still has no Agents pill Plain thread with no spawned agents or provider subagents, before Plain thread with no Agents pill, after

New states (after only):

State Screenshot
The pill while one of six agents works Captain showing one live agent out of six, after
The sheet: a Crew, Not started, a replaced Peer Agent, and an older provider subagent Agents sheet with Crew, Not started, replaced Peer Agent and older provider subagent, after
A working seat with Stop crew Agents sheet with a working seat and Stop crew, after
After Stop crew: the seat is interrupted and the button is gone Agents sheet after Stop crew, seat interrupted and button removed, after
A row opens the member's thread, which shows no pill Member thread opened from its Agents row, with no Agents pill, after
A Crew of two not-started seats, before archiving it Agents sheet with two not-started seats before archiving its Crew, after
After the Crew is archived, the sheet shows upstream's empty text Agents sheet showing No agents in this turn after Crew archive, after

Stop crew interrupts the running seat and the button disappears:

stop-crew-e0c3-published.mp4

Live testing

Android: pass at e0c3d61e24 against bed54fa2fc, run by the Android tester (Sol 6.1) with real Claude Haiku 5.5 turns. Report: project artifact test-reports/pr-1016/e0c3d61e24.md.

  • Pill: 1/6 while a seat runs; "6 agents" when idle, counting an older turn's provider subagent alongside the Crew.
  • Stop crew: interrupts the running seat, and the button disappears.
  • Rows: a row opens the member's thread. The member's thread and a plain thread show no pill.
  • Archive: archiving a Crew turns its open sheet to "No agents in this turn." (the archive was then restored).
  • Chats: no count; unpinned members stay hidden and a pinned member stays at the top.
  • Setup note: the old Captain's MCP session couldn't resume, so the tester started the running seat's turn directly in its existing thread. No replacement worker was created.

Not exercised: dark theme; iOS and iPad (iOS at Checkpoint 5); Stop crew as a Viewer or when denied; Failed and Needs you rows; seats the phone holds no thread for; several environments.

Upstream impact

FORK.md case 115, rewritten for the new shape:

The ledger rows and apps/mobile/src/j5/upstreamSeams.test.ts follow. floating-working-control.tsx is untouched; its hint "Opens this turn's subagents" stays upstream's (the Captain's call).

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior (j5AgentsPillSegment and crewAgentStatus cases in client-runtime)
  • UI changes: Android before/after pairs and new states above, with a Stop crew video
  • 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: J5 rows join upstream's sheet beside its own; upstream's subagent rows and pill are unchanged when a thread spawned no agents
  • Surfaces: mobile only (phone and iPad share the sheet; iPad opens a member in the inspector through upstream's handler); web unchanged; no contract change
  • Docs: personas.md's mobile Crews sentences change in the wave docs PR (wording sent to the Captain)

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

🤖 Generated with Claude Code

…d's Agents sheet

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

vercel Bot commented Nov 11, 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 11, 2026 10:18pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Pre-merge checks: Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Description check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…lists

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 panel review (reviewer-opus + reviewer-sol) at 8149b32

Verdict: three small should-fixes. The design is otherwise approved: the Agents sheet and pill with seats and Peer Agents, the Chats chip removed, D22 kept. Still pending: device evidence and J5 CI.

Should-fix 1: the pill can undercount the sheet (raised by reviewer-sol)

j5AgentsPillSegment (packages/client-runtime/src/j5/spawnedChildren.ts) counts turn.subagents only when upstream's segment is non-null. When the provider subagents are from an older, finished turn, upstream hides its pill. With an idle Crew, J5 revives the pill as "3 agents" while ThreadAgentsSheet still lists those 3 seats plus 2 provider rows. The new test encodes that mismatch. Fix: when there are spawned children, count the provider rows the sheet actually shows even if upstream would hide its segment. Leave the children.total === 0 passthrough as it is.

Should-fix 2: an empty Agents sheet with no empty text (found by both reviewers)

useHasJ5Agents returns children.length > 0 from the raw read. The sheet's rows come from selectSpawnedChildRows, which drops archived children and solo agents the client has no thread for. So when only those remain (for example, a Captain whose Crew was archived, whose seats are now archived children), the sheet renders no J5 rows and also suppresses upstream's "No agents in this turn." That's a blank sheet. Base it on the same visible count the pill uses (childCountsAtom's total) or on the selected rows.

Should-fix 3 (perf): upstream's ThreadDetailBody re-renders on every crew or fleet revision (reviewer-opus)

useThreadSpawnedChildren calls useAtomValue(threadReadConnectionsAtom) and useAtomValue(placementRevisionsAtom), and it runs inside useJ5AgentsPillSegment in upstream's ThreadDetailBody. So the whole thread body re-renders whenever any connected server's crew or fleet revision moves, which happens on every Exchange opened or closed, and on any connection-state change. That's the re-render childCountsAtom was built to avoid. Fix: drive the forced read from an imperative subscription (appAtomRegistry.subscribe inside the effect) so it doesn't re-render the body. Nit: re-read only when the open thread's own environment's revision moves.

Checked and fine

  • Chats row. thread-list-v2-items.tsx is back to upstream's file, apart from the persona chip, and the chip and seats under rows are gone. D22's filter (useCrewListedThreads) is unchanged, so members stay off the top level and pinned ones stay listed.
  • Sheet. Crew blocks show the summary and Stop crew, permission-gated as before. A Peer Agents block follows. Rows use upstream's agent-row look (SubagentStatusDot and its tone classes) and open through upstream's openChildThread. An unknown seat is listed but not opened.
  • Shared logic. crewAgentStatus puts "Replaced by" first, seats report how their last run ended, and a solo agent shows "Idle". It's pure and tested, along with j5AgentsPillSegment.
  • The builder's two questions. childCountsAtom keys on the child ids and returns a running/total string, so the body only re-renders when a count changes, apart from should-fix 3. The forced reads from several hooks coalesce in the store's pending set, so they don't duplicate requests.
  • Records. FORK.md case 115 is rewritten. ThreadAgentsSheet.tsx gets one mount plus the empty-text condition, and ThreadDetailScreen.tsx gets the segment wrap. The ledger rows and seams reaches are updated.

Reviewer-run checks

  • client-runtime spawnedChildren.test.ts and crewState.test.ts: 18 passed. Mobile reactCompilerCoverage.test.ts and upstreamSeams.test.ts: 1149 (reviewer-opus). reviewer-sol: 74 shared and seams tests plus 4 targeted compiler checks.
  • vp run typecheck: mobile and web exit 0
  • lint: clean on the changed logic; git diff --check: clean

Reviewed by Claude Opus 5.5 (reviewer-opus) and Sol 6.1 (reviewer-sol) in J5 Code.

…g on other servers' changes

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.

Panel delta check (reviewer-opus + reviewer-sol) at e0c3d61

Verdict: all three should-fixes are resolved, with no new findings, and the panel approves the source. Still pending: Android and iOS evidence and J5 CI.

  1. Pill count. When spawned children revive the pill, j5AgentsPillSegment now counts every subagent the sheet lists (turn.liveCount and turn.subagents.length whenever a turn exists). An older turn's 2 subagents plus 3 idle children read "5 agents", and the test expects that. The no-children passthrough to upstream's segment is unchanged.
  2. Empty sheet. The pill and useHasJ5Agents share useJ5AgentCounts, whose total comes from childCountsAtom, which uses the same rule as selectSpawnedChildRows. Archived-only or unknown-solo-only children no longer suppress upstream's "No agents in this turn."
  3. Re-renders. useThreadSpawnedChildren no longer reads the global connections or revisions atoms in render. Its effect subscribes imperatively (appAtomRegistry.subscribe) to the connections atom and to rereadOn("crew", "fleet") for the thread's own environment, force-reads that one thread, and disposes both subscriptions when the target changes or the screen unmounts. ThreadDetailBody now re-renders only when this thread's children or counts change.

Reviewer-run: client-runtime spawnedChildren.test.ts passes (10), mobile reactCompilerCoverage.test.ts and upstreamSeams.test.ts pass (1149), and mobile vp run typecheck exits 0 (reviewer-opus). reviewer-sol ran the focused regression plus 2 compiler checks. Lint and git diff --check are clean.

Reviewed by Claude Opus 5.5 (reviewer-opus) and Sol 6.1 (reviewer-sol) in J5 Code.

@github-actions github-actions Bot added size:XL 500-999 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Nov 11, 2026
@Jacksondr5
Jacksondr5 merged commit 91a62c6 into j5/main Nov 11, 2026
44 of 48 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/mobile-crew-in-agents-sheet branch November 11, 2026 23:04

This branch was successfully deployed

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

Labels

size:XL 500-999 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.

Mobile: a Captain's members and Peer Agents in upstream's Agents sheet; remove the Chats member chip

1 participant