-
Notifications
You must be signed in to change notification settings - Fork 0
feat: auto-create GitHub repo on first sandbox creation #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sweetmantech
merged 8 commits into
test
from
sweetmantech/myc-4191-bash-no-supabase-info-create-a-github-repo
Feb 10, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f1af69a
feat: auto-create GitHub repo on first sandbox creation
sweetmantech 6f76e2a
feat: move GitHub repo setup to background Trigger.dev task
sweetmantech ac03d4f
fix: remove triggerSetupSandbox from POST handler
sweetmantech 33d66e8
Merge remote-tracking branch 'origin/test' into sweetmantech/myc-4191…
sweetmantech 00e8f6c
chore: remove dead API-side github/sandbox files
sweetmantech d654849
feat: trigger setup-sandbox task on sandbox creation
sweetmantech 6b3807d
revert: remove createSandbox response restructuring and dead code
sweetmantech f3ab32a
refactor: use single runId field in sandbox response
sweetmantech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { describe, it, expect, vi, beforeEach } from "vitest"; | ||
| import { tasks } from "@trigger.dev/sdk"; | ||
| import { triggerSetupSandbox } from "../triggerSetupSandbox"; | ||
|
|
||
| vi.mock("@trigger.dev/sdk", () => ({ | ||
| tasks: { | ||
| trigger: vi.fn(), | ||
| }, | ||
| })); | ||
|
|
||
| describe("triggerSetupSandbox", () => { | ||
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| }); | ||
|
|
||
| it("triggers setup-sandbox task with correct payload", async () => { | ||
| const mockHandle = { id: "run_123" }; | ||
| vi.mocked(tasks.trigger).mockResolvedValue(mockHandle); | ||
|
|
||
| const payload = { | ||
| sandboxId: "sbx_456", | ||
| accountId: "acc_123", | ||
| }; | ||
|
|
||
| const result = await triggerSetupSandbox(payload); | ||
|
|
||
| expect(tasks.trigger).toHaveBeenCalledWith("setup-sandbox", payload); | ||
| expect(result).toEqual(mockHandle); | ||
| }); | ||
|
|
||
| it("passes through the task handle from trigger", async () => { | ||
| const mockHandle = { id: "run_789", publicAccessToken: "token_abc" }; | ||
| vi.mocked(tasks.trigger).mockResolvedValue(mockHandle); | ||
|
|
||
| const result = await triggerSetupSandbox({ | ||
| sandboxId: "sbx_999", | ||
| accountId: "acc_456", | ||
| }); | ||
|
|
||
| expect(result).toBe(mockHandle); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { tasks } from "@trigger.dev/sdk"; | ||
|
|
||
| type SetupSandboxPayload = { | ||
| sandboxId: string; | ||
| accountId: string; | ||
| }; | ||
|
|
||
| /** | ||
| * Triggers the setup-sandbox task to provision a newly created sandbox. | ||
| * | ||
| * @param payload - The task payload with sandboxId and accountId | ||
| * @returns The task handle with runId | ||
| */ | ||
| export async function triggerSetupSandbox(payload: SetupSandboxPayload) { | ||
| const handle = await tasks.trigger("setup-sandbox", payload); | ||
| return handle; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resetting
runIdtoundefinedon command failure discards a valid setuprunId.If
triggerSetupSandboxsucceeded and provided arunId, buttriggerRunSandboxCommandthen fails, the client loses all tracking information. The setup task is still running — returning itsrunIdwould let the client at least monitor that. Consider omitting therunId = undefinedreset so the setuprunIdfalls through as a useful fallback.🐛 Proposed fix
} catch (triggerError) { console.error("Failed to trigger run-sandbox-command task:", triggerError); - runId = undefined; + // Keep the setup runId so the client can still track sandbox initialization }📝 Committable suggestion
🤖 Prompt for AI Agents