Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bin/contributor-relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,9 @@ const RELAY_CAPABILITIES = ['quota_preflight_v1', 'run-stage', 'fix_pr_interrupt
// fix is DEFERRED and runs before the next `ready`.
// A fix never replaces currentTask: the primary lease stays owned and renewed.
const FIX_PR_KIND = 'fix-pr';
// Every follow-up commit must be signed off or the PR bounces to no-dco
// (hivecommons/hive#14605).
const FIX_PR_SIGNOFF_REQUIREMENT = 'REQUIRED: every follow-up commit MUST carry a Signed-off-by trailer β€” commit with `git commit -s`, and run `git rebase --signoff` before pushing if any new commit lacks one.';
const FIX_PR_MAX_PARALLEL = Math.max(0, Math.min(16, Number(process.env.HIVE_MAX_PARALLEL_FIXES || 1) || 0));
const FIX_PR_DONE_MARKER = 'HIVE_FIX_PR_DONE';
const FIX_PR_FAILED_MARKER = 'HIVE_FIX_PR_FAILED';
Expand Down Expand Up @@ -4017,7 +4020,9 @@ function headlessProgressTick(task) {
const WORKSPACE_DIR_VARIABLE = /\$\{?HIVE_WORKSPACE_DIR\}?/g;
function resolveTaskPrompt(task) {
const prompt = task.prompt || `Work on ${task.kind} ${task.repo}#${task.number}: ${task.title}`;
return prompt.replace(WORKSPACE_DIR_VARIABLE, TASK_WORKSPACE_DIR);
const resolved = prompt.replace(WORKSPACE_DIR_VARIABLE, TASK_WORKSPACE_DIR);
if (task.kind !== FIX_PR_KIND) return resolved;
return `${resolved}\n\n${FIX_PR_SIGNOFF_REQUIREMENT}`;
}

// installRepoToolchain runs bin/repo-toolchain.sh against the task's checkout
Expand Down
10 changes: 10 additions & 0 deletions bin/contributor-relay.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14243,6 +14243,16 @@ test('#7908 resolveTaskPrompt leaves a prompt without the variable untouched and
} finally { teardown(relay); }
});

test('#14605 resolveTaskPrompt requires sign-off on fix-pr tasks only', () => {
const relay = loadRelay({});
try {
const fix = relay.resolveTaskPrompt({ kind: 'fix-pr', prompt: 'fix it' });
assert.ok(fix.startsWith('fix it'), 'original prompt is kept');
assert.ok(fix.includes('git commit -s') && fix.includes('git rebase --signoff') && fix.includes('Signed-off-by'));
assert.ok(!relay.resolveTaskPrompt({ kind: 'issue', prompt: 'do it' }).includes('Signed-off-by'));
} finally { teardown(relay); }
});

// ---------------------------------------------------------------------------
// hivecommons/hive#7907 β€” the verdict is judged on a settled pane, not the
// capture that discovered it.
Expand Down
1 change: 1 addition & 0 deletions changelog.d/fixed-14605.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Review-fix and relay fix-pr prompts now require Signed-off-by on every follow-up commit (#14605)
1 change: 1 addition & 0 deletions src/pkg/review/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,7 @@ func BuildFixPrompt(pr PullRequest, agg Aggregate, attempt, maxAttempts int) str
}
fmt.Fprintf(&b, "Auto-fix attempt %d of %d. Stay narrowly scoped to the review findings below; push a new commit to the PR branch.\n\n", attempt, maxAttempts)
fmt.Fprintf(&b, "When committing the fix, include this exact git trailer so rework metrics can count the attempt: Hive-Fix-Attempt: %d/%d\n\n", attempt, maxAttempts)
b.WriteString("REQUIRED: every follow-up commit MUST carry a Signed-off-by trailer β€” create it with `git commit -s`, and run `git rebase --signoff` before pushing if any new commit lacks one. An unsigned fix commit bounces the PR to no-dco.\n\n")
if req := pr.HumanChangeRequest; req != nil && strings.TrimSpace(req.Body) != "" {
b.WriteString(humanChangeRequestPromptSection(*req))
}
Expand Down
3 changes: 3 additions & 0 deletions src/pkg/review/dispatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ func TestBuildFixPromptAndCapExhaustion(t *testing.T) {
if !strings.Contains(prompt, "nil panic") || !strings.Contains(prompt, "attempt 1") || !strings.Contains(prompt, "Hive-Fix-Attempt: 1/") || !strings.Contains(prompt, "acme/hive#7") {
t.Fatalf("fix prompt missing expected context:\n%s", prompt)
}
if !strings.Contains(prompt, "git commit -s") || !strings.Contains(prompt, "git rebase --signoff") || !strings.Contains(prompt, "Signed-off-by") {
t.Fatalf("fix prompt must require sign-off on follow-up commits:\n%s", prompt)
}
state := DispatchState{}
for i := 1; i <= escalation.MaxReEngagements; i++ {
state.Fixes = append(state.Fixes, PendingFix{Repo: "acme/hive", Number: 7, HeadSHA: "old", Attempts: i})
Expand Down
Loading