Skip to content

Commit 34178bd

Browse files
mechramcclaude
andcommitted
fix(ci): biome formatting auto-fix on 6 files
Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent b005c26 commit 34178bd

6 files changed

Lines changed: 62 additions & 41 deletions

File tree

apps/api/src/services/dag-executor.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ export function allTasksTerminal(tasks: PlanTask[]): boolean {
106106
* These tasks are "unreachable" and should be deferred to prevent the run from hanging.
107107
*/
108108
export function getUnreachableTasks(tasks: PlanTask[]): PlanTask[] {
109-
const failedIds = new Set(
110-
tasks.filter((t) => t.status === TaskStatus.Failed).map((t) => t.id),
111-
);
109+
const failedIds = new Set(tasks.filter((t) => t.status === TaskStatus.Failed).map((t) => t.id));
112110

113111
if (failedIds.size === 0) return [];
114112

apps/api/src/services/orchestrator.ts

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ import {
4141
import { logAuditEvent } from "./audit-logger.js";
4242
import { checkBudget as checkBudgetThresholds, initBudget } from "./budget-monitor.js";
4343
import { recordCost } from "./cost-tracker.js";
44-
import { allTasksTerminal, getReadyTasks, getUnreachableTasks, hasFailedTasks } from "./dag-executor.js";
44+
import {
45+
allTasksTerminal,
46+
getReadyTasks,
47+
getUnreachableTasks,
48+
hasFailedTasks,
49+
} from "./dag-executor.js";
4550
import { storeFailure } from "./failure-store.js";
4651
import { createHealingProject, shouldAutoHeal } from "./healing-engine.js";
4752
import { extractPatternsFromRun } from "./knowledge-store.js";
@@ -297,7 +302,9 @@ export async function executeNextWave(runId: string): Promise<Result<AgentState[
297302
}
298303

299304
const readyTasks = getReadyTasks(run.plan.tasks);
300-
console.log(`[executeNextWave] readyTasks=${readyTasks.length} ids=[${readyTasks.map((t) => t.id).join(", ")}]`);
305+
console.log(
306+
`[executeNextWave] readyTasks=${readyTasks.length} ids=[${readyTasks.map((t) => t.id).join(", ")}]`,
307+
);
301308

302309
if (readyTasks.length === 0) {
303310
// Defer any PENDING tasks blocked by failed dependencies (unreachable)
@@ -450,16 +457,17 @@ export async function completeTask(
450457
// to avoid Phi-4/catalog model JSON parsing failures in the verifier
451458
const retryCount = run.retryCountByTask[taskId] ?? 0;
452459
const baseVerifierDecision = router.route(AgentRole.Verifier, task.sigmaEstimate);
453-
const verifierDecision = pendingFix || retryCount > 0
454-
? {
455-
...baseVerifierDecision,
456-
model: "gpt-4o-mini",
457-
providerConfig: baseVerifierDecision.providerConfig
458-
? { ...baseVerifierDecision.providerConfig, model: "gpt-4o-mini" }
459-
: baseVerifierDecision.providerConfig,
460-
reason: `${baseVerifierDecision.reason} (escalated: retry/fix re-verify)`,
461-
}
462-
: baseVerifierDecision;
460+
const verifierDecision =
461+
pendingFix || retryCount > 0
462+
? {
463+
...baseVerifierDecision,
464+
model: "gpt-4o-mini",
465+
providerConfig: baseVerifierDecision.providerConfig
466+
? { ...baseVerifierDecision.providerConfig, model: "gpt-4o-mini" }
467+
: baseVerifierDecision.providerConfig,
468+
reason: `${baseVerifierDecision.reason} (escalated: retry/fix re-verify)`,
469+
}
470+
: baseVerifierDecision;
463471
routingLog.push(verifierDecision);
464472
const verifier = await spawnAgent(runId, AgentRole.Verifier, taskId, verifierDecision.model);
465473
await updateAgentStatus(verifier.agentId, AgentStatus.Executing);
@@ -484,7 +492,9 @@ export async function completeTask(
484492
pushEvent(run, agentId, agentRole, "TASK_COMPLETED", `Task ${taskId} completed`);
485493
checkpointRun(run);
486494

487-
console.log(`[completeTask] Task ${taskId} completed (role=${agentRole}), triggering auto-advance`);
495+
console.log(
496+
`[completeTask] Task ${taskId} completed (role=${agentRole}), triggering auto-advance`,
497+
);
488498

489499
// Auto-advance: try to execute next wave of ready tasks
490500
executeNextWave(runId).catch((err) => {
@@ -588,16 +598,17 @@ export async function failTask(
588598
// Spawn Fixer agent — escalate to more reliable model on retries
589599
// On retry 2+, force gpt-4o-mini to avoid repeated failures from catalog models
590600
const baseFixerDecision = router.route(AgentRole.Builder, task.sigmaEstimate);
591-
const fixerDecision = retryCount >= 1
592-
? {
593-
...baseFixerDecision,
594-
model: "gpt-4o-mini",
595-
providerConfig: baseFixerDecision.providerConfig
596-
? { ...baseFixerDecision.providerConfig, model: "gpt-4o-mini" }
597-
: baseFixerDecision.providerConfig,
598-
reason: `${baseFixerDecision.reason} (escalated: fixer retry ${retryCount + 1})`,
599-
}
600-
: baseFixerDecision;
601+
const fixerDecision =
602+
retryCount >= 1
603+
? {
604+
...baseFixerDecision,
605+
model: "gpt-4o-mini",
606+
providerConfig: baseFixerDecision.providerConfig
607+
? { ...baseFixerDecision.providerConfig, model: "gpt-4o-mini" }
608+
: baseFixerDecision.providerConfig,
609+
reason: `${baseFixerDecision.reason} (escalated: fixer retry ${retryCount + 1})`,
610+
}
611+
: baseFixerDecision;
601612
routingLog.push(fixerDecision);
602613
const fixer = await spawnAgent(runId, AgentRole.Builder, taskId, fixerDecision.model);
603614
await updateAgentStatus(fixer.agentId, AgentStatus.Executing);
@@ -1079,7 +1090,9 @@ function checkBudget(run: RunState): Result<AgentState[]> {
10791090
const ceiling = run.lock.budgetCeiling;
10801091
const percentUsed = ceiling > 0 ? (currentSpend / ceiling) * 100 : 0;
10811092

1082-
console.log(`[checkBudget] run=${run.runId} spend=$${currentSpend.toFixed(4)} ceiling=$${ceiling} percent=${percentUsed.toFixed(1)}%`);
1093+
console.log(
1094+
`[checkBudget] run=${run.runId} spend=$${currentSpend.toFixed(4)} ceiling=$${ceiling} percent=${percentUsed.toFixed(1)}%`,
1095+
);
10831096

10841097
// Alert at 80%
10851098
if (percentUsed >= 80 && budgetCallback) {
@@ -1088,7 +1101,9 @@ function checkBudget(run: RunState): Result<AgentState[]> {
10881101

10891102
// Pause at 95%
10901103
if (percentUsed >= 95) {
1091-
console.log(`[checkBudget] BUDGET EXCEEDED 95% — deferring pending tasks and pausing run ${run.runId}`);
1104+
console.log(
1105+
`[checkBudget] BUDGET EXCEEDED 95% — deferring pending tasks and pausing run ${run.runId}`,
1106+
);
10921107
// Defer pending tasks
10931108
for (const task of run.plan.tasks) {
10941109
if (task.status === TaskStatus.Pending) {
@@ -1133,7 +1148,9 @@ function completeRun(run: RunState): void {
11331148
} else {
11341149
run.status = RunStatus.Completed;
11351150
}
1136-
console.log(`[completeRun] run=${run.runId} finalStatus=${run.status} hasFailed=${hasFailed} tasks=[${taskSummary}]`);
1151+
console.log(
1152+
`[completeRun] run=${run.runId} finalStatus=${run.status} hasFailed=${hasFailed} tasks=[${taskSummary}]`,
1153+
);
11371154
run.completedAt = new Date().toISOString();
11381155
checkpointRun(run);
11391156
notifyStatusChange(run.runId, run.status);

packages/foundry/src/routing/model-registry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ function initDefaults(): void {
4242
const foundryDeployment = process.env.FOUNDRY_DEPLOYMENT;
4343

4444
console.log(
45-
`[ModelRegistry] Initializing with endpoint=${azureEndpoint ? azureEndpoint.substring(0, 40) + "..." : "(empty)"}, ` +
46-
`key=${azureKey ? "***" + azureKey.slice(-4) : "(empty)"}, ` +
45+
`[ModelRegistry] Initializing with endpoint=${azureEndpoint ? `${azureEndpoint.substring(0, 40)}...` : "(empty)"}, ` +
46+
`key=${azureKey ? `***${azureKey.slice(-4)}` : "(empty)"}, ` +
4747
`anthropic=${anthropicKey ? "set" : "not set"}`,
4848
);
4949

packages/foundry/src/routing/providers/azure-openai.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ export class AzureOpenAIClient implements FoundryModelClient {
5656
messages: mappedMessages as OpenAI.ChatCompletionMessageParam[],
5757
...(reasoning ? {} : { temperature: options?.temperature }),
5858
...tokenParam,
59-
...(options?.responseFormat && !reasoning ? { response_format: { type: "json_object" } } : {}),
59+
...(options?.responseFormat && !reasoning
60+
? { response_format: { type: "json_object" } }
61+
: {}),
6062
};
6163

6264
// Try primary model with retries
@@ -110,7 +112,11 @@ export class AzureOpenAIClient implements FoundryModelClient {
110112
const fallbackClient = new OpenAI({
111113
apiKey: this.config.apiKey,
112114
baseURL: getAzureBaseURL(this.config.endpoint, fallbackModel),
113-
defaultQuery: getAzureDefaultQuery(this.config.endpoint, fallbackModel, this.config.apiVersion),
115+
defaultQuery: getAzureDefaultQuery(
116+
this.config.endpoint,
117+
fallbackModel,
118+
this.config.apiVersion,
119+
),
114120
defaultHeaders: { "api-key": this.config.apiKey },
115121
});
116122

packages/foundry/src/routing/types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@ export function getModelParams(
134134
): Record<string, unknown> {
135135
const reasoning = isReasoningModel(deployment);
136136
return {
137-
...(reasoning
138-
? { max_completion_tokens: opts.maxTokens }
139-
: { max_tokens: opts.maxTokens }),
137+
...(reasoning ? { max_completion_tokens: opts.maxTokens } : { max_tokens: opts.maxTokens }),
140138
...(reasoning ? {} : { temperature: opts.temperature }),
141139
...(!reasoning && opts.jsonMode && supportsJsonFormat(deployment)
142140
? { response_format: { type: "json_object" as const } }

scripts/smoke-test-models.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function buildTests(): ModelTest[] {
3333
const body: Record<string, unknown> = {
3434
model,
3535
messages: [
36-
{ role: "system", content: "Reply with exactly this json: {\"status\":\"ok\"}" },
36+
{ role: "system", content: 'Reply with exactly this json: {"status":"ok"}' },
3737
{ role: "user", content: "ping" },
3838
],
3939
...tokenParam,
@@ -56,7 +56,7 @@ function buildTests(): ModelTest[] {
5656
body: {
5757
model,
5858
messages: [
59-
{ role: "system", content: "Reply with valid json: {\"status\":\"ok\"}" },
59+
{ role: "system", content: 'Reply with valid json: {"status":"ok"}' },
6060
{ role: "user", content: "ping" },
6161
],
6262
max_tokens: 50,
@@ -75,7 +75,7 @@ function buildTests(): ModelTest[] {
7575
body: {
7676
model,
7777
messages: [
78-
{ role: "system", content: "Reply with exactly: {\"status\":\"ok\"}" },
78+
{ role: "system", content: 'Reply with exactly: {"status":"ok"}' },
7979
{ role: "user", content: "ping" },
8080
],
8181
max_tokens: 50,
@@ -103,15 +103,17 @@ async function runTest(test: ModelTest): Promise<void> {
103103
return;
104104
}
105105

106-
const json = await res.json() as {
106+
const json = (await res.json()) as {
107107
choices?: Array<{ message?: { content?: string } }>;
108108
model?: string;
109109
usage?: { total_tokens?: number };
110110
};
111111
const content = json.choices?.[0]?.message?.content ?? "(empty)";
112112
const tokens = json.usage?.total_tokens ?? "?";
113113
const returnedModel = json.model ?? "?";
114-
console.log(`✅ ${label} model=${returnedModel} tokens=${tokens} response="${content.slice(0, 80)}"`);
114+
console.log(
115+
`✅ ${label} model=${returnedModel} tokens=${tokens} response="${content.slice(0, 80)}"`,
116+
);
115117
} catch (err) {
116118
const msg = err instanceof Error ? err.message : String(err);
117119
console.log(`❌ ${label} ERROR: ${msg.slice(0, 200)}`);

0 commit comments

Comments
 (0)