Enable lock-free parallel agent runs

This commit is contained in:
ZacharyZhang-NY committed 2026-04-22 20:23:44 -04:00
1 parent d13c9d83e8
commit 1a7eb8f1b3
18 files changed
+327 -194

No files matched your search

@@ -14,11 +14,12 @@ export function TaskCreator({ companyId, goals, projects, agents, workspaces, on
const [title, setTitle] = useState(""); const [description, setDescription] = useState("")
const [goalId, setGoalId] = useState(goals[0]?.id ?? ""); const [projectId, setProjectId] = useState(projects[0]?.id ?? "")
const [assigneeAgentId, setAssigneeAgentId] = useState(agents[0]?.id ?? ""); const [workspaceId, setWorkspaceId] = useState(workspaces[0]?.id ?? "")
const [requiresFilesystem, setRequiresFilesystem] = useState(false)
const [priority, setPriority] = useState("medium"); const [submitError, setSubmitError] = useState<string | null>(null); const [submitting, setSubmitting] = useState(false)
async function handleCreateTask() {
setSubmitError(null); setSubmitting(true)
try { unwrap(await window.agentCompany.saveTask({ companyId, projectId: projectId || null, goalId: goalId || null, title, description, assigneeAgentId: assigneeAgentId || null, workspaceId: workspaceId || null, requiresFilesystem: Boolean(workspaceId), priority: priority as TaskRecord["priority"], status: "todo" })); setTitle(""); setDescription(""); await onSaved() } catch (e) { setSubmitError(describeActionError(e)) } finally { setSubmitting(false) }
try { unwrap(await window.agentCompany.saveTask({ companyId, projectId: projectId || null, goalId: goalId || null, title, description, assigneeAgentId: assigneeAgentId || null, workspaceId: workspaceId || null, requiresFilesystem, priority: priority as TaskRecord["priority"], status: "todo" })); setTitle(""); setDescription(""); setRequiresFilesystem(false); await onSaved() } catch (e) { setSubmitError(describeActionError(e)) } finally { setSubmitting(false) }
}
const [showAdvanced, setShowAdvanced] = useState(false)
@@ -41,6 +42,15 @@ export function TaskCreator({ companyId, goals, projects, agents, workspaces, on
<Select label={t("exec.project")} value={projectId} onChange={setProjectId} options={[{ value: "", label: t("exec.noProject") }, ...projects.map((p) => ({ value: p.id, label: p.name }))]} />
<Select label={t("exec.assignee")} value={assigneeAgentId} onChange={setAssigneeAgentId} options={[{ value: "", label: t("exec.unassigned") }, ...agents.map((a) => ({ value: a.id, label: a.name }))]} />
<Select label={t("exec.workspace")} value={workspaceId} onChange={setWorkspaceId} options={[{ value: "", label: t("exec.noWorkspace") }, ...workspaces.map((w) => ({ value: w.id, label: w.name }))]} />
<label className="flex items-center gap-2.5 md:col-span-2">
<input
type="checkbox"
checked={requiresFilesystem}
onChange={(event) => setRequiresFilesystem(event.target.checked)}
className="h-4 w-4 rounded border-border accent-[color:var(--primary)]"
/>
<span className="text-[13px] text-foreground">{t("exec.requiresFilesystem")}</span>
</label>
</motion.div>
) : null}
</AnimatePresence>
@@ -27,6 +27,7 @@ export function TaskInspectorEditForm({
const [status, setStatus] = useState<TaskStatus>(task.status)
const [assignee, setAssignee] = useState(task.assigneeAgentId ?? "")
const [workspace, setWorkspace] = useState(task.workspaceId ?? "")
const [requiresFilesystem, setRequiresFilesystem] = useState(task.requiresFilesystem)
const [project, setProject] = useState(task.projectId ?? "")
const [goal, setGoal] = useState(task.goalId ?? "")
const [saving, setSaving] = useState(false)
@@ -43,7 +44,7 @@ export function TaskInspectorEditForm({
status,
assigneeAgentId: assignee || null,
workspaceId: workspace || null,
requiresFilesystem: task.requiresFilesystem,
requiresFilesystem,
projectId: project || null,
goalId: goal || null,
}))
@@ -66,6 +67,15 @@ export function TaskInspectorEditForm({
<Select label={t("exec.status")} value={status} onChange={(v) => setStatus(v as TaskStatus)} options={["backlog", "todo", "in_progress", "in_review", "done", "blocked", "cancelled"].map((v) => ({ value: v, label: v.replaceAll("_", " ") }))} />
<Select label={t("exec.assignee")} value={assignee} onChange={setAssignee} options={[{ value: "", label: t("exec.unassigned") }, ...agents.map((a) => ({ value: a.id, label: a.name }))]} />
<Select label={t("exec.workspace")} value={workspace} onChange={setWorkspace} options={[{ value: "", label: t("exec.noWorkspace") }, ...workspaces.map((w) => ({ value: w.id, label: w.name }))]} />
<label className="flex items-center gap-2.5 md:col-span-2">
<input
type="checkbox"
checked={requiresFilesystem}
onChange={(event) => setRequiresFilesystem(event.target.checked)}
className="h-4 w-4 rounded border-border accent-[color:var(--primary)]"
/>
<span className="text-[13px] text-foreground">{t("exec.requiresFilesystem")}</span>
</label>
<Select label={t("exec.project")} value={project} onChange={setProject} options={[{ value: "", label: t("exec.noProject") }, ...projects.map((p) => ({ value: p.id, label: p.name }))]} />
<Select label={t("exec.goal")} value={goal} onChange={setGoal} options={[{ value: "", label: t("exec.noGoal") }, ...goals.map((g) => ({ value: g.id, label: g.title }))]} />
<div className="md:col-span-2 flex gap-3">
+1
View File
@@ -415,6 +415,7 @@ export const en: Record<string, string> = {
"exec.unassigned": "Unassigned",
"exec.workspace": "Workspace",
"exec.noWorkspace": "No workspace",
"exec.requiresFilesystem": "Requires filesystem lock",
"exec.project": "Project",
"exec.noProject": "No project",
"exec.goal": "Goal",
+1
View File
@@ -415,6 +415,7 @@ export const zh: Record<string, string> = {
"exec.unassigned": "未分配",
"exec.workspace": "工作区",
"exec.noWorkspace": "无工作区",
"exec.requiresFilesystem": "需要文件系统锁",
"exec.project": "项目",
"exec.noProject": "无项目",
"exec.goal": "目标",