From 25247a034062bd27a75467cf8362e6b9c90ff76e Mon Sep 17 00:00:00 2001 From: Timothy Wayne Gregg <5861166+romgenie@users.noreply.github.com> Date: Tue, 14 Jul 2026 23:22:20 -0400 Subject: [PATCH] Allow up to ten repair attempts --- README.md | 2 +- docs/coven-github-connection.md | 2 +- src/adapter.ts | 2 +- tests/webhook-adapter.test.ts | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5152f03..732befb 100644 --- a/README.md +++ b/README.md @@ -215,4 +215,4 @@ connection guide in protected branches and paths, oversized or unrelated diffs, stale heads, and failed validation; it then creates a Covencat-attributed non-force commit and queues a fresh review of the new SHA. The loop stops after the configured - `max_attempts` (clamped to 1-3) or on repeated findings or non-progress. + `max_attempts` (clamped to 1-10) or on repeated findings or non-progress. diff --git a/docs/coven-github-connection.md b/docs/coven-github-connection.md index 8346903..cf0ae0b 100644 --- a/docs/coven-github-connection.md +++ b/docs/coven-github-connection.md @@ -124,7 +124,7 @@ file reads, searches, PR text, and model narratives are never execution proof. Autoreview and branch repair are independent repository opt-ins. Configure `autoreview.enabled` for exact-SHA reviews and optionally `include_drafts`. Configure `repair.enabled` only for trusted same-repository branches, with -`max_attempts` from 1 through 3, bounded `allowed_paths`, `protected_paths`, +`max_attempts` from 1 through 10, bounded `allowed_paths`, `protected_paths`, `protected_branches`, `max_changed_files`, and `max_diff_bytes`. Repair sessions receive file tools only; the host performs validation, commit, and non-force push with a fresh repository-scoped installation token. Set `kill_switch` at the diff --git a/src/adapter.ts b/src/adapter.ts index 5bcb450..2e671e1 100644 --- a/src/adapter.ts +++ b/src/adapter.ts @@ -695,7 +695,7 @@ function repairPolicy(policy: JsonObject): JsonObject { function boundedRepairAttempts(policy: JsonObject): number { const requested = Number(repairPolicy(policy).max_attempts || 2); - return Number.isFinite(requested) ? Math.max(1, Math.min(3, Math.trunc(requested))) : 2; + return Number.isFinite(requested) ? Math.max(1, Math.min(10, Math.trunc(requested))) : 2; } function globPatternMatches(patternValue: JsonValue | undefined, path: string): boolean { diff --git a/tests/webhook-adapter.test.ts b/tests/webhook-adapter.test.ts index 6d3cbea..2cbf088 100644 --- a/tests/webhook-adapter.test.ts +++ b/tests/webhook-adapter.test.ts @@ -858,6 +858,11 @@ test("repair eligibility fails closed for forks, protected branches, limits, rep assert.equal(repairEligibilityIssue({...task, target: {...(task.target as JsonObject), head_repo_id: 2}}, result, policy), "repair_fork_or_untrusted_head"); assert.equal(repairEligibilityIssue({...task, target: {...(task.target as JsonObject), head_ref: "main"}}, result, policy), "repair_protected_branch"); assert.equal(repairEligibilityIssue({...task, repair_iteration: 2}, result, policy), "repair_attempt_limit_reached"); + const tenAttemptPolicy = {...policy, repair: {enabled: true, max_attempts: 10}}; + assert.equal(repairEligibilityIssue({...task, repair_iteration: 9}, result, tenAttemptPolicy), null); + assert.equal(repairEligibilityIssue({...task, repair_iteration: 10}, result, tenAttemptPolicy), "repair_attempt_limit_reached"); + const overLimitPolicy = {...policy, repair: {enabled: true, max_attempts: 100}}; + assert.equal(repairEligibilityIssue({...task, repair_iteration: 10}, result, overLimitPolicy), "repair_attempt_limit_reached"); assert.equal(repairEligibilityIssue(task, result, {...policy, kill_switch: true}), "repository_kill_switch"); const signatureProbe = {...task, repair_history: [{finding_signature: "placeholder"}]}; const initialIssue = repairEligibilityIssue(signatureProbe, result, policy);