mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-17 02:04:13 +00:00
Fix E2B sandbox timeout comment, frontend stability, and create-flow improvements
- Add TEMPORARY comment on E2B timeoutMs with pointer to rivetkit sandbox resilience proposal for when autoPause lands - Fix React useEffect dependency stability in mock-layout and organization-dashboard to prevent infinite re-render loops - Fix terminal-pane ref handling - Improve create-flow service and tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
78cd38d826
commit
ee25a6c6a5
6 changed files with 106 additions and 42 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { deriveFallbackTitle, resolveCreateFlowDecision, sanitizeBranchName } from "../src/services/create-flow.js";
|
||||
import { BRANCH_NAME_PREFIXES } from "../src/services/branch-name-prefixes.js";
|
||||
|
||||
describe("create flow decision", () => {
|
||||
it("derives a conventional-style fallback title from task text", () => {
|
||||
|
|
@ -17,15 +18,49 @@ describe("create flow decision", () => {
|
|||
expect(sanitizeBranchName(" spaces everywhere ")).toBe("spaces-everywhere");
|
||||
});
|
||||
|
||||
it("auto-increments generated branch names for conflicts", () => {
|
||||
it("generates a McMaster-Carr-style branch name with random suffix", () => {
|
||||
const resolved = resolveCreateFlowDecision({
|
||||
task: "Add auth",
|
||||
localBranches: ["feat-add-auth"],
|
||||
taskBranches: ["feat-add-auth-2"],
|
||||
localBranches: [],
|
||||
taskBranches: [],
|
||||
});
|
||||
|
||||
expect(resolved.title).toBe("feat: Add auth");
|
||||
expect(resolved.branchName).toBe("feat-add-auth-3");
|
||||
// Branch name should be "<prefix>-<4-char-suffix>" where prefix is from BRANCH_NAME_PREFIXES
|
||||
const lastDash = resolved.branchName.lastIndexOf("-");
|
||||
const prefix = resolved.branchName.slice(0, lastDash);
|
||||
const suffix = resolved.branchName.slice(lastDash + 1);
|
||||
expect(BRANCH_NAME_PREFIXES).toContain(prefix);
|
||||
expect(suffix).toMatch(/^[a-z0-9]{4}$/);
|
||||
});
|
||||
|
||||
it("avoids conflicts by generating a different random name", () => {
|
||||
// Even with a conflicting branch, it should produce something different
|
||||
const resolved = resolveCreateFlowDecision({
|
||||
task: "Add auth",
|
||||
localBranches: [],
|
||||
taskBranches: [],
|
||||
});
|
||||
|
||||
// Running again with the first result as a conflict should produce a different name
|
||||
const resolved2 = resolveCreateFlowDecision({
|
||||
task: "Add auth",
|
||||
localBranches: [resolved.branchName],
|
||||
taskBranches: [],
|
||||
});
|
||||
|
||||
expect(resolved2.branchName).not.toBe(resolved.branchName);
|
||||
});
|
||||
|
||||
it("uses explicit branch name when provided", () => {
|
||||
const resolved = resolveCreateFlowDecision({
|
||||
task: "new task",
|
||||
explicitBranchName: "my-branch",
|
||||
localBranches: [],
|
||||
taskBranches: [],
|
||||
});
|
||||
|
||||
expect(resolved.branchName).toBe("my-branch");
|
||||
});
|
||||
|
||||
it("fails when explicit branch already exists", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue