mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 06:04:43 +00:00
* Improve Daytona sandbox provisioning and frontend UI Refactor git clone script in Daytona provider to use cleaner shell logic for GitHub token authentication and branch checkout. Add support for private repository clones with token-based auth. Improve Daytona provider error handling and git configuration setup. Frontend improvements include enhanced dev panel, workspace dashboard, sidebar navigation, and UI components for better task/session management. Update interest manager and backend client to support improved session state handling. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Add header status pill showing task/session/sandbox state Surface aggregate status (error, provisioning, running, ready, no sandbox) as a colored pill in the transcript panel header. Integrates task runtime status, session status, and sandbox availability via the sandboxProcesses interest topic so the pill accurately reflects unreachable sandboxes. Includes mock tasks demonstrating error, provisioning, and running states, unit tests for deriveHeaderStatus, and workspace-dashboard integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
82 lines
3 KiB
TypeScript
82 lines
3 KiB
TypeScript
// @ts-nocheck
|
|
import { mkdtempSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { execFileSync } from "node:child_process";
|
|
import { setTimeout as delay } from "node:timers/promises";
|
|
import { describe, expect, it } from "vitest";
|
|
import { setupTest } from "rivetkit/test";
|
|
import { workspaceKey } from "../src/actors/keys.js";
|
|
import { registry } from "../src/actors/index.js";
|
|
import { createTestDriver } from "./helpers/test-driver.js";
|
|
import { createTestRuntimeContext } from "./helpers/test-context.js";
|
|
|
|
const runActorIntegration = process.env.HF_ENABLE_ACTOR_INTEGRATION_TESTS === "1";
|
|
|
|
function createRepo(): { repoPath: string } {
|
|
const repoPath = mkdtempSync(join(tmpdir(), "hf-isolation-repo-"));
|
|
execFileSync("git", ["init"], { cwd: repoPath });
|
|
execFileSync("git", ["config", "user.email", "test@example.com"], { cwd: repoPath });
|
|
execFileSync("git", ["config", "user.name", "Foundry Test"], { cwd: repoPath });
|
|
writeFileSync(join(repoPath, "README.md"), "hello\n", "utf8");
|
|
execFileSync("git", ["add", "README.md"], { cwd: repoPath });
|
|
execFileSync("git", ["commit", "-m", "init"], { cwd: repoPath });
|
|
return { repoPath };
|
|
}
|
|
|
|
async function waitForWorkspaceRows(ws: any, workspaceId: string, expectedCount: number) {
|
|
for (let attempt = 0; attempt < 40; attempt += 1) {
|
|
const rows = await ws.listTasks({ workspaceId });
|
|
if (rows.length >= expectedCount) {
|
|
return rows;
|
|
}
|
|
await delay(50);
|
|
}
|
|
return ws.listTasks({ workspaceId });
|
|
}
|
|
|
|
describe("workspace isolation", () => {
|
|
it.skipIf(!runActorIntegration)("keeps task lists isolated by workspace", async (t) => {
|
|
const testDriver = createTestDriver();
|
|
createTestRuntimeContext(testDriver);
|
|
|
|
const { client } = await setupTest(t, registry);
|
|
const wsA = await client.workspace.getOrCreate(workspaceKey("alpha"), {
|
|
createWithInput: "alpha",
|
|
});
|
|
const wsB = await client.workspace.getOrCreate(workspaceKey("beta"), {
|
|
createWithInput: "beta",
|
|
});
|
|
|
|
const { repoPath } = createRepo();
|
|
const repoA = await wsA.addRepo({ workspaceId: "alpha", remoteUrl: repoPath });
|
|
const repoB = await wsB.addRepo({ workspaceId: "beta", remoteUrl: repoPath });
|
|
|
|
await wsA.createTask({
|
|
workspaceId: "alpha",
|
|
repoId: repoA.repoId,
|
|
task: "task A",
|
|
providerId: "local",
|
|
explicitBranchName: "feature/a",
|
|
explicitTitle: "A",
|
|
});
|
|
|
|
await wsB.createTask({
|
|
workspaceId: "beta",
|
|
repoId: repoB.repoId,
|
|
task: "task B",
|
|
providerId: "local",
|
|
explicitBranchName: "feature/b",
|
|
explicitTitle: "B",
|
|
});
|
|
|
|
const aRows = await waitForWorkspaceRows(wsA, "alpha", 1);
|
|
const bRows = await waitForWorkspaceRows(wsB, "beta", 1);
|
|
|
|
expect(aRows.length).toBe(1);
|
|
expect(bRows.length).toBe(1);
|
|
expect(aRows[0]?.workspaceId).toBe("alpha");
|
|
expect(bRows[0]?.workspaceId).toBe("beta");
|
|
expect(aRows[0]?.taskId).not.toBe(bRows[0]?.taskId);
|
|
});
|
|
});
|