You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): list agents from computers whose workspace list is over 4 MB - #52681
On a computer with thousands of workspaces, the phone's Agents tab said "No computer connected" and listed no agents, even while the phone was connected. The computer's workspace list was too big to send in one reply, so the phone got an error back. The phone can now download a reply that big in pieces.
Files
Added
Deleted
Net
Test
1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$125
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$125
Prod
6
$\color{#1a7f37}{\Huge{\mathbf{+}}}$88
$\color{#cf222e}{\Huge{\mathbf{−}}}$5
$\color{#1a7f37}{\Huge{\mathbf{+}}}$83
What Changed
Before: the computer answers the phone's worktree.ps with reply_too_large when the list is over 4 MB. Home's per-computer read fails on every attempt, the computer counts as having no readable list, and the Agents tab shows "No computer connected" (Home cards and workspace lists hit the same failure).
After: the phone advertises rpc.staged-reply.v1. The computer then holds the oversize reply and answers reply_staged. The phone's logical RPC client reads it back with rpc.readStagedReply, in 1 Mi-character parts, on the session that answered. This is the mechanism the desktop CLI already uses for paired servers.
The shared staged-reply reader takes two optional settings:
parse: the CLI's JSON structure budget (256K tokens) rejects a catalog this size, while the phone already parses one-frame replies without that budget.
maxLength: the phone caps the joined reply at 32 Mi characters and answers reply_too_large beyond that, so a huge reply can't run it out of memory.
reply_too_large moves to the shared staged-reply constants, so the desktop and the reader use the same code.
Why
The list really is that big: each workspace row and its agents are needed, and nothing in it is archived. Trimming fields or truncating rows would drop agents. Staged replies already exist on the desktop for exactly this case. Only the first read on a connection is a full one. After that, Home asks for row deltas against the catalog it holds, which stay small.
Linked Issue
N/A (internal report)
Visual Proof
N/A: no UI change. The tab's existing empty-state rules are unchanged; it now gets the list it was missing.
Testing
mobile/src/transport/rpc/rpc-staged-reply-read.test.ts runs a 4,000-workspace catalog (over 4 MB and over the CLI token budget) through the real logical client and the real Home catalog read, against a host fake that applies the desktop's reply rule. It fails on main with worktree catalog read failed: reply_too_large. It also fails if only the parser option is removed (invalid staged reply).
One-off check with the same seeded catalog through Home's list projection: on main the catalog is unavailable and the Agents tab takes the "No computer connected" branch. With the fix, all 24,000 agents are listed.
The existing desktop staged-reply and request-custody tests pass. pnpm check:changed passes, and so do the mobile app and test typechecks.
Not done: no run on a physical phone against a real large desktop.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
Only replies over 4 MB behave differently. Before, they failed after the computer had already built and serialized them. On a large computer:
The phone's first catalog read on a connection now downloads the list in about 1 Mi-character parts, read one after another.
The phone holds the joined text once and parses it once (capped at 32 Mi characters).
The computer holds that reply until its last part is read. Its existing limits apply: 64 MiB per reply, 128 MiB in total, dropped after 60 s idle.
Later polls are snapshot deltas, so they are smaller than the failing full replies they replace.
All other replies pass through unchanged.
Risk
Level: Low
Older computers that don't know the capability ignore it and keep answering reply_too_large.
A computer relaying the phone to a paired server forwards the phone's capabilities. Such a server may now stage an oversize reply, and the phone then fails reading its parts (not_found) instead of getting reply_too_large. That case failed before this change too.
Back out with a plain revert.
AI Disclosure
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
A desktop with thousands of workspaces answers the phone's worktree.ps with
more than one 4 MB reply carries, so it sent reply_too_large. Home's counts
read failed every time, its desktop looked unreadable, and the Agents tab
showed "No computer connected" while the phone was connected.
The phone now advertises rpc.staged-reply.v1 and its logical client reads a
reply_staged answer back in parts on the session that answered, as the
desktop CLI already does. The shared reader takes a parser (the phone parses
one-frame replies without the CLI's structure budget, which a large catalog
exceeds) and a length cap (32 Mi characters on the phone). Later reads stay
row deltas against the catalog the first read delivered.
No actionable comments were generated in the recent review.
Walkthrough
The shared RPC code now defines the oversized-reply error and allows staged replies to use optional parsing and length limits. The mobile runtime advertises staged-reply support and reads staged reply parts from the session that returned the response. Tests cover reading a large worktree catalog and rejecting a staged reply above the mobile character cap.
Merge Risk: Low · up to 64ac4
Large workspace catalogs can now load on the mobile Agents tab over staged replies. In some timing cases a multi-part read can run somewhat longer than the caller's timeout before failing. This is a bounded, low-impact edge case that does not block merging.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the mobile Agents tab now lists agents from computers whose workspace list exceeds 4 MB. It uses the fix(mobile) prefix and matches the staged-reply mechanism in the d…
Description check
The description follows the repository template and covers ELI5, What Changed, Why, Visual Proof (N/A with reason), Testing, Performance, Risk with level and rollback, and the checklist. The Linked Is…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the mobile Agents tab now lists agents from computers whose workspace list exceeds 4 MB. It uses the fix(mobile) prefix and matches the staged-reply mechanism in the diff, which lets the phone read oversized replies in parts.
Full details: Description check
Explanation
The description follows the repository template and covers ELI5, What Changed, Why, Visual Proof (N/A with reason), Testing, Performance, Risk with level and rollback, and the checklist. The Linked Issue section says N/A (internal report) rather than linking an issue, and the AI Disclosure and Review sections are empty. The template is for a repository where outside contributors must link an issue, so the missing link is a gap, but the author describes the report as internal. The Performance section is filled in and the Testing section lists what was run and what was not.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On a computer with thousands of workspaces, the phone's Agents tab said "No computer connected" and listed no agents, even while the phone was connected. The computer's workspace list was too big to send in one reply, so the phone got an error back. The phone can now download a reply that big in pieces.
What Changed
worktree.pswithreply_too_largewhen the list is over 4 MB. Home's per-computer read fails on every attempt, the computer counts as having no readable list, and the Agents tab shows "No computer connected" (Home cards and workspace lists hit the same failure).rpc.staged-reply.v1. The computer then holds the oversize reply and answersreply_staged. The phone's logical RPC client reads it back withrpc.readStagedReply, in 1 Mi-character parts, on the session that answered. This is the mechanism the desktop CLI already uses for paired servers.parse: the CLI's JSON structure budget (256K tokens) rejects a catalog this size, while the phone already parses one-frame replies without that budget.maxLength: the phone caps the joined reply at 32 Mi characters and answersreply_too_largebeyond that, so a huge reply can't run it out of memory.reply_too_largemoves to the shared staged-reply constants, so the desktop and the reader use the same code.Why
The list really is that big: each workspace row and its agents are needed, and nothing in it is archived. Trimming fields or truncating rows would drop agents. Staged replies already exist on the desktop for exactly this case. Only the first read on a connection is a full one. After that, Home asks for row deltas against the catalog it holds, which stay small.
Linked Issue
N/A (internal report)
Visual Proof
N/A: no UI change. The tab's existing empty-state rules are unchanged; it now gets the list it was missing.
Testing
mobile/src/transport/rpc/rpc-staged-reply-read.test.tsruns a 4,000-workspace catalog (over 4 MB and over the CLI token budget) through the real logical client and the real Home catalog read, against a host fake that applies the desktop's reply rule. It fails on main withworktree catalog read failed: reply_too_large. It also fails if only the parser option is removed (invalid staged reply).One-off check with the same seeded catalog through Home's list projection: on main the catalog is unavailable and the Agents tab takes the "No computer connected" branch. With the fix, all 24,000 agents are listed.
The existing desktop staged-reply and request-custody tests pass.
pnpm check:changedpasses, and so do the mobile app and test typechecks.Not done: no run on a physical phone against a real large desktop.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
Only replies over 4 MB behave differently. Before, they failed after the computer had already built and serialized them. On a large computer:
All other replies pass through unchanged.
Risk
Level: Low
reply_too_large.not_found) instead of gettingreply_too_large. That case failed before this change too.AI Disclosure
Review
Agent skill upstream boundary
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)