Skip to content

Commit 6a82b43

Browse files
Allow up to ten repair attempts (#14)
1 parent fba9084 commit 6a82b43

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,4 @@ connection guide in
215215
protected branches and paths, oversized or unrelated diffs, stale heads, and
216216
failed validation; it then creates a Covencat-attributed non-force commit and
217217
queues a fresh review of the new SHA. The loop stops after the configured
218-
`max_attempts` (clamped to 1-3) or on repeated findings or non-progress.
218+
`max_attempts` (clamped to 1-10) or on repeated findings or non-progress.

docs/coven-github-connection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ file reads, searches, PR text, and model narratives are never execution proof.
124124
Autoreview and branch repair are independent repository opt-ins. Configure
125125
`autoreview.enabled` for exact-SHA reviews and optionally `include_drafts`.
126126
Configure `repair.enabled` only for trusted same-repository branches, with
127-
`max_attempts` from 1 through 3, bounded `allowed_paths`, `protected_paths`,
127+
`max_attempts` from 1 through 10, bounded `allowed_paths`, `protected_paths`,
128128
`protected_branches`, `max_changed_files`, and `max_diff_bytes`. Repair sessions
129129
receive file tools only; the host performs validation, commit, and non-force push
130130
with a fresh repository-scoped installation token. Set `kill_switch` at the

src/adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ function repairPolicy(policy: JsonObject): JsonObject {
695695

696696
function boundedRepairAttempts(policy: JsonObject): number {
697697
const requested = Number(repairPolicy(policy).max_attempts || 2);
698-
return Number.isFinite(requested) ? Math.max(1, Math.min(3, Math.trunc(requested))) : 2;
698+
return Number.isFinite(requested) ? Math.max(1, Math.min(10, Math.trunc(requested))) : 2;
699699
}
700700

701701
function globPatternMatches(patternValue: JsonValue | undefined, path: string): boolean {

tests/webhook-adapter.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,11 @@ test("repair eligibility fails closed for forks, protected branches, limits, rep
858858
assert.equal(repairEligibilityIssue({...task, target: {...(task.target as JsonObject), head_repo_id: 2}}, result, policy), "repair_fork_or_untrusted_head");
859859
assert.equal(repairEligibilityIssue({...task, target: {...(task.target as JsonObject), head_ref: "main"}}, result, policy), "repair_protected_branch");
860860
assert.equal(repairEligibilityIssue({...task, repair_iteration: 2}, result, policy), "repair_attempt_limit_reached");
861+
const tenAttemptPolicy = {...policy, repair: {enabled: true, max_attempts: 10}};
862+
assert.equal(repairEligibilityIssue({...task, repair_iteration: 9}, result, tenAttemptPolicy), null);
863+
assert.equal(repairEligibilityIssue({...task, repair_iteration: 10}, result, tenAttemptPolicy), "repair_attempt_limit_reached");
864+
const overLimitPolicy = {...policy, repair: {enabled: true, max_attempts: 100}};
865+
assert.equal(repairEligibilityIssue({...task, repair_iteration: 10}, result, overLimitPolicy), "repair_attempt_limit_reached");
861866
assert.equal(repairEligibilityIssue(task, result, {...policy, kill_switch: true}), "repository_kill_switch");
862867
const signatureProbe = {...task, repair_history: [{finding_signature: "placeholder"}]};
863868
const initialIssue = repairEligibilityIssue(signatureProbe, result, policy);

0 commit comments

Comments
 (0)