diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e53136585..19d21c4c3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ checkpoint, and status-only commits are intentionally omitted. ### Fixed +- Ignored non-SHA likely-owner provenance values when rendering public commit + links, avoiding broken `/commit/...` URLs in review comments. Thanks @samzong. - Gave manual exact-item review dispatches their own concurrency group so targeted maintainer reviews no longer wait behind broad normal backfill runs. - Downgraded screenshot-only browser runtime proof so ClawSweeper no longer accepts "no visible console/CSP violation" screenshots as sufficient real behavior proof. Thanks @BunsDev. diff --git a/src/clawsweeper.ts b/src/clawsweeper.ts index a3f3d61c51..1672a3e173 100644 --- a/src/clawsweeper.ts +++ b/src/clawsweeper.ts @@ -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)}`); } @@ -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(", "); diff --git a/test/clawsweeper.test.ts b/test/clawsweeper.test.ts index 6d3fa821bb..d036816c93 100644 --- a/test/clawsweeper.test.ts +++ b/test/clawsweeper.test.ts @@ -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",