Skip to content

fix(mobile): list agents from computers whose workspace list is over 4 MB - #52681

Merged
AmethystLiang merged 3 commits into
mainfrom
AmethystLiang/mobile-agents-p0
Nov 29, 2026
Merged

AmethystLiang merged 3 commits into
mainfrom
AmethystLiang/mobile-agents-p0

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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.

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.
@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; no new blocking issue was found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

The phone can fetch large replies in parts, allowing large workspace catalogs to reach Home and the Agents tab.

  • Phones can load workspace catalogs larger than one reply.

Reviews (4) · Last reviewed commit: "fix(mobile): read staged parts within on..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 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.
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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6f7d2c83-14cf-4e4d-bd6a-df8003264c76
Commits

Reviewing files that changed from the base of the PR and between b8de11a and 64ac4ea.

Files selected for processing: 2

  • mobile/src/transport/rpc/rpc-staged-reply-read.test.ts
  • mobile/src/transport/rpc/rpc-staged-reply-read.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 62841c22-558c-4127-9ca4-b1e9b5a8ab52
Commits

Reviewing files that changed from the base of the PR and between 93af120 and 4b26b4a.

Files selected for processing: 7

  • mobile/src/transport/connection/mobile-runtime-client-capabilities.ts
  • mobile/src/transport/connection/stable-logical-rpc-client.ts
  • mobile/src/transport/rpc/rpc-staged-reply-read.test.ts
  • mobile/src/transport/rpc/rpc-staged-reply-read.ts
  • src/main/runtime/rpc/server/runtime-rpc-reply-size-limit.ts
  • src/shared/remote-runtime/requests/runtime-rpc-staged-reply-read.ts
  • src/shared/remote-runtime/rpc/runtime-rpc-staged-reply.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@AmethystLiang
AmethystLiang merged commit b0120a2 into main Nov 29, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant