feat(mobile): warm sandbox on the selected model and runtime (port #2936)#2948
feat(mobile): warm sandbox on the selected model and runtime (port #2936)#2948Gilbert09 wants to merge 2 commits into
Conversation
) 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
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Reviews (1): Last reviewed commit: "feat(mobile): warm sandbox on the select..." | Re-trigger Greptile |
| 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); | ||
| }); |
There was a problem hiding this comment.
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
Problem
When composing a new cloud task, mobile pre-warms a sandbox in the background. The warm request only carried
repository,github_integration, andbranch, 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 optionalruntime_adapter,model,reasoning_effortand includes them in the POST body, sendingnullwhen absent — matching the desktop wire shape.useWarmTaskacceptsruntimeAdapter,model,reasoningEffortand forwards them, folding them into the dedup key so changing the model (or reasoning effort) re-warms.model, runtime adapter ("claude"), and reasoning effort.Mobile's runtime is Claude-only, so
runtime_adapteris effectively always"claude"; the meaningful part is the selectedmodelandreasoning_effort.Tests
Extended
api.warm.test.tsanduseWarmTask.test.tsxto cover the new fields (forwarded when set,nullwhen absent, and re-warm on model change). Mobile warm tests pass; lint clean on the changed scope.