mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 07:04:48 +00:00
Fix Foundry handoff creation flow
This commit is contained in:
parent
6d7e67fe72
commit
5e733e8b37
9 changed files with 30 additions and 15 deletions
|
|
@ -10,7 +10,7 @@
|
|||
"license": {
|
||||
"name": "Apache-2.0"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
"version": "0.3.1"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ Use `pnpm` workspaces and Turborepo.
|
|||
- Stop the preview stack: `just factory-preview-down`
|
||||
- Tail preview logs: `just factory-preview-logs`
|
||||
|
||||
## Local Env
|
||||
|
||||
- For local The Foundry dev server setup, keep a personal env copy at `~/misc/the-foundry.env`.
|
||||
- To run the dev server from this workspace, copy that content into the repo root `.env`. Root `.env` is gitignored in this repo, so keep local secrets there and do not commit them.
|
||||
|
||||
## Frontend + Client Boundary
|
||||
|
||||
- Keep a browser-friendly GUI implementation aligned with the TUI interaction model wherever possible.
|
||||
|
|
@ -161,6 +166,7 @@ For all Rivet/RivetKit implementation:
|
|||
- Integration tests use `setupTest()` from `rivetkit/test` and are gated behind `HF_ENABLE_ACTOR_INTEGRATION_TESTS=1`.
|
||||
- End-to-end testing must run against the dev backend started via `docker compose -f compose.dev.yaml up` (host -> container). Do not run E2E against an in-process test runtime.
|
||||
- E2E tests should talk to the backend over HTTP (default `http://127.0.0.1:7741/api/rivet`) and use real GitHub repos/PRs.
|
||||
- Current org test repo: `rivet-dev/sandbox-agent-testing` (`https://github.com/rivet-dev/sandbox-agent-testing`).
|
||||
- Secrets (e.g. `OPENAI_API_KEY`, `GITHUB_TOKEN`/`GH_TOKEN`) must be provided via environment variables, never hardcoded in the repo.
|
||||
- Treat client E2E tests in `packages/client/test` as the primary end-to-end source of truth for product behavior.
|
||||
- Keep backend tests small and targeted. Only retain backend-only tests for invariants or persistence rules that are not well-covered through client E2E.
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ export interface HandoffInput {
|
|||
agentType: AgentType | null;
|
||||
explicitTitle: string | null;
|
||||
explicitBranchName: string | null;
|
||||
initialPrompt: string | null;
|
||||
}
|
||||
|
||||
interface InitializeCommand {
|
||||
|
|
@ -129,6 +130,7 @@ export const handoff = actor({
|
|||
agentType: input.agentType,
|
||||
explicitTitle: input.explicitTitle,
|
||||
explicitBranchName: input.explicitBranchName,
|
||||
initialPrompt: input.initialPrompt,
|
||||
initialized: false,
|
||||
previousStatus: null as string | null,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -413,7 +413,10 @@ export async function initCreateSessionActivity(
|
|||
: undefined;
|
||||
|
||||
return await sandboxInstance.createSession({
|
||||
prompt: buildAgentPrompt(loopCtx.state.task),
|
||||
prompt:
|
||||
typeof loopCtx.state.initialPrompt === "string"
|
||||
? loopCtx.state.initialPrompt
|
||||
: buildAgentPrompt(loopCtx.state.task),
|
||||
cwd,
|
||||
agent: (loopCtx.state.agentType ?? config.default_agent) as any
|
||||
});
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ interface CreateHandoffCommand {
|
|||
agentType: AgentType | null;
|
||||
explicitTitle: string | null;
|
||||
explicitBranchName: string | null;
|
||||
initialPrompt: string | null;
|
||||
onBranch: string | null;
|
||||
}
|
||||
|
||||
|
|
@ -387,7 +388,8 @@ async function createHandoffMutation(c: any, cmd: CreateHandoffCommand): Promise
|
|||
providerId: cmd.providerId,
|
||||
agentType: cmd.agentType,
|
||||
explicitTitle: onBranch ? null : cmd.explicitTitle,
|
||||
explicitBranchName: onBranch ? null : cmd.explicitBranchName
|
||||
explicitBranchName: onBranch ? null : cmd.explicitBranchName,
|
||||
initialPrompt: cmd.initialPrompt,
|
||||
});
|
||||
} catch (error) {
|
||||
if (onBranch) {
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@ async function createHandoffMutation(c: any, input: CreateHandoffInput): Promise
|
|||
agentType: input.agentType ?? null,
|
||||
explicitTitle: input.explicitTitle ?? null,
|
||||
explicitBranchName: input.explicitBranchName ?? null,
|
||||
initialPrompt: input.initialPrompt ?? null,
|
||||
onBranch: input.onBranch ?? null
|
||||
});
|
||||
|
||||
|
|
@ -312,9 +313,10 @@ async function createHandoffMutation(c: any, input: CreateHandoffInput): Promise
|
|||
|
||||
const handoff = getHandoff(c, c.state.workspaceId, repoId, created.handoffId);
|
||||
await handoff.provision({ providerId });
|
||||
const provisioned = await handoff.get();
|
||||
|
||||
await workspaceActions.notifyWorkbenchUpdated(c);
|
||||
return created;
|
||||
return provisioned;
|
||||
}
|
||||
|
||||
async function refreshProviderProfilesMutation(c: any, command?: RefreshProviderProfilesCommand): Promise<void> {
|
||||
|
|
@ -440,16 +442,20 @@ export const workspaceActions = {
|
|||
c.broadcast("workbenchUpdated", { at: Date.now() });
|
||||
},
|
||||
|
||||
async createWorkbenchHandoff(c: any, input: HandoffWorkbenchCreateHandoffInput): Promise<{ handoffId: string }> {
|
||||
async createWorkbenchHandoff(c: any, input: HandoffWorkbenchCreateHandoffInput): Promise<{ handoffId: string; tabId?: string }> {
|
||||
const created = await workspaceActions.createHandoff(c, {
|
||||
workspaceId: c.state.workspaceId,
|
||||
repoId: input.repoId,
|
||||
task: input.task,
|
||||
...(input.title ? { explicitTitle: input.title } : {}),
|
||||
...(input.branch ? { explicitBranchName: input.branch } : {}),
|
||||
...(input.initialPrompt !== undefined ? { initialPrompt: input.initialPrompt } : {}),
|
||||
...(input.model ? { agentType: agentTypeForModel(input.model) } : {})
|
||||
});
|
||||
return { handoffId: created.handoffId };
|
||||
return {
|
||||
handoffId: created.handoffId,
|
||||
...(created.activeSessionId ? { tabId: created.activeSessionId } : {}),
|
||||
};
|
||||
},
|
||||
|
||||
async markWorkbenchUnread(c: any, input: HandoffWorkbenchSelectInput): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -661,19 +661,13 @@ export function MockLayout({ workspaceId, selectedHandoffId, selectedSessionId }
|
|||
throw new Error("Cannot create a handoff without an available repo");
|
||||
}
|
||||
|
||||
const task = window.prompt("Describe the handoff task", "Investigate and implement the requested change");
|
||||
if (!task) {
|
||||
return;
|
||||
}
|
||||
|
||||
const title = window.prompt("Optional handoff title", "")?.trim() || undefined;
|
||||
const branch = window.prompt("Optional branch name", "")?.trim() || undefined;
|
||||
const task = "New task";
|
||||
const { handoffId, tabId } = await handoffWorkbenchClient.createHandoff({
|
||||
repoId,
|
||||
task,
|
||||
title: task,
|
||||
model: "gpt-4o",
|
||||
...(title ? { title } : {}),
|
||||
...(branch ? { branch } : {}),
|
||||
initialPrompt: "",
|
||||
});
|
||||
await navigate({
|
||||
to: "/workspaces/$workspaceId/handoffs/$handoffId",
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ export const CreateHandoffInputSchema = z.object({
|
|||
task: z.string().min(1),
|
||||
explicitTitle: z.string().trim().min(1).optional(),
|
||||
explicitBranchName: z.string().trim().min(1).optional(),
|
||||
initialPrompt: z.string().optional(),
|
||||
providerId: ProviderIdSchema.optional(),
|
||||
agentType: AgentTypeSchema.optional(),
|
||||
onBranch: z.string().trim().min(1).optional()
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ export interface HandoffWorkbenchCreateHandoffInput {
|
|||
title?: string;
|
||||
branch?: string;
|
||||
model?: WorkbenchModelId;
|
||||
initialPrompt?: string;
|
||||
}
|
||||
|
||||
export interface HandoffWorkbenchRenameInput {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue