Auto-approve agent work in AI CEO mode instead of gating on the operator

This commit is contained in:
ZacharyZhang-NY committed 2026-05-29 23:27:37 -04:00
1 parent 9996b89f72
commit e7fa60d6b6
4 files changed
+101 -10

No files matched your search

@@ -73,6 +73,7 @@ describe("domain services", () => {
employeeName: "Dana Lee",
mission: "Coordinate agents with auditable approvals.",
goal: "Ship a verified control plane.",
executionMode: "ai_cofounder",
});
organization.createTask({
orgId,
@@ -98,6 +99,44 @@ describe("domain services", () => {
connection.close();
});
test("ai ceo mode auto-approves high risk work without operator review", () => {
const connection = createConnection();
const organization = new OrganizationService(connection.db);
const snapshot = new SnapshotService(connection.db);
let orgId = "";
connection.transaction(() => {
orgId = organization.createOrganization({
organizationName: "Autonomy Inc",
employeeName: "Robin Park",
mission: "Run the company autonomously.",
goal: "Ship without manual gates.",
executionMode: "ai_ceo",
});
organization.createTask({
orgId,
title: "Production deploy",
description: "Deploy a high-risk change.",
status: TASK_STATUS.BACKLOG,
assigneeAgentId: null,
risk: RISK_LEVEL.HIGH,
projectId: null,
goalId: null,
workspaceId: null,
priority: "normal",
requiresFilesystem: false,
});
});
const state = snapshot.load();
const employeeId = state.employees.find((employee) => employee.orgId === orgId)?.id;
expect(state.approvals).toHaveLength(1);
expect(state.approvals[0]?.state).toBe("approved");
expect(state.approvals[0]?.decidedByEmployeeId).toBe(employeeId);
expect(state.approvalAssignments).toHaveLength(0);
connection.close();
});
test("imports a versioned skill revision from a local directory", () => {
const connection = createConnection();
const organization = new OrganizationService(connection.db);
@@ -85,7 +85,13 @@ describe("org governance service", () => {
let orgId = "";
connection.transaction(() => {
orgId = createOrganization(organization);
orgId = organization.createOrganization({
organizationName: "Acme Operations",
employeeName: "Dana Lee",
mission: "Coordinate agents with auditable approvals.",
goal: "Ship a verified control plane.",
autoApproveHires: false,
});
organization.createAgent({
orgId,
name: "Ada",
@@ -160,6 +160,7 @@ describe("task execution service", () => {
employeeName: "Dana Lee",
mission: "Coordinate agents with auditable approvals.",
goal: "Ship a verified control plane.",
executionMode: "ai_cofounder",
});
employeeId = (connection.db.prepare("select id from employees where org_id = ?").get(orgId) as { id: string }).id;
const providerId = openAiProviderId(connection, orgId);