mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 20:03:11 +00:00
* feat(foundry): checkpoint actor and workspace refactor
* docs(foundry): add agent handoff context
* wip(foundry): continue actor refactor
* wip(foundry): capture remaining local changes
* Complete Foundry refactor checklist
* Fix Foundry validation fallout
* wip
* wip: convert all actors from workflow to plain run handlers
Workaround for RivetKit bug where c.queue.iter() never yields messages
for actors created via getOrCreate from another actor's context. The
queue accepts messages (visible in inspector) but the iterator hangs.
Sleep/wake fixes it, but actors with active connections never sleep.
Converted organization, github-data, task, and user actors from
run: workflow(...) to plain run: async (c) => { for await ... }.
Also fixes:
- Missing auth tables in org migration (auth_verification etc)
- default_model NOT NULL constraint on org profile upsert
- Nested workflow step in github-data (HistoryDivergedError)
- Removed --force from frontend Dockerfile pnpm install
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Convert all actors from queues/workflows to direct actions, lazy task creation
Major refactor replacing all queue-based workflow communication with direct
RivetKit action calls across all actors. This works around a RivetKit bug
where c.queue.iter() deadlocks for actors created from another actor's context.
Key changes:
- All actors (organization, task, user, audit-log, github-data) converted
from run: workflow(...) to actions-only (no run handler, no queues)
- PR sync creates virtual task entries in org local DB instead of spawning
task actors — prevents OOM from 200+ actors created simultaneously
- Task actors created lazily on first user interaction via getOrCreate,
self-initialize from org's getTaskIndexEntry data
- Removed requireRepoExists cross-actor call (caused 500s), replaced with
local resolveTaskRepoId from org's taskIndex table
- Fixed getOrganizationContext to thread overrides through all sync phases
- Fixed sandbox repo path (/home/user/repo for E2B compatibility)
- Fixed buildSessionDetail to skip transcript fetch for pending sessions
- Added process crash protection (uncaughtException/unhandledRejection)
- Fixed React infinite render loop in mock-layout useEffect dependencies
- Added sandbox listProcesses error handling for expired E2B sandboxes
- Set E2B sandbox timeout to 1 hour (was 5 min default)
- Updated CLAUDE.md with lazy task creation rules, no-silent-catch policy,
React hook dependency safety rules
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* 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>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
76 lines
2.7 KiB
TypeScript
76 lines
2.7 KiB
TypeScript
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", () => {
|
|
const title = deriveFallbackTitle("Fix OAuth callback bug in handler");
|
|
expect(title).toBe("fix: Fix OAuth callback bug in handler");
|
|
});
|
|
|
|
it("preserves an explicit conventional prefix without duplicating it", () => {
|
|
const title = deriveFallbackTitle("Reply with exactly: READY", "feat: Browser UI Flow");
|
|
expect(title).toBe("feat: Browser UI Flow");
|
|
});
|
|
|
|
it("sanitizes generated branch names", () => {
|
|
expect(sanitizeBranchName("feat: Add @mentions & #hashtags")).toBe("feat-add-mentions-hashtags");
|
|
expect(sanitizeBranchName(" spaces everywhere ")).toBe("spaces-everywhere");
|
|
});
|
|
|
|
it("generates a McMaster-Carr-style branch name with random suffix", () => {
|
|
const resolved = resolveCreateFlowDecision({
|
|
task: "Add auth",
|
|
localBranches: [],
|
|
taskBranches: [],
|
|
});
|
|
|
|
expect(resolved.title).toBe("feat: Add auth");
|
|
// 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", () => {
|
|
expect(() =>
|
|
resolveCreateFlowDecision({
|
|
task: "new task",
|
|
explicitBranchName: "existing-branch",
|
|
localBranches: ["existing-branch"],
|
|
taskBranches: [],
|
|
}),
|
|
).toThrow("already exists");
|
|
});
|
|
});
|