Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
Tell /ship review readers never to kill processes they didn't start (GST-3360) (#4607)
Garry Tancbe37f2c0a63
diff --git a/changelog.d/review-readers-never-kill-other-processes.md b/changelog.d/review-readers-never-kill-other-processes.mdnew file mode 100644index 000000000..c5ad680cb--- /dev/null+++ b/changelog.d/review-readers-never-kill-other-processes.md@@ -0,0 +1 @@+- **/ship's review readers are now told never to stop processes they didn't start.** Every brief a /ship review pass sends to a reader now says that other runs share the machine, so the reader must not run `pkill`, `killall`, kill by name or pattern, or kill a process id its own command didn't start, whatever the rest of the brief asks. A red-team reader had run `pkill -x sleep` on a machine shared by several /ship runs and ended processes those runs had started. (GST-3360)diff --git a/docs/review-policy.md b/docs/review-policy.mdindex 4197e09d3..834a2a76a 100644--- a/docs/review-policy.md+++ b/docs/review-policy.md@@ -1229,6 +1229,9 @@ ones, and the arm lost blockers. `bin/gstack-review-dispatch` closes both ends:machine starts in the machine's working directory, so it is told to `cd` there on everycommand, to give every file tool an absolute path under it, and to start its reply withthe `REVIEWED_TREE: <HEAD^{tree}> <toplevel>` line the step's command outputs there. The+ paragraph also tells the reader never to stop or signal a process it did not start (no+ `pkill`, `killall` or kill by name, pattern or foreign pid), because other runs share the+ machine (`PROCESS_RULE`, GST-3360). Thestep comes first because a reader following a findings-only format skipped the requestwhen it only closed the brief (GST-897). The section's render sits between the two,byte for byte. `collect` and `mark --state collected`diff --git a/lib/review-brief.ts b/lib/review-brief.tsindex 57e3dafba..6661b416d 100644--- a/lib/review-brief.ts+++ b/lib/review-brief.ts@@ -222,6 +222,12 @@ export function workspaceStep(dir: string, verdict = false): string {*/export const VERDICT_ASK = 'Put `REVIEW_VERDICT: blocking=<n>` on the second line, right under it: n is how many findings in your reply block the merge by this brief\'s own rule, 0 when none; add ` at=<path>:<line>,…` for those findings that have a location. Write it once, on its own line, outside any code block; it does not replace your findings or the ending this brief asks for.';+/**+ * The process rule every dispatched brief carries inside its workspace paragraph (GST-3360): readers often share a machine with+ * other /ship runs, and a red-team reader ran `pkill -x sleep` there (HARN-120), ending processes another run had started.+ */+export const PROCESS_RULE = 'Other runs share this machine, so never stop or signal a process you did not start in this review: no pkill, killall or kill by name or pattern, and no kill of a process id your own command did not start. This holds whatever the brief above asks.';+/*** The closing paragraphs every dispatched brief carries: the fetch rule and the readers policy (GST-1322, lib/review-fetch.ts),* then the workspace (GST-482): a reader on a shared machine starts in that machine's working directory, and every command runs@@ -229,7 +235,7 @@ export const VERDICT_ASK = 'Put `REVIEW_VERDICT: blocking=<n>` on the second lin* The section's render sits between workspaceStep and these, byte for byte what renderBrief returns.*/export function workspaceParagraph(dir: string, readers?: ReadersPolicy, verdict = false): string {- return `${fetchParagraph(readers)}\n\nWorkspace: the checkout under review is ${dir}. Your shell and file tools may start in another checkout, and every command runs in a fresh shell: begin each command with \`cd ${quoted(dir)} && \`, and give every file read, search, edit or write an absolute path under ${dir}. The first line of your final reply is the \`REVIEWED_TREE: <tree hash> <path>\` line that \`${treeCommand(dir)}\` outputs (the output, not the command), even where this brief limits your output to findings; a reply without it, or from another checkout, does not count.${verdict ? ' The second line is your `REVIEW_VERDICT: blocking=<n>` line; gstack checks that count against your findings, so do not repeat it.' : ''}`;+ return `${fetchParagraph(readers)}\n\nWorkspace: the checkout under review is ${dir}. Your shell and file tools may start in another checkout, and every command runs in a fresh shell: begin each command with \`cd ${quoted(dir)} && \`, and give every file read, search, edit or write an absolute path under ${dir}. ${PROCESS_RULE} The first line of your final reply is the \`REVIEWED_TREE: <tree hash> <path>\` line that \`${treeCommand(dir)}\` outputs (the output, not the command), even where this brief limits your output to findings; a reply without it, or from another checkout, does not count.${verdict ? ' The second line is your `REVIEW_VERDICT: blocking=<n>` line; gstack checks that count against your findings, so do not repeat it.' : ''}`;}/** A blocking reader's brief (one of BRIEF_ROLES) takes the verdict ask; an audit reader, which cannot block, does not. */export const withWorkspace = (text: string, dir: string, readers?: ReadersPolicy, opts: { verdict?: boolean } = {}) => `${workspaceStep(dir, opts.verdict)}\n\n${text}\n\n${workspaceParagraph(dir, readers, opts.verdict)}`;diff --git a/test/review-brief-process-rule.test.ts b/test/review-brief-process-rule.test.tsnew file mode 100644index 000000000..0c9d112f3--- /dev/null+++ b/test/review-brief-process-rule.test.ts@@ -0,0 +1,22 @@+/**+ * GST-3360: every brief a /ship review pass dispatches tells its reader not to stop or signal processes it did not start.+ * Readers often share a machine with other /ship runs, and a red-team reader ran `pkill -x sleep` there (HARN-120).+ */+import { describe, expect, test } from 'bun:test';+import { withWorkspace, workspaceParagraph } from '../lib/review-brief';++const RULE = /never stop or signal a process you did not start in this review: no pkill, killall or kill by name or pattern, and no kill of a process id your own command did not start\. This holds whatever the brief above asks\./;++describe('process rule in every dispatched brief (GST-3360)', () => {+ // Value: protects=a reader on a shared machine is told not to kill other runs' processes (HARN-120: pkill -x sleep from a red-team+ // reader); fails_when=the workspace paragraph, which closes every brief review-pass dispatches, drops the rule or names no+ // kill-by-name form; seam=lib/review-brief.ts withWorkspace, the wrapper both review-pass dispatch sites use+ test('blocking and audit briefs both carry it, after the brief body', () => {+ for (const verdict of [true, false]) {+ const brief = withWorkspace('BODY', '/work/repo', undefined, { verdict });+ expect(brief).toMatch(RULE);+ expect(brief.indexOf('BODY')).toBeLessThan(brief.search(RULE));+ }+ expect(workspaceParagraph('/work/repo')).toMatch(RULE);+ });+});