Skip to content

feat(code): don't show cloud as option if git integration not existing#2045

Merged
k11kirky merged 1 commit intomainfrom
05-05-feat_code_don_t_show_cloud_as_option_if_git_integration_not_existing
May 5, 2026
Merged

feat(code): don't show cloud as option if git integration not existing#2045
k11kirky merged 1 commit intomainfrom
05-05-feat_code_don_t_show_cloud_as_option_if_git_integration_not_existing

Conversation

@k11kirky
Copy link
Copy Markdown
Contributor

@k11kirky k11kirky commented May 5, 2026

Problem

Two related cloud session bugs needed fixing:

  1. When a cloud run fails before the agent ever boots (e.g. sandbox provisioning failure), sending a new prompt would attempt to resume the run, spinning up another sandbox that hits the same failure in a loop. The error was never surfaced to the user.

  2. When a user without a GitHub integration had previously used cloud mode, the workspace mode selector would briefly show "cloud" as selected on load before snapping to a local mode once the integration check resolved, causing a visible flicker.

Changes

Pre-boot cloud failure guard: sendPrompt now checks whether a failed cloud session never reached a connected state. If so, it throws immediately with the stored error message (or a generic fallback) rather than attempting to resume, preventing the provisioning failure loop.

Workspace mode flicker fix: The workspaceMode value is now derived after the GitHub integration check resolves. While the integration list is still loading, the UI stays optimistic and keeps the current selection. Once loaded, if cloud is unavailable and the last-used mode was "cloud", it falls back to the last-used local workspace mode. The cloud option in WorkspaceModeSelect is also hidden when cloudAvailable is false.

Copy link
Copy Markdown
Contributor Author

k11kirky commented May 5, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@k11kirky k11kirky added the Create release This will trigger a new release label May 5, 2026 — with Graphite App
@k11kirky k11kirky marked this pull request as ready for review May 5, 2026 22:22
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 5, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/code/src/renderer/features/sessions/service/service.test.ts:2662-2689
**Prefer parameterised test for pre-boot failure cases**

The two `it` blocks cover the same code path (pre-boot `cloudStatus === "failed"` with `status !== "connected"`) and differ only in the presence of `cloudErrorMessage`. This is a textbook candidate for `it.each`, keeping the fixture and assertion logic in one place and making it easier to add further error-message variants later.

Reviews (1): Last reviewed commit: "feat(code): don't show cloud as option i..." | Re-trigger Greptile

Comment on lines +2662 to +2689
it("refuses to resume when the previous run failed before the agent booted", async () => {
const service = getSessionService();
mockPreBootFailedSession({
cloudErrorMessage: "Sandbox could not be provisioned",
});

await expect(service.sendPrompt("task-123", "retry?")).rejects.toThrow(
"Sandbox could not be provisioned",
);
expect(mockAuthenticatedClient.runTaskInCloud).not.toHaveBeenCalled();
});

it("falls back to a generic message when the failed run has no error", async () => {
const service = getSessionService();
mockPreBootFailedSession();

await expect(service.sendPrompt("task-123", "retry?")).rejects.toThrow(
/Cloud run couldn't start/,
);
expect(mockAuthenticatedClient.runTaskInCloud).not.toHaveBeenCalled();
});

it("still resumes when a previously running agent failed mid-execution", async () => {
const service = getSessionService();
mockSessionStoreSetters.getSessionByTaskId.mockReturnValue(
createMockSession({
isCloud: true,
cloudStatus: "failed",
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 Prefer parameterised test for pre-boot failure cases

The two it blocks cover the same code path (pre-boot cloudStatus === "failed" with status !== "connected") and differ only in the presence of cloudErrorMessage. This is a textbook candidate for it.each, keeping the fixture and assertion logic in one place and making it easier to add further error-message variants later.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/sessions/service/service.test.ts
Line: 2662-2689

Comment:
**Prefer parameterised test for pre-boot failure cases**

The two `it` blocks cover the same code path (pre-boot `cloudStatus === "failed"` with `status !== "connected"`) and differ only in the presence of `cloudErrorMessage`. This is a textbook candidate for `it.each`, keeping the fixture and assertion logic in one place and making it easier to add further error-message variants later.

How can I resolve this? If you propose a fix, please make it concise.

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!

@k11kirky k11kirky enabled auto-merge (squash) May 5, 2026 22:26
@k11kirky k11kirky merged commit 9290d95 into main May 5, 2026
16 checks passed
@k11kirky k11kirky deleted the 05-05-feat_code_don_t_show_cloud_as_option_if_git_integration_not_existing branch May 5, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Create release This will trigger a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants