Skip to content

refactor: delete meta-task auto-archive and automated recovery follow-ups - #2461

Merged
gsxdsm merged 1 commit into
mainfrom
feature/delete-meta-task-recovery
Jul 27, 2026
Merged

refactor: delete meta-task auto-archive and automated recovery follow-ups#2461
gsxdsm merged 1 commit into
mainfrom
feature/delete-meta-task-recovery

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Deletes two pieces of automated "meta" machinery that filed and garbage-collected cards restating state already on the task that failed. Net -1015 lines.

Why

Automated recovery follow-ups. createAutomatedFollowup and its dedup engine (289 lines of signature matching, 1h recurrence rate-limiting, 24h supersedes windows) existed to file recovery cards for verification-cap and merge-conflict give-ups. In both cases the parent is already parked failed with a descriptive error and a log entry carrying the failing command, branch, and output — the card was a second copy of that.

Meta-task auto-archive. The sweeps that garbage-collected those cards were worse than redundant: the regex classifier matched ordinary feature work, and its positional fallback bound cards to unrelated tasks, so live work could be archived.

They are removed together, because the auto-archive sweeps only existed to clean up after the follow-up engine.

What changed

Deleted

  • packages/engine/src/verification-followup-dedup.ts in full — createAutomatedFollowup, decideAutomatedFollowup, AutomatedFollowupKind, computeVerificationFailureSignature, extractFailingTestFiles.
  • findActiveRecoveryFollowUp — dead code, defined and never called (tsc independently flagged it 6133 declared but its value is never read).
  • The meta-task auto-archive sweeps autoArchiveResolvedMetaTasks / autoArchiveStalledMetaTasks and helpers classifyMetaTask / resolveMetaTargetTaskId / computeMetaChainDepth / archiveMetaTask / evaluateMetaAutoArchiveGuards, plus settings metaTaskStallAutoCloseMs and metaTaskActiveExecutionGraceMs.
  • Run-audit types task:auto-archived-meta-resolved, task:auto-archived-meta-stalled, task:auto-archive-meta-resolved-skipped, task:auto-archive-meta-stalled-skipped, verification:followup-created, verification:followup-deduped.

The two signature helpers were deleted rather than relocated — once the three call sites went they were provably unreachable: buildVerificationFailureSignature had exactly one caller, and it was the only caller of extractFailingTestFiles.

Call sites 1 and 2 — park kept, card dropped

Verification-cap and merge-conflict give-ups keep their park, audit event, operator comment, and log entry. Site 1's error string was reworded off "See follow-up task for investigation." (no follow-up will exist) to carry the guidance itself. autoResolveDisabled was kept — it still drives the outer park guard and the reason string; only the inner branch that guarded card creation is gone.

Call site 3 — autostash orphan, replaced not deleted

This one is a genuine data-loss guard, so it keeps a durable trail. A live-classified orphan is a merger stash holding real uncommitted work, and unlike sites 1–2 there is no parked parent — the parent may already be done and merged, so nothing else on the board would ever mention the stash.

The card is replaced by a logEntry and an addTaskComment on the parent, preserving every fact the old description carried: the sha, record.label (the handle git stash recovery needs), record.detectedByTaskId, and sourcePhase. New truthful run-audit event task:autostash-orphan-live-detected replaces the borrowed verification:followup-* name, with ids/outcomes-only metadata per AGENTS.md.

Kept unchanged: the two real product features

Eval follow-ups (eval-followups.ts) and PR-comment follow-ups (pr-comment-handler.ts) only borrowed the shared engine for its dedup pass. Both keep their exact behavior, column, priority, sourceType, and log lines, with dedup inlined as a listTasks scan on suggestionId / prNumber respectively. Both fail open (create) if the listing throws, matching the old engine.

Test changes — read this one

Two tests asserted the deleted engine's rate-limited "[verification recurrence]" logEntry. Those assertions were removed, not loosened: both tests still assert no duplicate card is created, and the eval test still asserts the existing id is reported back. No coverage of surviving behavior was weakened. The three meta-* test files were deleted along with the sweeps they covered.

Verification

$ pnpm test:gate
 Test Files  2 passed (2)     Tests   10 passed (10)    # core
 Test Files  16 passed (16)   Tests  299 passed (299)   # engine-core
 Test Files  1 passed (1)     Tests   70 passed (70)    # ci-shape
GATE_EXIT=0

$ pnpm --filter @fusion/engine --filter @fusion/core exec tsc --noEmit -p tsconfig.json
TSC_EXIT=0   (no output)

Plus a file-scoped run over the touched surfaces (eval-followups, pr-comment-handler, merger-autostash-orphan-surface, merger-autostash-cleanup, run-audit, run-audit-secret-taxonomy, project-engine, project-engine-manager): 213/213 passed.

A repo-wide grep confirms no surviving references to any deleted symbol, module, or audit event.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Failed tasks now retain recovery and verification details directly on the original task instead of generating separate follow-up cards.
    • Live autostash issues now preserve stash information in task comments and activity logs.
    • Existing evaluation and pull-request follow-ups continue to be reused when appropriate.
  • Changes

    • Removed automatic archival of meta-tasks.
    • Removed obsolete meta-task timing settings.
  • Documentation

    • Updated architecture and settings documentation to reflect these workflow changes.

…-ups

Removes two coupled reliability layers whose cost exceeded their value.

Meta-task auto-archive: `classifyMetaTask` decided a card was a "meta-task"
via regex over title+description (/recover|unblock|finalize|meta/i), so
ordinary feature work qualified, and `resolveMetaTargetTaskId`'s fallback
then bound an unmatched card to an unrelated task by creation order. The
failure mode was auto-archiving live work. Both sweeps, all five helpers,
the two skip-audit memo maps, and settings `metaTaskStallAutoCloseMs` /
`metaTaskActiveExecutionGraceMs` are gone.

Automated recovery follow-ups: `verification-followup-dedup.ts` filed cards
that mostly restated state already durable on the parent. The verification
and merge-conflict call sites are deleted (parents still park `failed` with
a descriptive error, or log the auto-merge-gave-up entry). The dead
`findActiveRecoveryFollowUp` goes with them.

Preserved deliberately: the autostash-orphan path is the one caller carrying
information found nowhere else -- the parent may be `done` and merged, so
nothing else would ever mention a stash holding stranded uncommitted work.
It becomes a logEntry + addTaskComment retaining sha, stash label,
detectedByTaskId and sourcePhase, plus a truthful new run-audit event
`task:autostash-orphan-live-detected`.

Unchanged in behavior: eval and PR-comment follow-ups are product features,
not recovery plumbing. They borrowed this engine only for dedup, which is
now inlined per site on suggestionId / prNumber.

Run-audit types removed: task:auto-archived-meta-resolved,
task:auto-archived-meta-stalled, task:auto-archive-meta-resolved-skipped,
task:auto-archive-meta-stalled-skipped, verification:followup-created,
verification:followup-deduped.

Verified: engine + core `tsc --noEmit` exit 0, `pnpm lint` exit 0,
`pnpm build` exit 0, `pnpm test:gate` exit 0, `pnpm smoke:boot` PASS,
touched engine tests 38/38.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change removes meta-task auto-archiving and shared recovery follow-up creation. Failures remain on originating tasks with logs and comments, autostash orphans emit a dedicated audit event, and evaluation and PR-comment follow-ups retain inline open-task deduplication.

Changes

Task lifecycle cleanup

Layer / File(s) Summary
Settings contract removal
packages/core/src/types/settings-scope.ts, packages/core/src/settings-schema.ts, docs/settings-reference.md, packages/core/src/builtin-workflow-settings.ts, packages/dashboard/.../settings-default-descriptions.test.tsx
Removes the two meta-task timing settings from types, defaults, documentation, comments, and the dashboard allowlist.
Meta-task archival maintenance removal
packages/engine/src/self-healing.ts, packages/engine/src/__tests__/reliability-interactions/_helpers.ts, packages/engine/src/__tests__/self-healing-db-corruption.test.ts, packages/engine/src/run-audit.ts, docs/architecture.md
Deletes meta-task archival sweeps, classifiers, guards, memo state, and related audit variants while updating maintenance fixtures and documentation.
Inline follow-up deduplication
packages/engine/src/eval-followups.ts, packages/engine/src/pr-comment-handler.ts, packages/engine/src/__tests__/eval-followups.test.ts, packages/engine/src/__tests__/pr-comment-handler.test.ts
Moves open-task reuse into evaluation and PR-comment handlers, matching evaluation follow-ups by suggestion ID and PR follow-ups by PR number.
Direct failure reporting
packages/engine/src/project-engine.ts, packages/engine/src/run-audit.ts, packages/engine/src/verification-followup-dedup.ts, docs/architecture.md, .changeset/delete-meta-task-and-recovery-followups.md
Removes shared recovery follow-up creation and parks verification or merge-conflict failures on the original task; live autostash orphans write logs and comments and emit task:autostash-orphan-live-detected.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ProjectEngine
  participant TaskStore
  participant RunAuditor
  ProjectEngine->>TaskStore: Mark originating task failed
  ProjectEngine->>TaskStore: Write log entry and parent task comment
  ProjectEngine->>RunAuditor: Emit task:autostash-orphan-live-detected
Loading
sequenceDiagram
  participant FollowUpHandler
  participant TaskStore
  participant ExistingTask
  FollowUpHandler->>TaskStore: List candidate tasks
  TaskStore-->>FollowUpHandler: Open matching follow-up or no match
  FollowUpHandler->>ExistingTask: Reuse matching task
  FollowUpHandler->>TaskStore: Create triage follow-up when no match exists
Loading

Possibly related PRs

  • Runfusion/Fusion#1965: Updates verification follow-up deduplication tests and legacy archive behavior, directly related to this PR’s removal of the shared verification follow-up implementation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing meta-task auto-archive and automated recovery follow-up logic.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/delete-meta-task-recovery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR removes unsafe meta-task auto-archival and redundant recovery follow-up machinery while preserving durable failure and autostash-orphan signals.

  • Removes meta-task classification, archival sweeps, settings, audit types, and associated tests.
  • Parks verification-cap and merge-conflict failures on their original tasks without creating recovery cards.
  • Replaces live autostash-orphan cards with parent-task logs, comments, and a dedicated audit event.
  • Inlines existing-card detection for eval and PR-comment follow-ups.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified in the changed behavior.

The removed archival and recovery-card paths are consistently detached from maintenance, settings, audit types, and callers, while surviving eval, PR-feedback, failure-parking, and autostash recovery behavior remains represented.

Important Files Changed

Filename Overview
packages/engine/src/project-engine.ts Removes redundant recovery-card creation while retaining parent-task failure details and durable autostash recovery notices.
packages/engine/src/self-healing.ts Deletes heuristic meta-task classification and destructive auto-archive maintenance passes.
packages/engine/src/eval-followups.ts Preserves eval follow-up creation and open-card reuse through an inlined metadata scan.
packages/engine/src/pr-comment-handler.ts Preserves PR-feedback follow-up behavior with an inlined parent-and-PR deduplication check.
packages/engine/src/run-audit.ts Removes obsolete follow-up and meta-archive event types and adds a truthful live-autostash detection event.
packages/core/src/settings-schema.ts Removes defaults for settings whose corresponding maintenance machinery no longer exists.

Reviews (1): Last reviewed commit: "refactor: delete meta-task auto-archive ..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/engine/src/eval-followups.ts (2)

11-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated CLOSED_FOLLOWUP_COLUMNS dedup-column set across two files. Both files independently define the same "closed follow-up columns" concept as a byproduct of deleting the shared follow-up dedup engine; extracting a single shared constant (e.g. a small followup-dedup.ts util) would prevent the two from drifting out of sync if a terminal column is ever added or renamed.

  • packages/engine/src/eval-followups.ts#L11-L16: move CLOSED_FOLLOWUP_COLUMNS (and its explanatory comment) into a small shared module exported for both call sites.
  • packages/engine/src/pr-comment-handler.ts#L4-L9: import the shared CLOSED_FOLLOWUP_COLUMNS constant instead of redefining it locally.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/engine/src/eval-followups.ts` around lines 11 - 16, Extract
CLOSED_FOLLOWUP_COLUMNS and its explanatory comment from
packages/engine/src/eval-followups.ts lines 11-16 into a shared follow-up dedup
utility, exporting the constant for reuse. Update
packages/engine/src/pr-comment-handler.ts lines 4-9 to import the shared
constant and remove its local duplicate, preserving the existing closed-column
deduplication behavior in both call sites.

188-210: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Hoist listTasks out of the per-followUp loop to avoid N+1 store calls.

findOpenEvalFollowUpTaskId issues its own store.listTasks({ slim: true }) call, and materializeEvalFollowUps invokes it once per creatable followUp — so a run with several qualifying suggestions makes that many full task-list round trips. normalizeEvalFollowUps above already establishes the pattern of listing once and reusing the result across all drafts (Line 97); this new path should do the same.

♻️ Proposed fix: list once, filter in memory
-async function findOpenEvalFollowUpTaskId(
-  store: TaskStore,
-  parentTaskId: string,
-  suggestionId: string,
-): Promise<string | undefined> {
-  const tasks = await store.listTasks({ slim: true }).catch(() => []);
-  const match = tasks.find(
+function findOpenEvalFollowUpTaskId(
+  tasks: readonly Pick<Task, "id" | "column" | "sourceParentTaskId" | "sourceMetadata">[],
+  parentTaskId: string,
+  suggestionId: string,
+): string | undefined {
+  const match = tasks.find(
     (task) =>
       task.id !== parentTaskId &&
       !CLOSED_FOLLOWUP_COLUMNS.has(task.column) &&
       task.sourceParentTaskId === parentTaskId &&
       task.sourceMetadata?.suggestionId === suggestionId,
   );
   return match?.id;
 }
 export async function materializeEvalFollowUps(input: MaterializeEvalFollowUpsInput): Promise<EvalFollowUpSuggestion[]> {
   const { parentTaskId, runId, policyMode, overallScore, followUps, store } = input;
   const created: EvalFollowUpSuggestion[] = [];
+  const existingTasks = await store.listTasks({ slim: true }).catch(() => []);
 
   for (const followUp of followUps) {
     if (!followUp.recommendation.shouldCreate || followUp.state !== "suggested") {
       created.push(followUp);
       continue;
     }
 
-    const existingTaskId = await findOpenEvalFollowUpTaskId(store, parentTaskId, followUp.suggestionId);
+    const existingTaskId = findOpenEvalFollowUpTaskId(existingTasks, parentTaskId, followUp.suggestionId);

Also applies to: 221-256

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/engine/src/eval-followups.ts` around lines 188 - 210, Hoist the task
listing out of materializeEvalFollowUps and reuse one store.listTasks({ slim:
true }) result for all follow-ups. Update findOpenEvalFollowUpTaskId to accept
the preloaded task collection and only perform the existing in-memory filtering,
preserving its fail-open behavior by handling listing errors once at the caller.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/engine/src/eval-followups.ts`:
- Around line 11-16: Extract CLOSED_FOLLOWUP_COLUMNS and its explanatory comment
from packages/engine/src/eval-followups.ts lines 11-16 into a shared follow-up
dedup utility, exporting the constant for reuse. Update
packages/engine/src/pr-comment-handler.ts lines 4-9 to import the shared
constant and remove its local duplicate, preserving the existing closed-column
deduplication behavior in both call sites.
- Around line 188-210: Hoist the task listing out of materializeEvalFollowUps
and reuse one store.listTasks({ slim: true }) result for all follow-ups. Update
findOpenEvalFollowUpTaskId to accept the preloaded task collection and only
perform the existing in-memory filtering, preserving its fail-open behavior by
handling listing errors once at the caller.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b8cd6e5c-e801-4239-ae75-6b039c6e78bb

📥 Commits

Reviewing files that changed from the base of the PR and between f1a2d9a and 2af1748.

📒 Files selected for processing (20)
  • .changeset/delete-meta-task-and-recovery-followups.md
  • docs/architecture.md
  • docs/settings-reference.md
  • packages/core/src/builtin-workflow-settings.ts
  • packages/core/src/settings-schema.ts
  • packages/core/src/types/settings-scope.ts
  • packages/dashboard/app/components/settings/sections/__tests__/settings-default-descriptions.test.tsx
  • packages/engine/src/__tests__/eval-followups.test.ts
  • packages/engine/src/__tests__/pr-comment-handler.test.ts
  • packages/engine/src/__tests__/reliability-interactions/_helpers.ts
  • packages/engine/src/__tests__/reliability-interactions/meta-archive-guard-composition.test.ts
  • packages/engine/src/__tests__/reliability-interactions/meta-chain-auto-close.test.ts
  • packages/engine/src/__tests__/self-healing-db-corruption.test.ts
  • packages/engine/src/__tests__/self-healing-meta-archive-guards.test.ts
  • packages/engine/src/eval-followups.ts
  • packages/engine/src/pr-comment-handler.ts
  • packages/engine/src/project-engine.ts
  • packages/engine/src/run-audit.ts
  • packages/engine/src/self-healing.ts
  • packages/engine/src/verification-followup-dedup.ts
💤 Files with no reviewable changes (9)
  • packages/engine/src/tests/reliability-interactions/meta-archive-guard-composition.test.ts
  • packages/engine/src/tests/reliability-interactions/meta-chain-auto-close.test.ts
  • docs/settings-reference.md
  • packages/engine/src/tests/self-healing-meta-archive-guards.test.ts
  • packages/dashboard/app/components/settings/sections/tests/settings-default-descriptions.test.tsx
  • packages/engine/src/verification-followup-dedup.ts
  • packages/core/src/settings-schema.ts
  • packages/engine/src/tests/reliability-interactions/_helpers.ts
  • packages/engine/src/tests/self-healing-db-corruption.test.ts

@gsxdsm
gsxdsm merged commit 0e3d2a2 into main Jul 27, 2026
7 checks passed
@gsxdsm
gsxdsm deleted the feature/delete-meta-task-recovery branch July 27, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant