Skip to content

feat(mobile): compress cloud command output with rtk (port #3257)#3339

Merged
Gilbert09 merged 3 commits into
mainfrom
posthog-code/mobile-rtk-cloud-compression
Jul 10, 2026
Merged

feat(mobile): compress cloud command output with rtk (port #3257)#3339
Gilbert09 merged 3 commits into
mainfrom
posthog-code/mobile-rtk-cloud-compression

Conversation

@Gilbert09

Copy link
Copy Markdown
Member

Problem

Cloud runs on desktop can compress verbose shell command output through rtk before it reaches the model, cutting token usage — added in #3257. The mobile app had no equivalent, so cloud runs started from mobile always sent uncompressed output.

Why: bring the mobile app to parity so cloud runs started from a phone benefit from the same token savings, on by default.

Changes

Ports only the Cloud half of #3257 to apps/mobile. Mobile has no local agent sessions, no workspace-server, and no rtk binary, so the desktop Local checkbox, the agent.rtkStatus query, and the "rtk binary not found" warning have no mobile equivalent and are intentionally not ported.

  • Preference: rtkEnabledCloud (persisted, defaults true) plus its setter in preferencesStore, mirroring autoPublishCloudRuns.
  • Settings: a "Compress command output" Switch row under General.
  • API: rtkEnabled? option on runTaskInCloud. Mirroring the server default (enabled), only an explicit opt-out sends rtk_enabled: false; the enabled case sends nothing.
  • Threading: the preference flows into every cloud-run start/resume path (new task, send-after-terminal, retry, signal-report accept).

No desktop or shared-package code is touched — this PR is apps/mobile only.

How did you test this?

  • pnpm --filter mobile test — 402 tests pass, including new api.test.ts cases covering the payload builder (rtk_enabled absent when the preference is on, present and false when off).
  • tsc --noEmit on the mobile project — no new type errors in the changed files.
  • biome check on the changed files — clean.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Adds a "Compress command output" cloud setting to the mobile app, on by default. When enabled, eligible shell command output on cloud runs is routed through rtk so verbose output is compressed before it reaches the model, reducing token usage.

Only the Cloud half of #3257 is ported: mobile has no local agent sessions, no workspace-server, and no rtk binary, so the desktop Local checkbox, the agent.rtkStatus query, and the "rtk binary not found" warning have no mobile equivalent.

The preference persists as rtkEnabledCloud (default true) and threads into every cloud-run start/resume path. Following the server default (enabled), only an explicit opt-out sends rtk_enabled: false; the enabled case sends nothing.

Generated-By: PostHog Code
Task-Id: eeb20b54-b0ff-4624-b0df-64ce78edbe50
@Gilbert09 Gilbert09 requested a review from a team July 10, 2026 10:41
@trunk-io

trunk-io Bot commented Jul 10, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 4690038.

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(mobile): compress cloud command out..." | Re-trigger Greptile

Comment thread apps/mobile/src/features/tasks/api.ts
The session-store resume path built a new cloud run with resumeFromRunId
but no rtkEnabled. Since rtkEnabled only alters the wire payload when
false, a user who disabled compression had it silently re-enabled after
an inactive-session resume. Forward the current preference so the opt-out
survives resume, matching the other cloud-run call sites.

Generated-By: PostHog Code
Task-Id: 3b8a4908-02e4-4350-80ad-c247be2aa546
Generated-By: PostHog Code
Task-Id: 3b8a4908-02e4-4350-80ad-c247be2aa546

@danielcarletti danielcarletti 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.

LGTM

@Gilbert09 Gilbert09 merged commit 9b00961 into main Jul 10, 2026
26 checks passed
@Gilbert09 Gilbert09 deleted the posthog-code/mobile-rtk-cloud-compression branch July 10, 2026 14:23
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.

3 participants