fix blocking hot path operations
This commit is contained in:
@@ -172,7 +172,7 @@ export class AgentReflectionService {
|
||||
const effectiveLimit = Math.max(1, limit);
|
||||
|
||||
const [tasks, recentRuns, agent] = await Promise.all([
|
||||
this.taskStore.listTasks(),
|
||||
this.taskStore.listTasks({ slim: true, includeArchived: false }),
|
||||
this.agentStore.getRecentRuns(agentId, effectiveLimit * 4),
|
||||
this.agentStore.getAgent(agentId),
|
||||
]);
|
||||
|
||||
@@ -719,7 +719,7 @@ export class TaskExecutor {
|
||||
* directly to in-review without spawning a new agent session.
|
||||
*/
|
||||
async resumeOrphaned(): Promise<void> {
|
||||
const tasks = await this.store.listTasks();
|
||||
const tasks = await this.store.listTasks({ slim: true, column: "in-progress" });
|
||||
const inProgress = tasks.filter(
|
||||
(t) => t.column === "in-progress" && !this.executing.has(t.id) && !t.paused,
|
||||
);
|
||||
@@ -888,7 +888,7 @@ export class TaskExecutor {
|
||||
|
||||
try {
|
||||
// Check dependencies
|
||||
const allTasks = await this.store.listTasks();
|
||||
const allTasks = await this.store.listTasks({ slim: true, includeArchived: false });
|
||||
const unmetDeps = task.dependencies.filter((depId) => {
|
||||
const dep = allTasks.find((t) => t.id === depId);
|
||||
return dep && dep.column !== "done" && dep.column !== "in-review" && dep.column !== "archived";
|
||||
|
||||
@@ -188,10 +188,11 @@ async function syncDependenciesForMerge(
|
||||
mergerLog.log(`${taskId}: syncing dependencies before merge build verification`);
|
||||
await store.logEntry(taskId, `Syncing dependencies before merge build verification: ${installCommand}`);
|
||||
try {
|
||||
execSync(installCommand, {
|
||||
await execAsync(installCommand, {
|
||||
cwd: rootDir,
|
||||
encoding: "utf-8",
|
||||
stdio: "pipe",
|
||||
maxBuffer: 10 * 1024 * 1024,
|
||||
timeout: 300_000,
|
||||
});
|
||||
} catch (error: any) {
|
||||
const details = error?.stderr || error?.stdout || error?.message || String(error);
|
||||
@@ -859,7 +860,7 @@ export async function findWorktreeUser(
|
||||
worktreePath: string,
|
||||
excludeTaskId: string,
|
||||
): Promise<string | null> {
|
||||
const tasks = await store.listTasks();
|
||||
const tasks = await store.listTasks({ slim: true, includeArchived: false });
|
||||
for (const t of tasks) {
|
||||
if (t.id === excludeTaskId) continue;
|
||||
if (t.worktree === worktreePath && t.column !== "done") {
|
||||
|
||||
@@ -126,7 +126,7 @@ export class MissionExecutionLoop extends EventEmitter {
|
||||
* This handles the case where the engine was shut down mid-validation
|
||||
* or mid-fix, ensuring those features continue their loop progression.
|
||||
*/
|
||||
async recoverActiveMissions(): Promise<void> {
|
||||
async recoverActiveMissions(): Promise<{ recoveredCount: number }> {
|
||||
loopLog.log("Starting active mission recovery...");
|
||||
|
||||
try {
|
||||
@@ -188,8 +188,10 @@ export class MissionExecutionLoop extends EventEmitter {
|
||||
}
|
||||
|
||||
loopLog.log(`Active mission recovery complete: recovered ${recoveredCount} features`);
|
||||
return { recoveredCount };
|
||||
} catch (err) {
|
||||
loopLog.error("Error during active mission recovery:", err);
|
||||
return { recoveredCount: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -452,7 +452,7 @@ export class Scheduler {
|
||||
this.scheduling = true;
|
||||
|
||||
try {
|
||||
const tasks = await this.store.listTasks();
|
||||
const tasks = await this.store.listTasks({ slim: true, includeArchived: false });
|
||||
const settings = await this.store.getSettings();
|
||||
const maxConcurrent = settings.maxConcurrent ?? this.options.maxConcurrent ?? 2;
|
||||
const maxWorktrees = settings.maxWorktrees ?? this.options.maxWorktrees ?? 4;
|
||||
|
||||
@@ -422,7 +422,7 @@ export class SelfHealingManager {
|
||||
if (!recoverFn) return 0;
|
||||
|
||||
try {
|
||||
const tasks = await this.store.listTasks();
|
||||
const tasks = await this.store.listTasks({ slim: true, column: "in-progress" });
|
||||
const executingIds = this.options.getExecutingTaskIds?.() ?? new Set<string>();
|
||||
|
||||
const stuckCompleted = tasks.filter((t) =>
|
||||
@@ -465,7 +465,7 @@ export class SelfHealingManager {
|
||||
*/
|
||||
async recoverMergeableReviewTasks(): Promise<number> {
|
||||
try {
|
||||
const tasks = await this.store.listTasks();
|
||||
const tasks = await this.store.listTasks({ slim: true, column: "in-review" });
|
||||
|
||||
const mergeable = tasks.filter((t) =>
|
||||
t.column === "in-review" &&
|
||||
@@ -516,7 +516,7 @@ export class SelfHealingManager {
|
||||
*/
|
||||
async recoverMergedReviewTasks(): Promise<number> {
|
||||
try {
|
||||
const tasks = await this.store.listTasks();
|
||||
const tasks = await this.store.listTasks({ slim: true, column: "in-review" });
|
||||
|
||||
const mergedButNotDone = tasks.filter((t) =>
|
||||
t.column === "in-review" &&
|
||||
@@ -569,7 +569,7 @@ export class SelfHealingManager {
|
||||
*/
|
||||
async recoverMisclassifiedFailures(): Promise<number> {
|
||||
try {
|
||||
const tasks = await this.store.listTasks();
|
||||
const tasks = await this.store.listTasks({ slim: true, column: "in-review" });
|
||||
|
||||
const misclassified = tasks.filter((t) =>
|
||||
t.column === "in-review" &&
|
||||
@@ -618,7 +618,7 @@ export class SelfHealingManager {
|
||||
*/
|
||||
async recoverOrphanedExecutions(): Promise<number> {
|
||||
try {
|
||||
const tasks = await this.store.listTasks();
|
||||
const tasks = await this.store.listTasks({ slim: true, column: "in-progress" });
|
||||
const executingIds = this.options.getExecutingTaskIds?.() ?? new Set<string>();
|
||||
const now = Date.now();
|
||||
|
||||
@@ -687,7 +687,7 @@ export class SelfHealingManager {
|
||||
if (!recoverFn) return 0;
|
||||
|
||||
try {
|
||||
const tasks = await this.store.listTasks();
|
||||
const tasks = await this.store.listTasks({ slim: true, column: "triage" });
|
||||
const specifyingIds = this.options.getSpecifyingTaskIds?.() ?? new Set<string>();
|
||||
const now = Date.now();
|
||||
|
||||
|
||||
@@ -464,7 +464,7 @@ export class TriageProcessor {
|
||||
}
|
||||
this.wasEnginePaused = false;
|
||||
|
||||
const tasks = await this.store.listTasks();
|
||||
const tasks = await this.store.listTasks({ slim: true, column: "triage" });
|
||||
const now = Date.now();
|
||||
const triageTasks = tasks.filter(
|
||||
(t) => t.column === "triage" && !this.processing.has(t.id) && !t.paused
|
||||
@@ -868,7 +868,7 @@ export class TriageProcessor {
|
||||
"and dependencies for each. Use to check for duplicates before specifying.",
|
||||
parameters: Type.Object({}),
|
||||
execute: async () => {
|
||||
const tasks = await store.listTasks();
|
||||
const tasks = await store.listTasks({ slim: true, includeArchived: false });
|
||||
const active = tasks.filter((t) => t.column !== "done");
|
||||
if (active.length === 0) {
|
||||
return {
|
||||
|
||||
@@ -378,7 +378,7 @@ export async function scanOrphanedBranches(rootDir: string, store: TaskStore): P
|
||||
if (allBranches.length === 0) return [];
|
||||
|
||||
// Build set of branches associated with active (non-archived, non-merger-managed) tasks
|
||||
const tasks = await store.listTasks();
|
||||
const tasks = await store.listTasks({ slim: true, includeArchived: false });
|
||||
const activeBranches = new Set<string>();
|
||||
for (const task of tasks) {
|
||||
// Skip tasks in columns where the merger handles branch cleanup
|
||||
|
||||
Reference in New Issue
Block a user