fix(self-healing): use slim listTasks in maintenance recover loops

Batch 2 of runMaintenance() runs ~10 recover passes back-to-back, each
calling listTasks({ column: ... }) without slim. On busy boards this
materializes every task's activity log into memory ~10× per cycle,
walking the dashboard heap toward the 8 GB V8 limit until OOM. The
archive pass at line 610 already had this fix; extend it to the in-progress
and in-review recover passes that only read steps / paused / worktree /
mergeDetails / postReviewFixCount — all included in the slim projection.

Triage recovers are left non-slim because hasLatestSpecReviewApproval
scans task.log to find the most recent spec review; the triage column
is small so the memory cost is bounded.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-24 22:25:31 -07:00
parent c814f3dfbe
commit 18bae531de
2 changed files with 45 additions and 10 deletions

View File

@@ -661,7 +661,7 @@ export class SelfHealingManager {
if (!recoverFn) return 0;
try {
const tasks = await this.store.listTasks({ column: "in-progress" });
const tasks = await this.store.listTasks({ column: "in-progress", slim: true });
const executingIds = this.options.getExecutingTaskIds?.() ?? new Set<string>();
const stuckCompleted = tasks.filter((t) =>
@@ -704,7 +704,7 @@ export class SelfHealingManager {
*/
async recoverMergeableReviewTasks(): Promise<number> {
try {
const tasks = await this.store.listTasks({ column: "in-review" });
const tasks = await this.store.listTasks({ column: "in-review", slim: true });
const mergeable = tasks.filter((t) =>
t.column === "in-review" &&
@@ -770,7 +770,7 @@ export class SelfHealingManager {
const maxFixes = settings.maxPostReviewFixes ?? 1;
if (!Number.isFinite(maxFixes) || maxFixes <= 0) return 0;
const tasks = await this.store.listTasks({ column: "in-review" });
const tasks = await this.store.listTasks({ column: "in-review", slim: true });
const executingIds = this.options.getExecutingTaskIds?.() ?? new Set<string>();
const candidates = tasks.filter((task) => {
@@ -858,7 +858,7 @@ export class SelfHealingManager {
if (!timeoutMs || timeoutMs <= 0) return 0;
const now = Date.now();
const tasks = await this.store.listTasks({ column: "in-review" });
const tasks = await this.store.listTasks({ column: "in-review", slim: true });
const staleIncomplete = tasks.filter((task) =>
task.column === "in-review" &&
!task.paused &&
@@ -914,7 +914,7 @@ export class SelfHealingManager {
const timeoutMs = settings.taskStuckTimeoutMs;
if (!timeoutMs || timeoutMs <= 0) return 0;
const tasks = await this.store.listTasks({ column: "in-review" });
const tasks = await this.store.listTasks({ column: "in-review", slim: true });
const candidates = tasks.filter((task) =>
task.column === "in-review" &&
Boolean(task.status && ACTIVE_MERGE_STATUSES.has(task.status)) &&
@@ -994,7 +994,7 @@ export class SelfHealingManager {
*/
async recoverMergedReviewTasks(): Promise<number> {
try {
const tasks = await this.store.listTasks({ column: "in-review" });
const tasks = await this.store.listTasks({ column: "in-review", slim: true });
const mergedButNotDone = tasks.filter((t) =>
t.column === "in-review" &&
@@ -1047,7 +1047,7 @@ export class SelfHealingManager {
*/
async recoverMisclassifiedFailures(): Promise<number> {
try {
const tasks = await this.store.listTasks({ column: "in-review" });
const tasks = await this.store.listTasks({ column: "in-review", slim: true });
const misclassified = tasks.filter((t) =>
t.column === "in-review" &&
@@ -1096,7 +1096,7 @@ export class SelfHealingManager {
*/
async recoverOrphanedExecutions(): Promise<number> {
try {
const tasks = await this.store.listTasks({ column: "in-progress" });
const tasks = await this.store.listTasks({ column: "in-progress", slim: true });
const executingIds = this.options.getExecutingTaskIds?.() ?? new Set<string>();
const now = Date.now();
@@ -1164,7 +1164,7 @@ export class SelfHealingManager {
*/
async recoverNoProgressNoTaskDoneFailures(): Promise<number> {
try {
const tasks = await this.store.listTasks({ column: "in-progress" });
const tasks = await this.store.listTasks({ column: "in-progress", slim: true });
const executingIds = this.options.getExecutingTaskIds?.() ?? new Set<string>();
const candidates = tasks.filter((task) =>
@@ -1237,7 +1237,7 @@ export class SelfHealingManager {
*/
async recoverPartialProgressNoTaskDoneFailures(): Promise<number> {
try {
const tasks = await this.store.listTasks({ column: "in-review" });
const tasks = await this.store.listTasks({ column: "in-review", slim: true });
const candidates = tasks.filter((task) =>
task.column === "in-review" &&