Skip to content

Commit b16a7ae

Browse files
committed
Merge remote-tracking branch 'origin/dev' into merge980
2 parents d40367c + 880d2e6 commit b16a7ae

214 files changed

Lines changed: 27132 additions & 1168 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## Verification
66

77
- List the commands or checks you ran.
8+
- If this PR changes the GUI, include a screenshot of the UI change in the description.
89

910
## Checklist
1011

‎.github/scripts/enforce-pr-target.test.cjs‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ describe("enforce-pr-target workflow", () => {
4848
assert.match(workflow, /synchronize/);
4949
});
5050

51-
it("checks out trusted default-branch scripts only (never PR head)", () => {
52-
assert.match(workflow, /actions\/checkout@[0-9a-f]{40}/);
53-
assert.match(workflow, /ref:\s*\$\{\{\s*github\.event\.repository\.default_branch\s*\}\}/);
54-
assert.match(workflow, /sparse-checkout:\s*\.github\/scripts/);
55-
assert.match(workflow, /persist-credentials:\s*false/);
51+
it("checks out trusted base-branch scripts only (never PR head)", () => {
52+
// Scope the assertions to the checkout step itself, so a stray `ref:` on
53+
// another step cannot satisfy the pin while the checkout stays mutable.
54+
const checkoutStep = workflow
55+
.split("- name: Checkout trusted PR-quality scripts")[1]
56+
.split(/\n {6}- name:/)[0];
57+
assert.match(checkoutStep, /actions\/checkout@[0-9a-f]{40}/);
58+
assert.match(checkoutStep, /ref:\s*\$\{\{\s*github\.event\.pull_request\.base\.sha\s*\}\}/);
59+
// The readiness ping reads MAINTAINERS.md from the same trusted checkout.
60+
assert.match(checkoutStep, /sparse-checkout:\s*\|\s*\n\s*\.github\/scripts\n\s*MAINTAINERS\.md/);
61+
assert.match(checkoutStep, /persist-credentials:\s*false/);
5662
assert.doesNotMatch(workflow, /ref:\s*\$\{\{\s*github\.event\.pull_request\.head/);
5763
});
5864

@@ -75,9 +81,9 @@ describe("enforce-pr-target workflow", () => {
7581

7682
it("strips stale WRONG BRANCH prefix on failure when base is corrected", () => {
7783
const failureBlock = workflow.match(
78-
/if \(failures\.length > 0\) \{([\s\S]*?)core\.setFailed\(/,
84+
/if \(mustDraft\) \{([\s\S]*?)core\.setFailed\(/,
7985
);
80-
assert.ok(failureBlock, "workflow must have a failure path");
86+
assert.ok(failureBlock, "workflow must have a draft path");
8187
const failurePath = failureBlock[1];
8288
assert.match(failurePath, /shouldStripTitlePrefix/);
8389
assert.match(failurePath, /!hasWrongBase/);

‎.github/scripts/issue-quality.cjs‎

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,12 +729,94 @@ function isTooTerseFeatureSection(text) {
729729
}
730730

731731
/**
732-
* Bug Reproduction needs steps or concrete signals. A title-like phrase with
733-
* no commands, paths, digits, or product keywords is not actionable.
732+
* Bug Reproduction needs concrete signals that let a maintainer reproduce the
733+
* failure. Product keywords alone (e.g. "choose model deepseek" or "send a
734+
* message in the codex plugin") are not actionable: the report must name a
735+
* command, an error, a file/config path, or an exact observed output.
734736
*/
737+
// Commands and exact technical actions, e.g. "ocx start", "run bun",
738+
// "send a streaming request", "curl https://...".
739+
const REPRO_COMMAND_RE = new RegExp([
740+
"\\b(?:run|start|stop|restart|install|launch|execute|reproduce|trigger|invoke)\\s+(?:(?:the|an|a)\\s+)?(?:ocx|bun|npm|pnpm|yarn|curl|node|codex|proxy|server|dashboard|plugin)\\b",
741+
"\\b(?:ocx|bun|npm|pnpm|yarn|curl|node|codex)\\s+(?:start|run|stop|restart|install|config|--[a-z-]+)\\b",
742+
"\\b(?:send|issue|make|post)\\s+(?:a|an|any)\\s+(?:streaming|api|http|json|completion|chat|config|auth|embedding|post|graphql|grpc)\\s+(?:request|call|command|prompt|query)\\b",
743+
"\\b(?:send|issue|make|post)\\s+(?:a|an|any)\\s+(?:api|curl|endpoint|url)\\b",
744+
"\\b(?:send|issue|make|post)\\s+(?:a|an|any)\\s+[\\w.-]+\\s+request\\s+to\\s+(?:the\\s+)?(?:endpoint|url|api|server|proxy|\\S+/\\S+)\\b",
745+
"\\b(?:pip|npm|bun)\\s+install\\b",
746+
"\\b(?:curl|wget)\\s+[^\\s]+",
747+
].join("|"), "i");
748+
749+
// Error, exception, and failure tokens, plus status codes in status context
750+
// (bare 3-digit numbers can be ports or version numbers).
751+
const REPRO_FAILURE_RE = new RegExp([
752+
"\\b(?:segfault|sigsegv|panic|abort|exception|traceback|stack\\s*trace|timeout|timed\\s*out|refused|reset|denied|failed?|error|crash|hang|hangs?|stuck|spinning|empty\\s*response)\\b",
753+
"\\b(?:status\\s*(?:code\\s*)?|code\\s*|http\\s*)(?:is|of|:)?\\s*[1-5]\\d\\d\\b",
754+
].join("|"), "i");
755+
756+
// File, config, and log paths such as ~/.codex/config.toml or C:\\logs\\ocx.log.
757+
const REPRO_PATH_RE = new RegExp([
758+
"~?/[\\w.@-]+(?:/[\\w.@-]+)+",
759+
"[A-Za-z]:\\\\(?:[\\w.@-]+\\\\)+[\\w.@-]+",
760+
"~?/[\\w.@-]+/[\\w.@-]+\\.(?:json|yaml|yml|toml|conf|log|env|txt|ts|js|tsx|jsx|sh|ps1|py)",
761+
"[\\w.@-]+\\.(?:json|yaml|yml|toml|conf|log|env)\\b",
762+
].join("|"));
763+
const ACTIONABLE_REPRO_RE = new RegExp(
764+
[REPRO_COMMAND_RE.source, REPRO_FAILURE_RE.source, REPRO_PATH_RE.source].join("|"),
765+
"i",
766+
);
767+
768+
// Sigil-only fences with no body content are never actionable.
769+
const EMPTY_FENCE_RE = /^[ \t]{0,3}(?:```+|~~~+)\s*\n\s*\n[ \t]{0,3}(?:```+|~~~+)\s*$/;
770+
771+
/**
772+
* True when a bug Reproduction names commands, error tokens, file/config
773+
* paths, or exact technical actions. Product/model mentions without any of
774+
* those signals (e.g. #977) are treated as unactionable. Fenced blocks only
775+
* count as actionable when their body contains non-whitespace content.
776+
*/
777+
function hasActionableReproductionDetail(text) {
778+
const c = clean(text);
779+
if (!c) return false;
780+
if (ACTIONABLE_REPRO_RE.test(c)) return true;
781+
// Fenced blocks: only count when the body has non-whitespace content.
782+
if (/```|~~~/.test(c)) {
783+
const parts = stripFencedActionableContent(c);
784+
if (parts) return true;
785+
}
786+
return false;
787+
}
788+
789+
/**
790+
* Walk the text looking for a fenced code block whose body contains
791+
* non-whitespace content. Returns the non-empty body or null.
792+
*/
793+
function stripFencedActionableContent(text) {
794+
const fenceRe = /^[ \t]{0,3}(`{3,}|~{3,})/;
795+
const lines = text.split("\n");
796+
let i = 0;
797+
while (i < lines.length) {
798+
const m = lines[i].match(fenceRe);
799+
if (!m) { i++; continue; }
800+
const marker = m[1];
801+
const markerLen = marker.length;
802+
// Find the closing fence on a later line.
803+
let j = i + 1;
804+
const endRe = new RegExp(
805+
`^[ \\t]{0,3}${marker[0] === "`" ? "`" : "~"}{${markerLen},}[ \\t]*$`,
806+
);
807+
while (j < lines.length && !endRe.test(lines[j])) j++;
808+
if (j > i + 1) {
809+
const body = lines.slice(i + 1, j).join("\n");
810+
if (body.trim()) return body;
811+
}
812+
i = j + 1;
813+
}
814+
return null;
815+
}
816+
735817
function isTooTerseBugReproduction(text) {
736818
if (isEmpty(text) || isPlaceholder(text)) return false;
737-
if (hasConcreteDetail(text)) return false;
819+
if (hasActionableReproductionDetail(text)) return false;
738820
return countWords(text) < 12;
739821
}
740822

@@ -1221,6 +1303,7 @@ module.exports = {
12211303
isUnusableVersion,
12221304
countWords,
12231305
hasConcreteDetail,
1306+
hasActionableReproductionDetail,
12241307
labelForKind,
12251308
KIND_TO_LABEL,
12261309
AREA_LABELS,

‎.github/scripts/issue-quality.test.cjs‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const {
2222
isUnusableVersion,
2323
countWords,
2424
hasConcreteDetail,
25+
hasActionableReproductionDetail,
2526
rejectsWorkflowDispatchPullRequest,
2627
rejectsWorkflowDispatchNonDefaultBranch,
2728
} = require("./issue-quality.cjs");
@@ -465,6 +466,25 @@ describe("validateIssue - feature", () => {
465466
assert.ok(vagueResult.reasons.some((r) => r.includes("too vague")));
466467
});
467468

469+
it("treats only commands, errors, paths, or exact actions as actionable reproduction detail", () => {
470+
assert.equal(hasActionableReproductionDetail("1. choose model deepseek\n2. send a message in codex plugin"), false);
471+
assert.equal(hasActionableReproductionDetail("I want to work with deepseek in VSCode, but it dont reply"), false);
472+
assert.equal(hasActionableReproductionDetail("1. ocx start --port 10100\n2. Send a request"), true);
473+
assert.equal(hasActionableReproductionDetail("Run ocx start and send any streaming request."), true);
474+
assert.equal(hasActionableReproductionDetail("ocx start on Raspberry Pi 4, send any streaming request."), true);
475+
assert.equal(hasActionableReproductionDetail("send a request"), false);
476+
assert.equal(hasActionableReproductionDetail("make a call"), false);
477+
assert.equal(hasActionableReproductionDetail("post a command"), false);
478+
assert.equal(hasActionableReproductionDetail("make an API call"), true);
479+
assert.equal(hasActionableReproductionDetail("send an HTTP request"), true);
480+
assert.equal(hasActionableReproductionDetail("send a request to /v1/responses"), true);
481+
assert.equal(hasActionableReproductionDetail("The proxy returns HTTP 502 after the first streaming chunk."), true);
482+
assert.equal(hasActionableReproductionDetail("Paste ~/.codex/config.toml, then restart the proxy."), true);
483+
assert.equal(hasActionableReproductionDetail("```\n\n```"), false);
484+
assert.equal(hasActionableReproductionDetail("~~~\n\n~~~"), false);
485+
assert.equal(hasActionableReproductionDetail("```\nSIGSEGV at 0x0000\n```"), true);
486+
});
487+
468488
it("rejects fenced placeholder-only examples", () => {
469489
const fencedPlaceholders = [
470490
"```\nN/A\n```",
@@ -867,6 +887,41 @@ describe("validateIssue - bug", () => {
867887
assert.ok(result.reasons.some((r) => /Reproduction/i.test(r) && /vague/i.test(r)));
868888
});
869889

890+
it("rejects a #977-shaped bug with product keywords but no actionable reproduction", () => {
891+
const body = [
892+
"### Client or integration",
893+
"Other",
894+
"### Area",
895+
"Proxy and routing",
896+
"### Summary",
897+
"I want to work with deepseek in VSCode, but it dont reply,just thinking",
898+
"### Reproduction",
899+
"1.choose model deepseek",
900+
"2.send a message in codex plugin",
901+
"### Version",
902+
"2.10.0",
903+
"### Operating system",
904+
"Ubuntu 24.04",
905+
"### Provider and model",
906+
"deepseek",
907+
].join("\n");
908+
const result = validateIssue({
909+
title: "Dont work in VSCode Codex plugin",
910+
body,
911+
labels: ["bug", "proxy"],
912+
});
913+
assert.equal(result.kind, "bug");
914+
assert.equal(result.valid, false);
915+
assert.ok(
916+
result.reasons.some((r) => /Reproduction/i.test(r) && /vague/i.test(r)),
917+
`Expected a vague Reproduction reason, got: ${result.reasons.join("; ")}`,
918+
);
919+
assert.ok(
920+
result.guidance.some((g) => /commands|steps/i.test(g)),
921+
`Expected reproduction guidance, got: ${result.guidance.join("; ")}`,
922+
);
923+
});
924+
870925
it("rejects unknown Operating system stand-ins on the new bug form", () => {
871926
const body = [
872927
"### Client or integration",

‎.github/scripts/pr-labeler.cjs‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,35 @@ function detectTypeLabelFromTitle(title) {
5555
return null;
5656
}
5757

58+
/**
59+
* Type from the PR's own commits, for titles the title matcher cannot classify.
60+
*
61+
* A PR titled `stack 3/5: carry six contributor bug fixes` fails the
62+
* conventional regex (the `3/5` sits between the word and the colon) and then
63+
* reaches the sentence-case fallback, which extracts `stack`. That has no entry
64+
* in PREFIX_TO_LABEL, so the sync skips — and a skip is not a failure, so the
65+
* `label` check stays green while the PR carries no type label at all. The
66+
* commits underneath are conventional (`fix(codex): ...`), so they can answer
67+
* the question the title cannot.
68+
*
69+
* `chore` is supporting, not competing. `test:`, `ci:`, `chore:`, `style:`,
70+
* `refactor:`, and `build:` all map to it, and none of them says what a PR is
71+
* FOR. Requiring unanimity would abstain on almost every real PR: #955 is four
72+
* `fix(codex):` commits plus one `test(codex):`, and it is a bug fix.
73+
*
74+
* Anything still ambiguous after that (`fix:` alongside `feat:`) stays
75+
* unlabeled rather than guessed.
76+
*/
77+
function detectTypeLabelFromCommits(messages) {
78+
const types = new Set();
79+
for (const message of Array.isArray(messages) ? messages : []) {
80+
const detected = detectTypeLabelFromTitle(String(message || "").split("\n")[0]);
81+
if (detected) types.add(detected);
82+
}
83+
if (types.size > 1) types.delete("chore");
84+
return types.size === 1 ? [...types][0] : null;
85+
}
86+
5887
/**
5988
* True when a human (any non-bot actor) has ever labeled or unlabeled a managed
6089
* type label on this PR. Mirrors issue-quality's sticky maintainerOverride:
@@ -105,7 +134,11 @@ function planTypeLabelSync(input) {
105134
return { skip: true, reason: "human-override" };
106135
}
107136

108-
const detected = detectTypeLabelFromTitle(title);
137+
// The title is authoritative when it classifies. The commits only answer for
138+
// titles it cannot (`stack 3/5: ...`), so a well-formed title is never
139+
// overridden by what happens to be committed under it.
140+
const detected =
141+
detectTypeLabelFromTitle(title) ?? detectTypeLabelFromCommits(input?.commitMessages);
109142
if (!detected) {
110143
return { skip: true, reason: "no-prefix" };
111144
}
@@ -121,6 +154,7 @@ module.exports = {
121154
TYPE_LABELS,
122155
BOT_ACTORS,
123156
detectTypeLabelFromTitle,
157+
detectTypeLabelFromCommits,
124158
hasHumanTypeLabelOverride,
125159
planTypeLabelSync,
126160
};

0 commit comments

Comments
 (0)