Skip to content

feat(mobile): warm sandbox on the selected model and runtime (port #2936)#2948

Open
Gilbert09 wants to merge 2 commits into
mainfrom
posthog-code/mobile-warm-selected-model
Open

feat(mobile): warm sandbox on the selected model and runtime (port #2936)#2948
Gilbert09 wants to merge 2 commits into
mainfrom
posthog-code/mobile-warm-selected-model

Conversation

@Gilbert09

Copy link
Copy Markdown
Member

Problem

When composing a new cloud task, mobile pre-warms a sandbox in the background. The warm request only carried repository, github_integration, and branch, so the backend could provision the sandbox on a default runtime/model rather than the one the user actually selected. On submit the task reused that mismatched sandbox, wasting the warm.

Change

Ports desktop PR #2936 ("feat(cloud-tasks): warm sandbox on the selected runtime and model") to apps/mobile:

  • warmTask (api.ts) accepts optional runtime_adapter, model, reasoning_effort and includes them in the POST body, sending null when absent — matching the desktop wire shape.
  • useWarmTask accepts runtimeAdapter, model, reasoningEffort and forwards them, folding them into the dedup key so changing the model (or reasoning effort) re-warms.
  • The composer passes the currently-selected model, runtime adapter ("claude"), and reasoning effort.

Mobile's runtime is Claude-only, so runtime_adapter is effectively always "claude"; the meaningful part is the selected model and reasoning_effort.

Tests

Extended api.warm.test.ts and useWarmTask.test.tsx to cover the new fields (forwarded when set, null when absent, and re-warm on model change). Mobile warm tests pass; lint clean on the changed scope.

)

The warm-sandbox request only carried repository/github_integration/branch,
so the backend could provision the sandbox on a default runtime/model rather
than the one the user selected — wasting the warmed sandbox on submit.

Thread the selected runtime adapter, model, and reasoning effort through
warmTask and useWarmTask, and fold them into the warm dedup key so a model or
reasoning change re-warms. The composer passes the currently-selected model,
runtime ("claude"), and reasoning effort.

Ports desktop PR #2936 to apps/mobile.

Generated-By: PostHog Code
Task-Id: 55143e04-70fc-4662-b23c-927d6697cf0a
@Gilbert09 Gilbert09 requested a review from a team June 26, 2026 10:43
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit c4f9b5e.

@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(mobile): warm sandbox on the select..." | Re-trigger Greptile

Comment on lines +180 to +213
it("forwards the selected runtime and re-warms when the model changes", async () => {
const { rerender } = render({
...composing,
runtimeAdapter: "claude",
model: "claude-opus-4-8",
reasoningEffort: "high",
});
await flushDebounce();
expect(mockWarmTask).toHaveBeenLastCalledWith({
repository: "acme/repo",
github_integration: 42,
branch: "main",
runtime_adapter: "claude",
model: "claude-opus-4-8",
reasoning_effort: "high",
});

rerender({
...composing,
runtimeAdapter: "claude",
model: "claude-sonnet-4-6",
reasoningEffort: "high",
});
await flushDebounce();
expect(mockWarmTask).toHaveBeenLastCalledWith({
repository: "acme/repo",
github_integration: 42,
branch: "main",
runtime_adapter: "claude",
model: "claude-sonnet-4-6",
reasoning_effort: "high",
});
expect(mockWarmTask).toHaveBeenCalledTimes(2);
});

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.

P2 New test duplicates the existing parameterized re-warm pattern

The test "forwards the selected runtime and re-warms when the model changes" exercises the same dedup-key re-warm flow already covered by the it.each block above ("warms the new selection when the $name changes"). Adding a model (and optionally reasoningEffort) case to that table, plus a paired expected* field, would keep the re-warm-on-field-change behaviour OnceAndOnlyOnce and align with the team's preference for parameterised tests. The current standalone test is correct but duplicates structure unnecessarily.

Context Used: Do not attempt to comment on incorrect alphabetica... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

The standalone "re-warms when the model changes" test duplicated the
existing it.each re-warm block. Fold the model case into that table with a
per-case initial-props override and full expected payload, keeping the
re-warm-on-field-change behavior covered once.

Generated-By: PostHog Code
Task-Id: 55143e04-70fc-4662-b23c-927d6697cf0a
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