Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: make review-loop follow-up text forge-aware (#6848)

[._.]/ Adam Eivy4b9f274edd7b
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-compact.txt
index 57c8d18e07..8cf395277c 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-compact.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-compact.txt
@@ -6,10 +6,10 @@ A previous agent finished task **task-example** and opened **PR https://github.c
**Stop mode (all):** run every reviewer in the list, in order, before merging.
**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default).
**Round caps (~max):** stop these reviewers after their budget even if findings remain, then advance: `codex` → 3 rounds. Spending a configured budget is a SUCCESS, not a failure — do not block the merge on it. Reviewers not listed keep the default cap below.
-**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a PR comment naming the missing command and exit.
+**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a MR comment naming the missing command and exit.
**Optional reviewers (~opt):** `ollama` still run and their findings must still be fixed, but a timeout, skipped/incomplete pass, or missing/malformed/no-verdict result from one of them is non-blocking; provider/transport failure from one of them is also non-blocking. A substantive rejection, failed build/test, or push failure still blocks.
**Loop UNTIL all required reviewers are satisfied and optional reviewers are satisfied or explicitly inconclusive (or the stop mode triggers), capped at 10 iterations per reviewer:**
-1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`; on GitHub `gh pr diff 42` also works). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
+1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
```bash
REVIEW_RESPONSE=$(mktemp)
HTTP_STATUS=$(glab mr diff 42 | jq -Rs '{ backend: "ollama", diff: . }' | curl -sS -X POST http://127.0.0.1:5555/api/code-review/local -H 'Content-Type: application/json' -d @- -o "$REVIEW_RESPONSE" -w '%{http_code}') || {
@@ -41,13 +41,13 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
4. When the reviewer list is exhausted (or the stop mode triggers), **leave the PR open** — do NOT merge it, and do NOT delete the branch. Its JIRA ticket is sitting in review and a human lands both together; merging here would leave the work merged and the ticket stuck in review.
5. Post a short comment on the MR summarising what the reviewers raised and what you fixed, so the human landing it knows the state: `glab mr note 42 --message "<summary>"`.
6. Exit. Do **not** run `/do:push` or open a new PR. The system will clean up your worktree on exit.
-**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, post a PR comment summarising blockers and exit. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.
+**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, post a MR comment summarising blockers and exit. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.
**Repeated comments:** If a fresh review round only re-raises feedback you intentionally rejected (with a reply explaining why), treat that round as clean and move on.
**Challenge protocol (dispute a wrong rejection — use sparingly):** If a reviewer raises a BLOCKING finding you have strong, specific evidence is a false positive (it misread the diff, flagged intended behavior, or contradicts a documented repo convention), do NOT silently "fix" it or accept a false block — dispute it **exactly once** for this task:
```bash
curl -sS -X POST http://127.0.0.1:5555/api/cos/tasks/task-example/challenge -H 'Content-Type: application/json' -d '{"reason":"<why the finding is wrong>","evidence":"<file:line or diff quote>","reviewer":"<disputed reviewer>"}'
```
-A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a PR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
+A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a MR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
### CLI Reviewer Procedure (codex)
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-verbose.txt
index 809a60e850..4d8306e835 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-verbose.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-leaveopen-verbose.txt
@@ -9,12 +9,12 @@ A previous agent finished implementing the work for source task **task-example**
**Stop mode (all):** run every reviewer in the list, in order, before merging.
**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default).
**Round caps (~max):** stop these reviewers after their budget even if findings remain, then advance: `codex` → 3 rounds. Spending a configured budget is a SUCCESS, not a failure — do not block the merge on it. Reviewers not listed keep the default cap below.
-**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a PR comment naming the missing command and exit.
+**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a MR comment naming the missing command and exit.
**Optional reviewers (~opt):** `ollama` still run and their findings must still be fixed, but a timeout, skipped/incomplete pass, or missing/malformed/no-verdict result from one of them is non-blocking; provider/transport failure from one of them is also non-blocking. A substantive rejection, failed build/test, or push failure still blocks.
**Run this loop UNTIL all configured reviewers are satisfied (or the stop mode triggers), capped at 10 iterations per reviewer:**
-1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`; on GitHub `gh pr diff 42` also works). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
+1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
```bash
REVIEW_RESPONSE=$(mktemp)
HTTP_STATUS=$(glab mr diff 42 | jq -Rs '{ backend: "ollama", diff: . }' | curl -sS -X POST http://127.0.0.1:5555/api/code-review/local -H 'Content-Type: application/json' -d @- -o "$REVIEW_RESPONSE" -w '%{http_code}') || {
@@ -47,7 +47,7 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
5. Post a short comment on the MR summarising what the reviewers raised and what you fixed, so the human landing it knows the state: `glab mr note 42 --message "<summary>"`.
6. Exit. Do **not** run `/do:push` or open a new PR. The system will clean up your worktree on exit.
-**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, post a PR comment summarising the unresolved blockers and exit. Do not loop indefinitely.
+**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, post a MR comment summarising the unresolved blockers and exit. Do not loop indefinitely.
**Repeated comments:** If a fresh review round only re-raises feedback you intentionally rejected (with a reply explaining why), treat that round as clean and move on.
@@ -55,7 +55,7 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
```bash
curl -sS -X POST http://127.0.0.1:5555/api/cos/tasks/task-example/challenge -H 'Content-Type: application/json' -d '{"reason":"<why the finding is wrong>","evidence":"<file:line or diff quote>","reviewer":"<disputed reviewer>"}'
```
-A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a PR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
+A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a MR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
PR Details:
- **URL**: https://github.com/example-org/example-repo/pull/42
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-compact.txt
index e15601822c..d1dfa819ac 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-compact.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-compact.txt
@@ -6,10 +6,10 @@ A previous agent finished task **task-example** and opened **PR https://github.c
**Stop mode (all):** run every reviewer in the list, in order, before merging.
**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default).
**Round caps (~max):** stop these reviewers after their budget even if findings remain, then advance: `codex` → 3 rounds. Spending a configured budget is a SUCCESS, not a failure — do not block the merge on it. Reviewers not listed keep the default cap below.
-**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a PR comment naming the missing command and exit.
+**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a MR comment naming the missing command and exit.
**Optional reviewers (~opt):** `ollama` still run and their findings must still be fixed, but a timeout, skipped/incomplete pass, or missing/malformed/no-verdict result from one of them is non-blocking; provider/transport failure from one of them is also non-blocking. A substantive rejection, failed build/test, or push failure still blocks.
**Loop UNTIL all required reviewers are satisfied and optional reviewers are satisfied or explicitly inconclusive (or the stop mode triggers), capped at 10 iterations per reviewer:**
-1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`; on GitHub `gh pr diff 42` also works). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
+1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
```bash
REVIEW_RESPONSE=$(mktemp)
HTTP_STATUS=$(glab mr diff 42 | jq -Rs '{ backend: "ollama", diff: . }' | curl -sS -X POST http://127.0.0.1:5555/api/code-review/local -H 'Content-Type: application/json' -d @- -o "$REVIEW_RESPONSE" -w '%{http_code}') || {
@@ -45,13 +45,13 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
You have already verified the review is clean, so force the immediate merge. Adding any merge-deferral flag would leave the PR open after you exit.
5. Confirm the MR is actually merged before exiting: `glab mr view "42"` must show it merged. If it is still open or was closed unmerged, investigate (a check is failing, a thread is still unresolved, or branch protection is blocking) — fix and retry the merge. Do NOT exit until it is merged.
6. Exit. Do **not** run `/do:push` or open a new PR — the merge handles everything. The system will clean up your worktree on exit.
-**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, post a PR comment summarising blockers and exit. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.
+**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, post a MR comment summarising blockers and exit. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.
**Repeated comments:** If a fresh review round only re-raises feedback you intentionally rejected (with a reply explaining why), treat that round as clean and move on.
**Challenge protocol (dispute a wrong rejection — use sparingly):** If a reviewer raises a BLOCKING finding you have strong, specific evidence is a false positive (it misread the diff, flagged intended behavior, or contradicts a documented repo convention), do NOT silently "fix" it or accept a false block — dispute it **exactly once** for this task:
```bash
curl -sS -X POST http://127.0.0.1:5555/api/cos/tasks/task-example/challenge -H 'Content-Type: application/json' -d '{"reason":"<why the finding is wrong>","evidence":"<file:line or diff quote>","reviewer":"<disputed reviewer>"}'
```
-A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a PR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
+A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a MR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
### CLI Reviewer Procedure (codex)
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-verbose.txt
index 207428394a..e0d63c8e29 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-verbose.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/followUp-glab-merge-verbose.txt
@@ -9,12 +9,12 @@ A previous agent finished implementing the work for source task **task-example**
**Stop mode (all):** run every reviewer in the list, in order, before merging.
**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default).
**Round caps (~max):** stop these reviewers after their budget even if findings remain, then advance: `codex` → 3 rounds. Spending a configured budget is a SUCCESS, not a failure — do not block the merge on it. Reviewers not listed keep the default cap below.
-**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a PR comment naming the missing command and exit.
+**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a MR comment naming the missing command and exit.
**Optional reviewers (~opt):** `ollama` still run and their findings must still be fixed, but a timeout, skipped/incomplete pass, or missing/malformed/no-verdict result from one of them is non-blocking; provider/transport failure from one of them is also non-blocking. A substantive rejection, failed build/test, or push failure still blocks.
**Run this loop UNTIL all configured reviewers are satisfied (or the stop mode triggers), capped at 10 iterations per reviewer:**
-1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`; on GitHub `gh pr diff 42` also works). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
+1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
```bash
REVIEW_RESPONSE=$(mktemp)
HTTP_STATUS=$(glab mr diff 42 | jq -Rs '{ backend: "ollama", diff: . }' | curl -sS -X POST http://127.0.0.1:5555/api/code-review/local -H 'Content-Type: application/json' -d @- -o "$REVIEW_RESPONSE" -w '%{http_code}') || {
@@ -51,7 +51,7 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
5. Confirm the MR is actually merged before exiting: `glab mr view "42"` must show it merged. If it is still open or was closed unmerged, investigate (a check is failing, a thread is still unresolved, or branch protection is blocking) — fix and retry the merge. Do NOT exit until it is merged.
6. Exit. Do **not** run `/do:push` or open a new PR — the merge handles everything. The system will clean up your worktree on exit.
-**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, post a PR comment summarising the unresolved blockers and exit. Do not loop indefinitely.
+**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, post a MR comment summarising the unresolved blockers and exit. Do not loop indefinitely.
**Repeated comments:** If a fresh review round only re-raises feedback you intentionally rejected (with a reply explaining why), treat that round as clean and move on.
@@ -59,7 +59,7 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
```bash
curl -sS -X POST http://127.0.0.1:5555/api/cos/tasks/task-example/challenge -H 'Content-Type: application/json' -d '{"reason":"<why the finding is wrong>","evidence":"<file:line or diff quote>","reviewer":"<disputed reviewer>"}'
```
-A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a PR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
+A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a MR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
PR Details:
- **URL**: https://github.com/example-org/example-repo/pull/42
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-compact.txt
index 28b435f8bd..6cffa611cc 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-compact.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-compact.txt
@@ -14,10 +14,10 @@ When the local phase satisfies the stop condition, skip the PR-side phase and re
**Stop mode (all):** run every reviewer in the list, in order, before merging.
**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default).
**Round caps (~max):** stop these reviewers after their budget even if findings remain, then advance: `codex` → 3 rounds. Spending a configured budget is a SUCCESS, not a failure — do not block the merge on it. Reviewers not listed keep the default cap below.
-**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a PR comment naming the missing command and exit.
+**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a MR comment naming the missing command and exit.
**Optional reviewers (~opt):** `ollama` still run and their findings must still be fixed, but a timeout, skipped/incomplete pass, or missing/malformed/no-verdict result from one of them is non-blocking; provider/transport failure from one of them is also non-blocking. A substantive rejection, failed build/test, or push failure still blocks.
**Loop UNTIL all required reviewers are satisfied and optional reviewers are satisfied or explicitly inconclusive (or the stop mode triggers), capped at 10 iterations per reviewer:**
-1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`; on GitHub `gh pr diff 42` also works). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
+1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
```bash
REVIEW_RESPONSE=$(mktemp)
HTTP_STATUS=$(glab mr diff 42 | jq -Rs '{ backend: "ollama", diff: . }' | curl -sS -X POST http://127.0.0.1:5555/api/code-review/local -H 'Content-Type: application/json' -d @- -o "$REVIEW_RESPONSE" -w '%{http_code}') || {
@@ -49,13 +49,13 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
4. When the reviewer list is exhausted (or the stop mode triggers), **leave the PR open** — do NOT merge it, and do NOT delete the branch. Its JIRA ticket is sitting in review and a human lands both together; merging here would leave the work merged and the ticket stuck in review.
5. Post a short comment on the MR summarising what the reviewers raised and what you fixed, so the human landing it knows the state: `glab mr note 42 --message "<summary>"`.
6. Return to the **Completion Workflow** above and write the completion sentinel — the run is not done until you have. Do NOT open a second PR.
-**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, post a PR comment summarising blockers and exit. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.
+**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, post a MR comment summarising blockers and exit. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.
**Repeated comments:** If a fresh review round only re-raises feedback you intentionally rejected (with a reply explaining why), treat that round as clean and move on.
**Challenge protocol (dispute a wrong rejection — use sparingly):** If a reviewer raises a BLOCKING finding you have strong, specific evidence is a false positive (it misread the diff, flagged intended behavior, or contradicts a documented repo convention), do NOT silently "fix" it or accept a false block — dispute it **exactly once** for this task:
```bash
curl -sS -X POST http://127.0.0.1:5555/api/cos/tasks/task-example/challenge -H 'Content-Type: application/json' -d '{"reason":"<why the finding is wrong>","evidence":"<file:line or diff quote>","reviewer":"<disputed reviewer>"}'
```
-A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a PR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
+A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a MR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
### CLI Reviewer Procedure (codex)
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-verbose.txt
index 4fbcea2bfa..85a9341b82 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-verbose.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-leaveopen-verbose.txt
@@ -17,12 +17,12 @@ When the local phase satisfies the stop condition, skip the PR-side phase and re
**Stop mode (all):** run every reviewer in the list, in order, before merging.
**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default).
**Round caps (~max):** stop these reviewers after their budget even if findings remain, then advance: `codex` → 3 rounds. Spending a configured budget is a SUCCESS, not a failure — do not block the merge on it. Reviewers not listed keep the default cap below.
-**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a PR comment naming the missing command and exit.
+**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a MR comment naming the missing command and exit.
**Optional reviewers (~opt):** `ollama` still run and their findings must still be fixed, but a timeout, skipped/incomplete pass, or missing/malformed/no-verdict result from one of them is non-blocking; provider/transport failure from one of them is also non-blocking. A substantive rejection, failed build/test, or push failure still blocks.
**Run this loop UNTIL all configured reviewers are satisfied (or the stop mode triggers), capped at 10 iterations per reviewer:**
-1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`; on GitHub `gh pr diff 42` also works). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
+1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
```bash
REVIEW_RESPONSE=$(mktemp)
HTTP_STATUS=$(glab mr diff 42 | jq -Rs '{ backend: "ollama", diff: . }' | curl -sS -X POST http://127.0.0.1:5555/api/code-review/local -H 'Content-Type: application/json' -d @- -o "$REVIEW_RESPONSE" -w '%{http_code}') || {
@@ -55,7 +55,7 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
5. Post a short comment on the MR summarising what the reviewers raised and what you fixed, so the human landing it knows the state: `glab mr note 42 --message "<summary>"`.
6. Return to the **Completion Workflow** above and write the completion sentinel — the run is not done until you have. Do NOT open a second PR.
-**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, post a PR comment summarising the unresolved blockers and exit. Do not loop indefinitely.
+**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, post a MR comment summarising the unresolved blockers and exit. Do not loop indefinitely.
**Repeated comments:** If a fresh review round only re-raises feedback you intentionally rejected (with a reply explaining why), treat that round as clean and move on.
@@ -63,7 +63,7 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
```bash
curl -sS -X POST http://127.0.0.1:5555/api/cos/tasks/task-example/challenge -H 'Content-Type: application/json' -d '{"reason":"<why the finding is wrong>","evidence":"<file:line or diff quote>","reviewer":"<disputed reviewer>"}'
```
-A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a PR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
+A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a MR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
PR Details:
- **URL**: https://github.com/example-org/example-repo/pull/42
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-compact.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-compact.txt
index 15f458ace9..612e5271bd 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-compact.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-compact.txt
@@ -14,10 +14,10 @@ When the local phase satisfies the stop condition, skip the PR-side phase and re
**Stop mode (all):** run every reviewer in the list, in order, before merging.
**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default).
**Round caps (~max):** stop these reviewers after their budget even if findings remain, then advance: `codex` → 3 rounds. Spending a configured budget is a SUCCESS, not a failure — do not block the merge on it. Reviewers not listed keep the default cap below.
-**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a PR comment naming the missing command and exit.
+**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a MR comment naming the missing command and exit.
**Optional reviewers (~opt):** `ollama` still run and their findings must still be fixed, but a timeout, skipped/incomplete pass, or missing/malformed/no-verdict result from one of them is non-blocking; provider/transport failure from one of them is also non-blocking. A substantive rejection, failed build/test, or push failure still blocks.
**Loop UNTIL all required reviewers are satisfied and optional reviewers are satisfied or explicitly inconclusive (or the stop mode triggers), capped at 10 iterations per reviewer:**
-1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`; on GitHub `gh pr diff 42` also works). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
+1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
```bash
REVIEW_RESPONSE=$(mktemp)
HTTP_STATUS=$(glab mr diff 42 | jq -Rs '{ backend: "ollama", diff: . }' | curl -sS -X POST http://127.0.0.1:5555/api/code-review/local -H 'Content-Type: application/json' -d @- -o "$REVIEW_RESPONSE" -w '%{http_code}') || {
@@ -54,13 +54,13 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
You have already verified the review is clean, so force the immediate merge. Adding any merge-deferral flag would leave the PR open after you exit.
5. Confirm the MR is actually merged before exiting: `glab mr view "42"` must show it merged. If it is still open or was closed unmerged, investigate (a check is failing, a thread is still unresolved, or branch protection is blocking) — fix and retry the merge. Do NOT exit until it is merged.
6. Return to the **Completion Workflow** above and write the completion sentinel — the run is not done until you have. Do NOT open a second PR.
-**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, post a PR comment summarising blockers and exit. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.
+**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, post a MR comment summarising blockers and exit. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.
**Repeated comments:** If a fresh review round only re-raises feedback you intentionally rejected (with a reply explaining why), treat that round as clean and move on.
**Challenge protocol (dispute a wrong rejection — use sparingly):** If a reviewer raises a BLOCKING finding you have strong, specific evidence is a false positive (it misread the diff, flagged intended behavior, or contradicts a documented repo convention), do NOT silently "fix" it or accept a false block — dispute it **exactly once** for this task:
```bash
curl -sS -X POST http://127.0.0.1:5555/api/cos/tasks/task-example/challenge -H 'Content-Type: application/json' -d '{"reason":"<why the finding is wrong>","evidence":"<file:line or diff quote>","reviewer":"<disputed reviewer>"}'
```
-A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a PR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
+A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a MR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
### CLI Reviewer Procedure (codex)
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-verbose.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-verbose.txt
index 139c7a01bf..19a87ebeeb 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-verbose.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/inline-glab-merge-verbose.txt
@@ -17,12 +17,12 @@ When the local phase satisfies the stop condition, skip the PR-side phase and re
**Stop mode (all):** run every reviewer in the list, in order, before merging.
**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default).
**Round caps (~max):** stop these reviewers after their budget even if findings remain, then advance: `codex` → 3 rounds. Spending a configured budget is a SUCCESS, not a failure — do not block the merge on it. Reviewers not listed keep the default cap below.
-**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a PR comment naming the missing command and exit.
+**Missing reviewer CLI:** verify each configured binary is on PATH (`command -v codex`) before concluding it is unavailable. If a required reviewer binary is genuinely missing (`codex`), that reviewer is UNSATISFIED — do NOT substitute your own self-review and do NOT merge; post a MR comment naming the missing command and exit.
**Optional reviewers (~opt):** `ollama` still run and their findings must still be fixed, but a timeout, skipped/incomplete pass, or missing/malformed/no-verdict result from one of them is non-blocking; provider/transport failure from one of them is also non-blocking. A substantive rejection, failed build/test, or push failure still blocks.
**Run this loop UNTIL all configured reviewers are satisfied (or the stop mode triggers), capped at 10 iterations per reviewer:**
-1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`; on GitHub `gh pr diff 42` also works). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
+1. For EACH reviewer in order — `ollama` → `copilot` → `codex` → `@example-user` — run a full review-and-fix sub-loop before advancing to the next. **copilot**: request a Copilot review when you reach its turn (poll every 5–15s, max 5 min/round), then re-request on later rounds. **codex**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or `git diff main...HEAD`). When invoking a reviewer with a pinned model or reasoning effort, pass it: `codex --model gpt-5.6-sol -c model_reasoning_effort=high …`. Follow the **CLI Reviewer Procedure** section below for the exact headless invocation and review-only contract — do NOT probe the CLI or guess flags. **ollama**: POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it.
```bash
REVIEW_RESPONSE=$(mktemp)
HTTP_STATUS=$(glab mr diff 42 | jq -Rs '{ backend: "ollama", diff: . }' | curl -sS -X POST http://127.0.0.1:5555/api/code-review/local -H 'Content-Type: application/json' -d @- -o "$REVIEW_RESPONSE" -w '%{http_code}') || {
@@ -60,7 +60,7 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
5. Confirm the MR is actually merged before exiting: `glab mr view "42"` must show it merged. If it is still open or was closed unmerged, investigate (a check is failing, a thread is still unresolved, or branch protection is blocking) — fix and retry the merge. Do NOT exit until it is merged.
6. Return to the **Completion Workflow** above and write the completion sentinel — the run is not done until you have. Do NOT open a second PR.
-**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, post a PR comment summarising the unresolved blockers and exit. Do not loop indefinitely.
+**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, post a MR comment summarising the unresolved blockers and exit. Do not loop indefinitely.
**Repeated comments:** If a fresh review round only re-raises feedback you intentionally rejected (with a reply explaining why), treat that round as clean and move on.
@@ -68,7 +68,7 @@ Only a successfully extracted `.findings` value is the review text; treat it lik
```bash
curl -sS -X POST http://127.0.0.1:5555/api/cos/tasks/task-example/challenge -H 'Content-Type: application/json' -d '{"reason":"<why the finding is wrong>","evidence":"<file:line or diff quote>","reviewer":"<disputed reviewer>"}'
```
-A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a PR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
+A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, post a MR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user. For a local reviewer you may instead POST `{"recheck":{"backend":"ollama","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.
PR Details:
- **URL**: https://github.com/example-org/example-repo/pull/42
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-gh.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-gh.txt
index f50d1b3615..82cdcbba0d 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-gh.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-gh.txt
@@ -38,7 +38,7 @@ else
cat "${REVIEW_RESPONSE}.findings"
fi
```
-Only a successfully extracted `.findings` value is the review text; treat it like any other reviewer's findings. This run pins settings for `ollama` → `"model": "qwen3-coder"` — add those keys to the JSON body (`jq -Rs '{ backend: "ollama", model: "…", diff: . }'`) so the review runs with them instead of the install defaults. Send ONLY the keys named above; a key with no pinned value overrides the install default with junk. **@github reviewers**: request `@example-user` as PR reviewer (`gh pr edit 42 --add-reviewer <user>`, drop the `@`), then wait for their review (poll every 5–15s) and address any findings; their approval gates the merge.
+Only a successfully extracted `.findings` value is the review text; treat it like any other reviewer's findings. This run pins settings for `ollama` → `"model": "qwen3-coder"` — add those keys to the JSON body (`jq -Rs '{ backend: "ollama", model: "…", diff: . }'`) so the review runs with them instead of the install defaults. Send ONLY the keys named above; a key with no pinned value overrides the install default with junk. Username reviewers will be requested after the PR/MR is published.
2. If unresolved findings: fix in this worktree, run tests, commit (`feat:`/`fix:` prefix, no Co-Authored-By), then re-run the same local reviewer. Do NOT push or open a PR/MR yet.
3. Re-review with the same reviewer until clean, then advance to the next reviewer in the list.
4. When the local reviewer list is exhausted (or the stop mode triggers), record `LOCAL_OVERALL_STATUS`: use `review-blocked` only when a required reviewer could not produce a verdict because of an availability, quota/provider, timeout, transport, malformed, empty, or no-verdict failure; never use it for substantive findings, failed tests/build, unpushed fixes, or state/publication failures, and do not self-review. Set `LOCAL_STOP_TRIGGERED=true` when the configured stop condition actually fired on a qualifying verdict, including when that verdict came from the final local reviewer; set it false for list exhaustion, an inconclusive result, or `review-blocked`. The configured reviewer positions are zero-based: `mtplx`=0, `ollama`=1, `copilot`=2, `codex`=3, `@example-user`=4. When a qualifying verdict triggers the configured stop condition, set `LOCAL_STOP_TRIGGERED=true` and `LOCAL_STOP_INDEX` to that triggering local reviewer's position; when the list exhausts without a qualifying stop or a result is inconclusive, set `LOCAL_STOP_TRIGGERED=false` and `LOCAL_STOP_INDEX=-1`. Compute `LOCAL_PHASE_COMMITS=$(git rev-list "$LOCAL_PHASE_START_SHA..HEAD" --count)`; if a qualifying stop fired, retain the triggering reviewer's `LOCAL_REVIEWER_COMMITS` as `LOCAL_STOP_REVIEW_COMMITS`, otherwise set `LOCAL_STOP_REVIEW_COMMITS=-1`. Record `LOCAL_REVIEWED_HEAD_SHA=$(git rev-parse HEAD)`. Persist all phase state for later shell calls in the worktree-private Git state file: `LOCAL_REVIEW_STATE_FILE="$(git rev-parse --git-path portos-local-review-state)"`; then run `printf 'LOCAL_PHASE_START_SHA=%s\nLOCAL_OVERALL_STATUS=%s\nLOCAL_STOP_TRIGGERED=%s\nLOCAL_STOP_INDEX=%s\nLOCAL_STOP_REVIEW_COMMITS=%s\nLOCAL_PHASE_COMMITS=%s\nLOCAL_REVIEWED_HEAD_SHA=%s\n' "$LOCAL_PHASE_START_SHA" "$LOCAL_OVERALL_STATUS" "$LOCAL_STOP_TRIGGERED" "$LOCAL_STOP_INDEX" "$LOCAL_STOP_REVIEW_COMMITS" "$LOCAL_PHASE_COMMITS" "$LOCAL_REVIEWED_HEAD_SHA" > "$LOCAL_REVIEW_STATE_FILE"`. A `review-blocked` state is a completed local phase that permits publication but blocks the merge gate; the publication step posts the required comment. If that write fails, do NOT push or open the PR/MR. For a final-reviewer stop, follow the same phase-level gate below: `on-clean` requires `LOCAL_OVERALL_STATUS=clean` with `LOCAL_STOP_REVIEW_COMMITS=0`, while `on-findings` requires `LOCAL_OVERALL_STATUS=clean` with `LOCAL_STOP_REVIEW_COMMITS>0`; a `partial` status is already a qualifying stop. Return to the Completion Workflow and continue with the push and PR/MR creation step when all executed required reviewers are clean and optional reviewers are clean or inconclusive, when `LOCAL_OVERALL_STATUS=partial` records a qualifying configured stop-mode short-circuit, or when `LOCAL_OVERALL_STATUS=review-blocked` records only reviewer unavailability. Do NOT push or open the PR/MR before this local phase is complete.
diff --git a/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-glab.txt b/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-glab.txt
index e6707635b6..82cdcbba0d 100644
--- a/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-glab.txt
+++ b/server/services/promptSections/__snapshots__/reviewLoopMatrix/local-glab.txt
@@ -38,7 +38,7 @@ else
cat "${REVIEW_RESPONSE}.findings"
fi
```
-Only a successfully extracted `.findings` value is the review text; treat it like any other reviewer's findings. This run pins settings for `ollama` → `"model": "qwen3-coder"` — add those keys to the JSON body (`jq -Rs '{ backend: "ollama", model: "…", diff: . }'`) so the review runs with them instead of the install defaults. Send ONLY the keys named above; a key with no pinned value overrides the install default with junk. **@github reviewers**: request `@example-user` as MR reviewer using the GitLab project UI or API, then inspect `glab mr view 42` for their review and address any findings; their approval gates the merge.
+Only a successfully extracted `.findings` value is the review text; treat it like any other reviewer's findings. This run pins settings for `ollama` → `"model": "qwen3-coder"` — add those keys to the JSON body (`jq -Rs '{ backend: "ollama", model: "…", diff: . }'`) so the review runs with them instead of the install defaults. Send ONLY the keys named above; a key with no pinned value overrides the install default with junk. Username reviewers will be requested after the PR/MR is published.
2. If unresolved findings: fix in this worktree, run tests, commit (`feat:`/`fix:` prefix, no Co-Authored-By), then re-run the same local reviewer. Do NOT push or open a PR/MR yet.
3. Re-review with the same reviewer until clean, then advance to the next reviewer in the list.
4. When the local reviewer list is exhausted (or the stop mode triggers), record `LOCAL_OVERALL_STATUS`: use `review-blocked` only when a required reviewer could not produce a verdict because of an availability, quota/provider, timeout, transport, malformed, empty, or no-verdict failure; never use it for substantive findings, failed tests/build, unpushed fixes, or state/publication failures, and do not self-review. Set `LOCAL_STOP_TRIGGERED=true` when the configured stop condition actually fired on a qualifying verdict, including when that verdict came from the final local reviewer; set it false for list exhaustion, an inconclusive result, or `review-blocked`. The configured reviewer positions are zero-based: `mtplx`=0, `ollama`=1, `copilot`=2, `codex`=3, `@example-user`=4. When a qualifying verdict triggers the configured stop condition, set `LOCAL_STOP_TRIGGERED=true` and `LOCAL_STOP_INDEX` to that triggering local reviewer's position; when the list exhausts without a qualifying stop or a result is inconclusive, set `LOCAL_STOP_TRIGGERED=false` and `LOCAL_STOP_INDEX=-1`. Compute `LOCAL_PHASE_COMMITS=$(git rev-list "$LOCAL_PHASE_START_SHA..HEAD" --count)`; if a qualifying stop fired, retain the triggering reviewer's `LOCAL_REVIEWER_COMMITS` as `LOCAL_STOP_REVIEW_COMMITS`, otherwise set `LOCAL_STOP_REVIEW_COMMITS=-1`. Record `LOCAL_REVIEWED_HEAD_SHA=$(git rev-parse HEAD)`. Persist all phase state for later shell calls in the worktree-private Git state file: `LOCAL_REVIEW_STATE_FILE="$(git rev-parse --git-path portos-local-review-state)"`; then run `printf 'LOCAL_PHASE_START_SHA=%s\nLOCAL_OVERALL_STATUS=%s\nLOCAL_STOP_TRIGGERED=%s\nLOCAL_STOP_INDEX=%s\nLOCAL_STOP_REVIEW_COMMITS=%s\nLOCAL_PHASE_COMMITS=%s\nLOCAL_REVIEWED_HEAD_SHA=%s\n' "$LOCAL_PHASE_START_SHA" "$LOCAL_OVERALL_STATUS" "$LOCAL_STOP_TRIGGERED" "$LOCAL_STOP_INDEX" "$LOCAL_STOP_REVIEW_COMMITS" "$LOCAL_PHASE_COMMITS" "$LOCAL_REVIEWED_HEAD_SHA" > "$LOCAL_REVIEW_STATE_FILE"`. A `review-blocked` state is a completed local phase that permits publication but blocks the merge gate; the publication step posts the required comment. If that write fails, do NOT push or open the PR/MR. For a final-reviewer stop, follow the same phase-level gate below: `on-clean` requires `LOCAL_OVERALL_STATUS=clean` with `LOCAL_STOP_REVIEW_COMMITS=0`, while `on-findings` requires `LOCAL_OVERALL_STATUS=clean` with `LOCAL_STOP_REVIEW_COMMITS>0`; a `partial` status is already a qualifying stop. Return to the Completion Workflow and continue with the push and PR/MR creation step when all executed required reviewers are clean and optional reviewers are clean or inconclusive, when `LOCAL_OVERALL_STATUS=partial` records a qualifying configured stop-mode short-circuit, or when `LOCAL_OVERALL_STATUS=review-blocked` records only reviewer unavailability. Do NOT push or open the PR/MR before this local phase is complete.
diff --git a/server/services/promptSections/reviewLifecycle.js b/server/services/promptSections/reviewLifecycle.js
index e6ddeccdae..f7d684026c 100644
--- a/server/services/promptSections/reviewLifecycle.js
+++ b/server/services/promptSections/reviewLifecycle.js
@@ -455,20 +455,21 @@ function buildPrSideClosingSteps({ leaveOpen, exitStep, mergeGuard = '', forge }
*/
const prSidePhaseTexts = (prNumber) => ({
supportsVerbose: true,
+ supportsUsernameReviewers: true,
prepareLoopBody: body => body,
diffCommand: forge => forge.diffCmd,
- prDiffHint: `; on GitHub \`gh pr diff ${prNumber || ''}\` also works`,
+ prDiffHint: forge => forge.mergeGateForge === 'gitlab' ? '' : `; on GitHub \`gh pr diff ${prNumber || ''}\` also works`,
applyNoteOn: '**Reviewer applies:** let each CLI reviewer apply its own fixes to the working tree, then verify, run tests, and push.',
applyNoteOff: "**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default).",
- missingRequiredCliText: 'do NOT substitute your own self-review and do NOT merge; post a PR comment naming the missing command and exit.',
+ missingRequiredCliText: forge => `do NOT substitute your own self-review and do NOT merge; post a ${forge.noun} comment naming the missing command and exit.`,
missingOptionalCliBlocks: 'the merge',
- challengeBlockedText: 'post a PR comment and stop',
+ challengeBlockedText: forge => `post a ${forge.noun} comment and stop`,
challengeContinueText: 'merge',
requiredReviewNote: '',
rebaseNote: '',
statePersistenceNote: '',
procedureNote: '',
- hardStopAction: 'post a PR comment summarising blockers and exit',
+ hardStopAction: (forge, { verbose = false } = {}) => `post a ${forge.noun} comment summarising ${verbose ? 'the unresolved ' : ''}blockers and exit`,
crossPhaseNote: () => '',
fixStep: ({ hasCopilot }) => '2. If unresolved findings: fix in this worktree, run tests, commit (`feat:`/`fix:` prefix, no Co-Authored-By)'
+ ', push' + (hasCopilot ? ', and (for Copilot) resolve the addressed threads.' : '.'),
@@ -498,9 +499,10 @@ function buildLocalPhaseTexts({ baseBranch, prBranch, localPhaseReviewRequired }
return {
heading: '### Local Review Before Opening the PR/MR',
baseRef: renderedBaseBranch,
+ supportsUsernameReviewers: false,
// Local reviewers diff the worktree, so the forge's PR/MR diff never applies.
diffCommand: () => `git diff ${renderedBaseBranch}...HEAD`,
- prDiffHint: '',
+ prDiffHint: () => '',
supportsVerbose: false,
canPreRequestCopilot: true,
// The maintained recipe pushes after each reviewer pass; a local-only phase
@@ -508,9 +510,9 @@ function buildLocalPhaseTexts({ baseBranch, prBranch, localPhaseReviewRequired }
prepareLoopBody: prepareLocalReviewLoopBody,
applyNoteOn: '**Reviewer applies:** let each CLI reviewer apply its own fixes to the working tree, then verify and run tests; keep fixes committed locally. Do NOT push or open the PR/MR from this loop.',
applyNoteOff: "**Reviewer applies (off):** read each CLI reviewer's findings and apply the fixes yourself (default); keep fixes committed locally. Do NOT push or open the PR/MR from this loop.",
- missingRequiredCliText: 'do NOT substitute your own self-review. Record `LOCAL_OVERALL_STATUS=review-blocked`, continue to the PR/MR publication step, and leave the PR/MR unmerged until the reviewer is available.',
+ missingRequiredCliText: () => 'do NOT substitute your own self-review. Record `LOCAL_OVERALL_STATUS=review-blocked`, continue to the PR/MR publication step, and leave the PR/MR unmerged until the reviewer is available.',
missingOptionalCliBlocks: 'the push or PR/MR creation',
- challengeBlockedText: 'stop without pushing or opening a PR/MR',
+ challengeBlockedText: () => 'stop without pushing or opening a PR/MR',
challengeContinueText: 'the PR/MR creation step',
// A required reviewer that cannot run is not a clean review. In a pre-PR
// phase it is recorded as review-blocked so publication can preserve the
@@ -521,9 +523,9 @@ function buildLocalPhaseTexts({ baseBranch, prBranch, localPhaseReviewRequired }
rebaseNote: '**Rebase conflict gate:** resolve routine conflicts and finish the rebase in this agent session. If a conflict genuinely cannot be resolved safely, run `git rebase --abort 2>/dev/null || true` and stop; never publish a conflicted or half-rebased worktree.',
statePersistenceNote: '**State persistence:** shell calls do not share variables. Reload state before each reviewer, preserve it while persisting `LOCAL_REVIEWER_START_SHA`; reload before commit/stop calculations and the final aggregate. Any read/write failure blocks publication; only an explicitly recorded `review-blocked` reviewer-availability result may proceed to publication.',
procedureNote: '**Pre-PR rule:** keep reviewer fixes committed locally. Do NOT push or open a PR/MR here; the outer workflow publishes after the local review phase completes.\n\n',
- hardStopAction: localPhaseReviewRequired
+ hardStopAction: () => (localPhaseReviewRequired
? 'do NOT push or open a PR/MR when substantive findings remain or fixes leave the build/tests red; if the only failure is reviewer unavailability, record `review-blocked`, publish the PR/MR, and leave it unmerged'
- : 'do NOT push or open a PR/MR; report the unresolved blocker and exit',
+ : 'do NOT push or open a PR/MR; report the unresolved blocker and exit'),
crossPhaseNote: () => '',
opening,
compactOpening: opening,
@@ -748,7 +750,7 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,
? [
`**Missing reviewer CLI:** verify each configured binary is on PATH (${cliBinaries.map(c => `\`command -v ${c.binary}\``).join(' / ')}) before concluding it is unavailable.`,
requiredCliBinaries.length
- ? `If a required reviewer binary is genuinely missing (${requiredCliBinaries.map(c => `\`${c.binary}\``).join(' / ')}), that reviewer is UNSATISFIED — ${phase.missingRequiredCliText}`
+ ? `If a required reviewer binary is genuinely missing (${requiredCliBinaries.map(c => `\`${c.binary}\``).join(' / ')}), that reviewer is UNSATISFIED — ${phase.missingRequiredCliText(forge)}`
: '',
optionalCliBinaries.length
? `A missing optional reviewer binary (${optionalCliBinaries.map(c => `\`${c.binary}\``).join(' / ')}) is an inconclusive optional result and does not block ${phase.missingOptionalCliBlocks}; record it and continue without substituting a self-review.`
@@ -773,18 +775,24 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,
const { backendToken: localLlmBackendToken, invocation: localLlmInvocation } = buildLocalLlmInvocation({
localLlmBackends, reviewerModelMap, reviewerEffortMap, diffCommand, apiBase,
});
- const githubUsersInvocation = forge.requestReviewersText(usernames);
+ const githubUsersInvocation = phase.supportsUsernameReviewers
+ ? forge.requestReviewersText(usernames)
+ : 'username reviewers will be requested after the PR/MR is published';
+ const localUsernameReviewerNote = !phase.supportsUsernameReviewers && hasGithubUser
+ ? 'Username reviewers will be requested after the PR/MR is published.'
+ : null;
const multiBullets = [
hasCopilot ? `**copilot**: ${copilotIsFirst
? 'wait for the initial Copilot review the system already pre-requested (Copilot leads the list)'
: 'request a Copilot review when you reach its turn'} (poll every 5–15s, max 5 min/round), then re-request on later rounds.` : null,
- hasCli ? `**${cliReviewerHeading}**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff ${renderedBaseBranch}...HEAD\`${phase.prDiffHint}).${cliBinaryNote}${reviewerPinNote}${cliProcedurePointer}` : null,
+ hasCli ? `**${cliReviewerHeading}**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff ${renderedBaseBranch}...HEAD\`${phase.prDiffHint(forge)}).${cliBinaryNote}${reviewerPinNote}${cliProcedurePointer}` : null,
hasLocalLlm ? `**${localLlmBackends.join(' / ')}**: ${localLlmInvocation}` : null,
- hasGithubUser ? `**@github reviewers**: ${githubUsersInvocation}` : null,
+ phase.supportsUsernameReviewers && hasGithubUser ? `**@github reviewers**: ${githubUsersInvocation}` : null,
+ localUsernameReviewerNote,
].filter(Boolean).join(' ');
// Name the BINARY, not the slug: `Invoke the \`antigravity\` CLI` sent a
// follow-up agent hunting for a command that does not exist.
- const singleCliInvocation = `Invoke ${describeReviewerCli(cliReviewers[0])} to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff ${renderedBaseBranch}...HEAD\`${phase.prDiffHint}). Capture its findings as concrete issues to address.${reviewerPinNote}${cliProcedurePointer}`;
+ const singleCliInvocation = `Invoke ${describeReviewerCli(cliReviewers[0])} to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff ${renderedBaseBranch}...HEAD\`${phase.prDiffHint(forge)}). Capture its findings as concrete issues to address.${reviewerPinNote}${cliProcedurePointer}`;
// Resolved sequentially so a future reviewer kind only adds one branch
// instead of deepening the nested ternary.
let waitOrInvokeStep;
@@ -818,7 +826,7 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,
'```bash',
`curl -sS -X POST ${apiBase}/api/cos/tasks/${sourceTaskId}/challenge -H 'Content-Type: application/json' -d '{"reason":"<why the finding is wrong>","evidence":"<file:line or diff quote>","reviewer":"<disputed reviewer>"}'`,
'```',
- `A \`409\` (\`CHALLENGE_EXHAUSTED\` = the one challenge is spent, or \`CHALLENGE_BUDGET_EXHAUSTED\` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, ${phase.challengeBlockedText}. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → \`POST .../challenge/resolve\` with \`{"outcome":"upheld"}\` and continue to ${phase.challengeContinueText}; confirmed → fix it, or send \`{"outcome":"escalated"}\` to hand the dispute to the user.` + (hasLocalLlm ? ` For a local reviewer you may instead POST \`{"recheck":{"backend":"${localLlmBackendToken}","diff":"<unified diff>"}}\` and let the server re-run it and auto-derive the outcome.` : ''),
+ `A \`409\` (\`CHALLENGE_EXHAUSTED\` = the one challenge is spent, or \`CHALLENGE_BUDGET_EXHAUSTED\` = the task is out of retry budget) means you can't dispute — then fix the finding or, if genuinely blocked, ${phase.challengeBlockedText(forge)}. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → \`POST .../challenge/resolve\` with \`{"outcome":"upheld"}\` and continue to ${phase.challengeContinueText}; confirmed → fix it, or send \`{"outcome":"escalated"}\` to hand the dispute to the user.` + (hasLocalLlm ? ` For a local reviewer you may instead POST \`{"recheck":{"backend":"${localLlmBackendToken}","diff":"<unified diff>"}}\` and let the server re-run it and auto-derive the outcome.` : ''),
].join('\n');
// Per-reviewer round caps. This prompt drives the loop in PROSE (it isn't
// slashdo parsing a `~max=<n>` suffix), so a configured cap only binds if it's
@@ -884,7 +892,7 @@ ${extraNotes.length ? '\n' + extraNotes.join('\n') + '\n' : ''}
3. Re-review with the same reviewer until it reports clean, then advance to the next reviewer in the list.
${closingSteps.join('\n')}
-**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, post a PR comment summarising the unresolved blockers and exit. Do not loop indefinitely.
+**Hard stop:** if a reviewer's loop hasn't converged after 10 iterations, ${phase.hardStopAction(forge, { verbose: true })}. Do not loop indefinitely.
${repeatedCommentsNote}
@@ -905,8 +913,8 @@ ${cliReviewerProcedure}${(rprBody && (hasCopilot || hasGithubUser)) ? `\n### /do
? 'all required reviewers are satisfied and optional reviewers are satisfied or explicitly inconclusive (or the stop mode triggers)'
: 'all configured reviewers are satisfied (or the stop mode triggers)';
const hardStopNote = optionalConfiguredReviewers.length
- ? `**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, ${phase.hardStopAction}. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.`
- : `**Hard stop:** if a reviewer's loop is not converged after 10 rounds, ${phase.hardStopAction}.`;
+ ? `**Hard stop:** if a required reviewer's loop is not converged after 10 rounds, ${phase.hardStopAction(forge)}. An optional reviewer may end with an inconclusive result without blocking, but a substantive rejection, failed build/test, or push failure still blocks.`
+ : `**Hard stop:** if a reviewer's loop is not converged after 10 rounds, ${phase.hardStopAction(forge)}.`;
return [
heading,
phase.compactOpening(phaseCtx),