Skip to content
Draft
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
13 changes: 13 additions & 0 deletions .github/scripts/issue-quality.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ const REPRODUCTION_ALIASES = [
"Stack trace",
];

const ISSUE_QUALITY_MARKER = "<!-- opencodex-issue-quality-bot -->";
const ISSUE_QUALITY_STATE_PREFIX = "<!-- opencodex-issue-quality-state:";

function isCanonicalIssueQualityComment(comment) {
return (
comment?.user?.login === "github-actions[bot]" &&
String(comment.body || "").startsWith(
`${ISSUE_QUALITY_MARKER}\n${ISSUE_QUALITY_STATE_PREFIX}`,
)
);
}

function extractEnvironmentField(environment, names) {
if (environment == null) return null;
const wanted = new Set(names.map((name) => name.toLowerCase()));
Expand Down Expand Up @@ -92,4 +104,5 @@ module.exports = {
detectIssueKind,
validateIssue,
normalizeEquivalentBugEvidence,
isCanonicalIssueQualityComment,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Single-source the canonical comment format.

The exported predicate owns the marker and state-prefix constants, but the workflow still declares independent BOT_MARKER and STATE_RE values at Line 888 and Line 889. If the definitions diverge, the workflow can ignore its own persisted state, create duplicate comments, or miss maintainerOverride. Export the shared values or expose shared parse and format helpers for detection, parsing, and emission.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/issue-quality.cjs at line 107, Update the workflow’s comment
detection and emission logic near BOT_MARKER, STATE_RE, and
isCanonicalIssueQualityComment to reuse the canonical marker and state-prefix
definitions owned by the exported predicate. Export the shared constants or
provide parse/format helpers, then remove the duplicate workflow-local values so
persisted state and maintainerOverride handling stay consistent.

};
36 changes: 36 additions & 0 deletions .github/scripts/issue-quality.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const {
looksLikeUntemplatedBugReport,
shouldReopen,
shouldEnforceClosure,
isCanonicalIssueQualityComment,
labelForKind,
AREA_LABELS,
mapAreaFieldToLabels,
Expand Down Expand Up @@ -1453,6 +1454,41 @@ describe("shouldEnforceClosure", () => {
});
});

describe("isCanonicalIssueQualityComment", () => {
const marker = "<!-- opencodex-issue-quality-bot -->";
const state = '<!-- opencodex-issue-quality-state:{"maintainerOverride":true} -->';

it("accepts the issue-quality workflow's canonical state comment", () => {
assert.equal(
isCanonicalIssueQualityComment({
user: { login: "github-actions[bot]" },
body: `${marker}\n${state}\n\n### Maintainer decision respected`,
}),
true,
);
});

it("rejects another bot workflow's comment containing spoofed state", () => {
assert.equal(
isCanonicalIssueQualityComment({
user: { login: "github-actions[bot]" },
body: `<!-- opencodex-issue-translator -->\n\n${marker}\n${state}`,
}),
false,
);
});

it("rejects a matching comment from a non-actions author", () => {
assert.equal(
isCanonicalIssueQualityComment({
user: { login: "reporter" },
body: `${marker}\n${state}`,
}),
false,
);
});
});

// ---------------------------------------------------------------------------
// Translated / soft-pass / labels
// ---------------------------------------------------------------------------
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/enforce-issue-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ jobs:
validateIssue,
shouldReopen,
shouldEnforceClosure,
isCanonicalIssueQualityComment,
labelForKind,
detectAreaLabels,
AREA_LABELS,
Expand Down Expand Up @@ -890,9 +891,7 @@ jobs:
const comments = await github.paginate(github.rest.issues.listComments, {
owner, repo, issue_number, per_page: 100,
});
const botComment = comments.find(
(c) => c.user?.login === "github-actions[bot]" && c.body?.includes(BOT_MARKER),
);
const botComment = comments.find(isCanonicalIssueQualityComment);

let botState = null;
if (botComment) {
Expand Down
Loading