From 7e74fe3a9b38e953f4cde2d2dc979e94932711ff Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Tue, 30 Jun 2026 13:12:27 -0700 Subject: [PATCH] FN-7293: honor workflow review revision overrides Allow workflow review steps to opt into unbounded or capped revision retries while keeping recovery caps accurate. - Add workflow settings for Plan Review and Code Review max revisions with display, docs, and changeset coverage. - Resolve optional-step revision budgets through workflow settings, node overrides, and existing fallback limits. - Track revision attempts per workflow step and hydrate slim self-healing rows before enforcing retry caps. - Cover unbounded, capped, per-step, and slim-row recovery behavior with focused tests. Files changed: .changeset/fn-7293-unbounded-review-revisions.md | 7 + docs/settings-reference.md | 12 +- docs/workflow-editor.md | 4 +- docs/workflow-steps.md | 3 +- .../builtin-workflow-settings-triage.test.ts | 28 +++- .../core/src/__tests__/builtin-workflows.test.ts | 29 ++++- .../__tests__/workflow-settings-resolver.test.ts | 73 +++++++++++ packages/core/src/builtin-plan-review-group.ts | 6 +- packages/core/src/builtin-workflow-settings.ts | 30 +++++ packages/core/src/index.ts | 5 + packages/core/src/workflow-ir-types.ts | 15 ++- packages/core/src/workflow-ir.ts | 5 +- packages/core/src/workflow-settings-resolver.ts | 49 ++++++- .../__tests__/WorkflowSettingsPanel.test.tsx | 52 ++++++++ .../app/components/workflow-setting-display.ts | 18 +++ packages/engine/src/__tests__/self-healing.test.ts | 143 ++++++++++++++++++++- .../workflow-graph-optional-step-fix.test.ts | 130 ++++++++++++++++++- packages/engine/src/executor.ts | 77 +++++++++-- packages/engine/src/self-healing.ts | 82 ++++++++++-- packages/engine/src/workflow-graph-executor.ts | 5 +- 20 files changed, 725 insertions(+), 48 deletions(-) Fusion-Task-Id: FN-7293 Fusion-Task-Lineage: 19ee533f-ab8d-4e20-9a27-9cf0cf6dfec9 Co-authored-by: Fusion (runfusion.ai) --- .../fn-7293-unbounded-review-revisions.md | 7 + docs/settings-reference.md | 12 +- docs/workflow-editor.md | 4 +- docs/workflow-steps.md | 3 +- .../builtin-workflow-settings-triage.test.ts | 28 +++- .../src/__tests__/builtin-workflows.test.ts | 29 +++- .../workflow-settings-resolver.test.ts | 73 +++++++++ .../core/src/builtin-plan-review-group.ts | 6 +- .../core/src/builtin-workflow-settings.ts | 30 ++++ packages/core/src/index.ts | 5 + packages/core/src/workflow-ir-types.ts | 15 +- packages/core/src/workflow-ir.ts | 5 +- .../core/src/workflow-settings-resolver.ts | 49 +++++- .../__tests__/WorkflowSettingsPanel.test.tsx | 52 +++++++ .../components/workflow-setting-display.ts | 18 +++ .../engine/src/__tests__/self-healing.test.ts | 143 +++++++++++++++++- .../workflow-graph-optional-step-fix.test.ts | 130 +++++++++++++++- packages/engine/src/executor.ts | 77 +++++++++- packages/engine/src/self-healing.ts | 82 ++++++++-- .../engine/src/workflow-graph-executor.ts | 5 +- 20 files changed, 725 insertions(+), 48 deletions(-) create mode 100644 .changeset/fn-7293-unbounded-review-revisions.md diff --git a/.changeset/fn-7293-unbounded-review-revisions.md b/.changeset/fn-7293-unbounded-review-revisions.md new file mode 100644 index 0000000000..6eedfaf40d --- /dev/null +++ b/.changeset/fn-7293-unbounded-review-revisions.md @@ -0,0 +1,7 @@ +--- +"@runfusion/fusion": patch +--- + +summary: Make built-in Plan Review and Code Review revisions unbounded unless workflows set a cap. +category: fix +dev: Adds workflow values planReviewMaxRevisions and codeReviewMaxRevisions for per-workflow caps, including read-only built-ins. diff --git a/docs/settings-reference.md b/docs/settings-reference.md index acad382d00..406de1cd39 100644 --- a/docs/settings-reference.md +++ b/docs/settings-reference.md @@ -269,7 +269,11 @@ Actions. It has two tabs: (Plan/Triage, Executor, Reviewer, and fallbacks declared by the workflow) use the same model dropdown picker as Project Models so clearing or selecting a model updates both keys together. Advanced/custom non-model settings still use typed - controls. Edits batch and commit through a single **Save** in the Values tab. + controls. Built-in Plan Review/spec and Code Review revision caps also live here: + leave `planReviewMaxRevisions` or `codeReviewMaxRevisions` empty for unbounded + automatic revisions, enter a non-negative integer to cap attempts, or enter `0` + to disable automatic revision for that path. Edits batch and commit through a + single **Save** in the Values tab. **How values resolve.** The engine resolves *effective settings* per task as `stored value ?? declaration default`. The task-detail Workflow, Chat, and Agent @@ -307,7 +311,7 @@ These groups moved out of project settings and into workflow settings (built-in | Group | Keys (examples) | |---|---| | **Step execution** | `workflowStepTimeoutMs`, `runStepsInNewSessions`, `maxParallelSteps`, `workflowStepScopeEnforcement`, `strictScopeEnforcement`, `verificationFixRetries`, `maxPostReviewFixes`, `buildRetryCount` | -| **Review / approval** | Workflow values: `requirePrApproval`, `requirePlanApproval`, `reviewHandoffPolicy`, `maxReviewerContextRetries`, `maxReviewerFallbackRetries`; project override: `planApprovalMode` | +| **Review / approval** | Workflow values: `requirePrApproval`, `requirePlanApproval`, `reviewHandoffPolicy`, `maxReviewerContextRetries`, `maxReviewerFallbackRetries`, `planReviewMaxRevisions`, `codeReviewMaxRevisions`; project override: `planApprovalMode` | | **Per-phase model lanes** | `executionProvider`/`executionModelId`, `planningProvider`/`planningModelId` (+ fallbacks), `validatorProvider`/`validatorModelId` (+ fallbacks) | ### Workflow-native triage policy settings @@ -335,6 +339,8 @@ The built-in workflows also declare triage/spec policy settings that were **not* | `triageDefaultWorkflowId` | `builtin:coding` | Default workflow for standard coding tasks and for existing tasks without an explicit user-requested or creator-owned workflow selection. | | `leanPlanning` | `false` | Workflow-native fast-mode policy: select the lean `planning-fast` prompt variant instead of the full triage spec prompt. | | `autoApproveSpec` | `false` | Legacy compatibility setting. Workflow Plan Review now owns optional pre-execution AI plan approval. | +| `planReviewMaxRevisions` | unset | Workflow-native Plan Review/spec revision cap. Unset/empty means unbounded automatic replans; a non-negative integer caps attempts; `0` disables automatic Plan Review revision. | +| `codeReviewMaxRevisions` | unset | Workflow-native Code Review remediation cap. Unset/empty means unbounded automatic code-fix passes; a non-negative integer caps attempts; `0` disables automatic Code Review remediation. | In the dashboard Settings modal, Project Models exposes Plan/Triage, Executor, Reviewer, and declared fallback dropdown controls for the default workflow. The @@ -562,7 +568,7 @@ Default notes: | `maxReviewerContextRetries` | `number` | `2` | Max reviewer context-compaction retries (FN-4082) per task. | | `maxReviewerFallbackRetries` | `number` | `2` | Max reviewer fallback-model retries (FN-4092) per task. | | `maxTotalRetriesBeforeFail` | `number` | `25` | Master retry budget across all tracked retry counters; exceeding this fails the task with `RetryStormError`. | -| `maxPostReviewFixes` | `number` | `3` | Default max automatic fix passes for review/pre-merge optional-step feedback, including self-healing auto-revival of in-review tasks failing pre-merge workflow steps. Individual `optional-group` workflow nodes can override this with `config.maxRevisions` (non-negative integer or `"unbounded"`). | +| `maxPostReviewFixes` | `number` | `3` | Default max automatic fix passes for generic review/pre-merge optional-step feedback, including self-healing auto-revival of in-review tasks failing pre-merge workflow steps. Individual `optional-group` workflow nodes can override this with `config.maxRevisions` (non-negative integer or `"unbounded"`). Built-in Plan Review/spec and Code Review use workflow values `planReviewMaxRevisions` / `codeReviewMaxRevisions` first, and are unbounded when those values are unset. | | `maxSpawnedAgentsPerParent` | `number` | `5` | Max child agents per parent task. | | `maxSpawnedAgentsGlobal` | `number` | `20` | Max spawned agents across one executor instance. | | `maintenanceIntervalMs` | `number` | `300000` | Periodic maintenance interval in ms (5 min). | diff --git a/docs/workflow-editor.md b/docs/workflow-editor.md index d8887db8b5..2c108faad2 100644 --- a/docs/workflow-editor.md +++ b/docs/workflow-editor.md @@ -132,7 +132,7 @@ Workflow settings are typed settings declared by a workflow in its IR. The edito The **Settings** panel has two tabs: - **Definitions:** edit the workflow's setting schema — id, name, type, default, enum options, description, and widget. This tab is read-only for built-in workflows and editable for custom workflows. Declarations save with the workflow IR through the editor's normal **Save** action. -- **Values:** edit per-project values for the currently open workflow. Values are writable even for built-in workflows. Edits batch locally and commit through the tab's dedicated **Save values** action, separate from the workflow IR save. +- **Values:** edit per-project values for the currently open workflow. Values are writable even for built-in workflows. This is where operators cap built-in Plan Review/spec and Code Review revision loops (`planReviewMaxRevisions`, `codeReviewMaxRevisions`) without duplicating the read-only workflow; empty values mean unbounded, non-negative integers cap attempts, and `0` disables automatic revision for that path. Edits batch locally and commit through the tab's dedicated **Save values** action, separate from the workflow IR save. Resolution is `stored value ?? declaration default`. Stored values that no longer validate against the current declaration are treated as orphaned and dropped from the effective settings the engine reads. The Values tab exposes provider/model lane pairs with the same model dropdown used elsewhere in Settings, while custom settings use controls based on their declared type. See [Settings Reference → Workflow Settings](./settings-reference.md#workflow-settings) for moved settings, model lane hierarchy, export behavior, and sync posture. @@ -179,7 +179,7 @@ Fusion ships built-in workflows as read-only references: - `builtin:design` — a UI-heavy work path with a gated design/UX review before standard review and merge. - `builtin:lead-generation` — a lead workflow for sourcing, qualifying, enriching, and contacting prospects. -Built-ins can be viewed, exported, and used as templates, but their graph, columns, field declarations, and setting declarations are not editable. Their per-project setting **values** are editable from the Settings panel's Values tab. Selectable built-ins all use a capacity-released queue column (`todo` or a workflow-specific backlog) that dispatches to the active WIP column through the standard hold/release sweep. +Built-ins can be viewed, exported, and used as templates, but their graph, columns, field declarations, and setting declarations are not editable. Their per-project setting **values** are editable from the Settings panel's Values tab, including the Plan Review/spec and Code Review revision-cap values that default to unbounded when left empty. Selectable built-ins all use a capacity-released queue column (`todo` or a workflow-specific backlog) that dispatches to the active WIP column through the standard hold/release sweep.