Skip to content
Open
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 src/clawsweeper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3606,6 +3606,10 @@ function shortSha(sha: string): string {
return sha.slice(0, 12);
}

function isCommitSha(value: string): boolean {
return /^[0-9a-f]{7,40}$/i.test(value.trim());
}

function releaseUrl(tag: string): string {
return repoUrl(`/releases/tag/${encodeURIComponent(tag)}`);
}
Expand Down Expand Up @@ -4095,7 +4099,8 @@ function likelyOwnerLine(owner: LikelyOwner): string {
const role = owner.role.trim();
const reason = sentence(owner.reason.trim() || "Related by repository history.");
const commits = owner.commits
.filter(Boolean)
.map((commit) => commit.trim())
.filter(isCommitSha)
.slice(0, 3)
.map((commit) => linkedSha(commit))
.join(", ");
Expand Down
26 changes: 26 additions & 0 deletions test/clawsweeper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,32 @@ test("close comments suppress duplicate best solution text", () => {
assert.doesNotMatch(action.closeComment, /Best possible solution:/);
});

test("likely owner commit links ignore non-sha values", () => {
const action = reviewActionForDecision({
item: item(),
decision: closeDecision({
likelyOwners: [
{
person: "@alice",
role: "feature contributor",
reason: "The changelog credits a pull request for this feature surface.",
commits: ["https://github.com/openclaw/openclaw/pull/76079", " abcdef1234567890 "],
files: ["CHANGELOG.md"],
confidence: "medium",
},
],
}),
git,
});

assert.equal(action.actionTaken, "proposed_close");
assert.doesNotMatch(action.closeComment, /\/commit\/https:/);
assert.match(
action.closeComment,
/\[abcdef123456\]\(https:\/\/github\.com\/openclaw\/openclaw\/commit\/abcdef1234567890\)/,
);
});

test("skill-only OpenClaw PRs can close through ClawHub with upload guidance", () => {
const decision = closeDecision({
closeReason: "clawhub",
Expand Down