Skip to content

Commit 8129f2b

Browse files
committed
fix(triage): use issue form without label permission
1 parent 4ee6bfd commit 8129f2b

3 files changed

Lines changed: 73 additions & 14 deletions

File tree

‎.github/triage/PLAYBOOK.md‎

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,35 @@ of `main` for that work, never the tag-pinned diagnosis clone.
104104

105105
- Match the structure of the `via-triage` issue template
106106
(`.github/ISSUE_TEMPLATE/via-triage.yml` in the repo): what happened, diagnosis,
107-
repro steps, environment, evidence, related issues.
108-
- Label it `via-triage`. Use a plain, specific title with no prefix.
107+
repro steps, version, environment, evidence, related issues, workaround, and
108+
agent/model attribution. Use a plain, specific title with no prefix.
109109
- Show the user the complete final issue text and get an explicit yes before
110110
posting. Never post without it.
111-
- Note at the end of the issue which model and agent produced it.
112-
- If `gh` is not authenticated, offer `gh auth login`, or build a prefilled
113-
https://github.com/pingdotgg/t3code/issues/new URL with title and body query
114-
parameters; print the URL, and open it in their browser only after they
115-
approve.
111+
- Before filing through `gh`, check the authenticated account's label permission:
112+
113+
gh api repos/pingdotgg/t3code --jq '.permissions.triage or .permissions.push or .permissions.admin'
114+
115+
Only if this returns `true`, use `gh issue create --repo pingdotgg/t3code`
116+
with `--label via-triage`, a title, and the approved report via `--body-file`.
117+
Confirm the created issue has the label. If creation reports an error, check
118+
whether it created an issue before retrying. If an issue exists without the
119+
label, report that to the user; do not create a duplicate.
120+
121+
- If `gh` is missing, unauthenticated, the permission check fails, or label
122+
permission is absent, use the issue form, which applies `via-triage` for the
123+
user. Select it with this URL:
124+
125+
https://github.com/pingdotgg/t3code/issues/new?template=via-triage.yml
126+
127+
Prefill `title` and the individual form fields using URL-encoded values:
128+
`what-happened`, `diagnosis`, `steps`, `version`, `environment`, `evidence`,
129+
`related`, `workaround`, and `agent`. Do not use `body` or `labels` query
130+
parameters. Print the URL and open it in their browser only after they
131+
approve; the user reviews and submits the form. If the URL is too long to
132+
open reliably, provide the bare form URL and the approved report with each
133+
field clearly separated for pasting. If authentication is the only obstacle
134+
to direct filing, you may also offer `gh auth login`.
135+
116136
- If the user pasted screenshots, remind them to drag the images into the issue
117137
after it is created; they cannot be attached from here.
118138

‎apps/server/src/cli/triagePrompt.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@ it("seed prompt names the context file and embeds the playbook", () => {
2929
assert.include(prompt, TRIAGE_PLAYBOOK);
3030
});
3131

32+
it("seed prompt selects the triage form and names its current prefill fields", () => {
33+
const prompt = buildTriageSeedPrompt("/tmp/triage-run/context.md");
34+
const filing = prompt.split("## 8. File the issue well")[1]!.split("## 9. Redact")[0]!;
35+
const formUrl = filing.match(
36+
/https:\/\/github\.com\/pingdotgg\/t3code\/issues\/new\?template=[^\s`]+/,
37+
);
38+
assert.ok(formUrl, "ordinary contributors need the labeled issue form");
39+
assert.equal(new URL(formUrl[0]).searchParams.get("template"), "via-triage.yml");
40+
const form = NodeFS.readFileSync(
41+
NodePath.join(import.meta.dirname, "../../../../.github/ISSUE_TEMPLATE/via-triage.yml"),
42+
"utf8",
43+
);
44+
for (const [, fieldId] of form.matchAll(/^\s+id: ([\w-]+)$/gm)) {
45+
assert.include(filing, `\`${fieldId}\``);
46+
}
47+
assert.include(filing, ".permissions.triage");
48+
assert.include(filing, "explicit yes before");
49+
});
50+
3251
it("launch prompt stays a single argv-safe line naming the prompt file", () => {
3352
// The launch argument goes through cmd.exe on Windows (.cmd shims), which
3453
// cannot carry newlines; the playbook itself must stay on disk.

‎apps/server/src/cli/triagePrompt.ts‎

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,35 @@ of \`main\` for that work, never the tag-pinned diagnosis clone.
116116
117117
- Match the structure of the \`via-triage\` issue template
118118
(\`.github/ISSUE_TEMPLATE/via-triage.yml\` in the repo): what happened, diagnosis,
119-
repro steps, environment, evidence, related issues.
120-
- Label it \`via-triage\`. Use a plain, specific title with no prefix.
119+
repro steps, version, environment, evidence, related issues, workaround, and
120+
agent/model attribution. Use a plain, specific title with no prefix.
121121
- Show the user the complete final issue text and get an explicit yes before
122122
posting. Never post without it.
123-
- Note at the end of the issue which model and agent produced it.
124-
- If \`gh\` is not authenticated, offer \`gh auth login\`, or build a prefilled
125-
https://github.com/pingdotgg/t3code/issues/new URL with title and body query
126-
parameters; print the URL, and open it in their browser only after they
127-
approve.
123+
- Before filing through \`gh\`, check the authenticated account's label permission:
124+
125+
gh api repos/pingdotgg/t3code --jq '.permissions.triage or .permissions.push or .permissions.admin'
126+
127+
Only if this returns \`true\`, use \`gh issue create --repo pingdotgg/t3code\`
128+
with \`--label via-triage\`, a title, and the approved report via \`--body-file\`.
129+
Confirm the created issue has the label. If creation reports an error, check
130+
whether it created an issue before retrying. If an issue exists without the
131+
label, report that to the user; do not create a duplicate.
132+
133+
- If \`gh\` is missing, unauthenticated, the permission check fails, or label
134+
permission is absent, use the issue form, which applies \`via-triage\` for the
135+
user. Select it with this URL:
136+
137+
https://github.com/pingdotgg/t3code/issues/new?template=via-triage.yml
138+
139+
Prefill \`title\` and the individual form fields using URL-encoded values:
140+
\`what-happened\`, \`diagnosis\`, \`steps\`, \`version\`, \`environment\`, \`evidence\`,
141+
\`related\`, \`workaround\`, and \`agent\`. Do not use \`body\` or \`labels\` query
142+
parameters. Print the URL and open it in their browser only after they
143+
approve; the user reviews and submits the form. If the URL is too long to
144+
open reliably, provide the bare form URL and the approved report with each
145+
field clearly separated for pasting. If authentication is the only obstacle
146+
to direct filing, you may also offer \`gh auth login\`.
147+
128148
- If the user pasted screenshots, remind them to drag the images into the issue
129149
after it is created; they cannot be attached from here.
130150

0 commit comments

Comments
 (0)