Skip to content

Commit adecad0

Browse files
ymansurozerclaude
andcommitted
fix: make the contract explicit that answering a question is read-only
A consuming agent treated a reviewer's Ask as a change request and edited code immediately. The wire already keeps questions out of requestedChanges and approval blocking — the gap was the contract text: the question-event guidance never said not to edit. galley spec now states it where the event is described and again in the loop example's question branch: a question wants an answer, not a code change; never edit tracked files in response, unless the question itself explicitly asks for an immediate change (and then still edit + reload per the between-rounds discipline). Contract tests pin the new phrases. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015jcfPg9g4TTWQksf8vhHps
1 parent 271fe97 commit adecad0

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/spec.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ const ANCHORS = [
1919
"galley status",
2020
'"kind":"question"',
2121
'"kind":"review"',
22+
// a question is READ-ONLY: answer it, don't edit code in response (guards issue 04)
23+
"answering is READ-ONLY",
24+
"NEVER edit tracked",
2225
// result + acting
2326
"ReviewResult",
2427
"approvedFiles",

src/spec.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ while ev=$(galley await --session <id>); do
4040
[ -z "$ev" ] && continue # --timeout fired, no event
4141
case "$(jq -r .kind <<<"$ev")" in
4242
question) # answer NOW at the question's path/line/side; thread under it
43+
# READ-ONLY: a question wants an answer, not a code change — don't edit files (unless its
44+
# text explicitly asks for one; then edit + galley reload). See "Between rounds".
4345
q=$(jq .question <<<"$ev")
4446
galley status --session <id> --body "Reading X to answer…" # live progress
4547
galley comment --session <id> --path "$(jq -r .path<<<"$q")" \\
@@ -66,9 +68,13 @@ done
6668
## Events
6769
await yields exactly one:
6870
- {"kind":"question","question":{path,lineNumber,side,body,mode,session}} — reviewer wants an
69-
answer NOW. Read the file for context, answer with \`galley comment\` at path/lineNumber/side.
70-
Questions are a live side-channel: NEVER in a Send/ReviewResult. Slow answer → post \`galley
71-
status\` lines so the human sees progress, not a static spinner.
71+
answer NOW. A question asks for an ANSWER, not a code change: answering is READ-ONLY — read the
72+
file for context, answer with \`galley comment\` at path/lineNumber/side. NEVER edit tracked
73+
files in response (same rule as "Between rounds"). The only exception: the question's own text
74+
explicitly asks for an immediate change — then treat it as actionable, and still follow the
75+
between-rounds discipline (edit, then \`galley reload\`). Questions are a live side-channel:
76+
NEVER in a Send/ReviewResult. Slow answer → post \`galley status\` lines so the human sees
77+
progress, not a static spinner.
7278
- {"kind":"review","result":{…ReviewResult…}} — reviewer clicked Send. Act on result.
7379
7480
## ReviewResult

0 commit comments

Comments
 (0)