feat(07-01): wire task quality gates into all creation paths
- Add SaveTaskResult type to contracts.ts (id + optional capabilityWarning) - IPC handler: validate new tasks, reject with TASK_VALIDATION_FAILED, check capability match - API server: validate POST /issues and meeting action items before db.saveTask - Automation service: validate create_task action, skip with warning if invalid - CapabilityMatchDb interface uses optional skill methods for graceful degradation - TypeScript compiles cleanly across all process boundaries - All 241 tests pass with zero regressions
This commit is contained in:
1 parent
025920bc12
commit
a9ce25e6dd
5 files changed
+58
-11
No files matched your search
@@ -8,6 +8,7 @@ import { canAssignTask, canControlAgent, canManageGoal, canManageOrganization, c
|
||||
import { resolveApprovalDecision, shouldAutoApproveApproval } from "./approval-policy";
|
||||
import type { AppDatabase } from "./database";
|
||||
import { inferTaskType } from "./connector-matching";
|
||||
import { validateTaskCreation } from "./task-quality-gates";
|
||||
import { dispatchAgentMessage } from "./message-dispatch";
|
||||
import type { DesktopEvent, SectionId } from "@shared/types";
|
||||
|
||||
@@ -561,6 +562,12 @@ export class AgentApiServer {
|
||||
this.json(res, 403, { error: "Current agent is not allowed to assign this task to the selected agent" });
|
||||
return;
|
||||
}
|
||||
const isHeartbeat = input.title.startsWith("[Heartbeat]");
|
||||
const taskValidation = validateTaskCreation({ title: input.title, description: input.description ?? "" }, isHeartbeat);
|
||||
if (!taskValidation.valid) {
|
||||
this.json(res, 422, { error: taskValidation.errors.join("; ") });
|
||||
return;
|
||||
}
|
||||
|
||||
let id: string;
|
||||
try {
|
||||
@@ -1582,6 +1589,14 @@ export class AgentApiServer {
|
||||
if (actionItems.length > 0) {
|
||||
for (const item of actionItems) {
|
||||
if (item.title && typeof item.title === "string") {
|
||||
const meetingTaskValidation = validateTaskCreation(
|
||||
{ title: item.title, description: item.description ?? `Action item from meeting: ${data.title ?? existing.title}` },
|
||||
false,
|
||||
);
|
||||
if (!meetingTaskValidation.valid) {
|
||||
// Log but skip invalid meeting action items rather than failing the whole request
|
||||
continue;
|
||||
}
|
||||
const taskId = this.db.saveTask({
|
||||
companyId: token.companyId,
|
||||
title: item.title,
|
||||
|
||||
Reference in new issue
Block a user