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: parse CoS reviewer verdicts deterministically

[._.]/ Adam Eivy733c5de9c7af
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 9e50fabf73..ca5437c90f 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -149,6 +149,8 @@
## Fixed
+- **CoS Codex review loops now parse Claude and Ollama verdicts deterministically** — Claude review logs are accepted as clean only when they contain the exact `NO FINDINGS` sentinel and no findings; otherwise Codex extracts only complete structured `FINDING N:` blocks to apply. Mixed, incomplete, or absent Claude verdicts are explicitly inconclusive instead of being guessed clean. Local Ollama/LM Studio review responses now extract and validate the JSON `.findings` field before use, surfacing the provider error when it is missing or malformed and terminating the failed review step nonzero. This prevents a text/JSON handoff mismatch from silently dropping reviewer findings or letting an ambiguous pass merge.
+
- **[issue-3059] Wordplay training checks now stay reliable during busy CI runs** — the test suite gives a newly selected word game time to finish its normal loading path, preventing intermittent build failures without weakening coverage.
- **"Choose a file" buttons now open the file picker from a remote browser** — the Screenshot and Attach buttons on the task form, Browse Files on the Uploads page, and ~20 other upload buttons across PortOS did nothing when you clicked them from another machine over the tailnet. Each one was a plain button whose click handler reached over and *programmatically* clicked a hidden `<input type="file">` — a synthetic click that several browsers refuse to honor, most notably Safari/WebKit when PortOS is running as an installed (standalone) app rather than a normal tab, which is exactly how it tends to get opened on a second machine or a tablet. Every one of those triggers is now a real `<label>` bound to its file input, so the browser opens the picker itself with no scripting involved. Three related annoyances went with it: every file picker in the app is now reachable by keyboard and screen reader (they were hidden from both, including six that already opened fine); re-picking the *same* file after a failed upload now works everywhere; and the Attach picker no longer greys out every file on iOS/iPadOS, where an extension-only filter isn't understood.
- **Uploads now state the real size limit instead of failing past ~41MB** — the Uploads page advertised a 100MB maximum and task attachments 50MB, but files are sent base64-encoded inside a JSON body, and the server's 55MB body cap means anything past roughly 41MB was rejected by the body parser before the size check ever ran — so a 60MB file produced an opaque failure rather than a limit message. Every base64-in-JSON upload path (general uploads, task attachments, SongBook attachments) now derives its cap from the body limit itself, so the advertised number is always one the server can actually accept. Screenshots keep their own deliberately smaller 10MB cap, now shared between client and server instead of being written twice.
diff --git a/lib/slashdo b/lib/slashdo
index 90c197ed35..8beb10378c 160000
--- a/lib/slashdo
+++ b/lib/slashdo
@@ -1 +1 @@
-Subproject commit 90c197ed35fc7d9582d2efb1ce635058eaeb895e
+Subproject commit 8beb10378c648eb290f9e0c98a1e46949d322635
diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.js
index f6434056fc..3903178148 100644
--- a/server/services/agentPromptBuilder.js
+++ b/server/services/agentPromptBuilder.js
@@ -423,7 +423,19 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,
// `POST /api/code-review/local` which runs the configured local model against
// the diff and returns findings text. The agent always reaches it via
// `http://localhost:5555` (the canonical loopback API port).
- const localLlmInvocation = `POST the diff to PortOS's local reviewer endpoint: \`gh pr diff ${prNumber || '<PR_NUMBER>'} | jq -Rs '{ backend: "<lmstudio|ollama>", diff: . }' | curl -sS -X POST http://localhost:5555/api/code-review/local -H 'Content-Type: application/json' -d @-\`. Substitute the active reviewer name for \`<lmstudio|ollama>\`. The response \`.findings\` field is the review text — treat it like any other reviewer's findings.`;
+ const localLlmInvocation = `POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it. Substitute the active reviewer name for \`<lmstudio|ollama>\`:
+\`\`\`bash
+REVIEW_RESPONSE=$(mktemp)
+gh pr diff ${prNumber || '<PR_NUMBER>'} | jq -Rs '{ backend: "<lmstudio|ollama>", diff: . }' | curl -sS -X POST http://localhost:5555/api/code-review/local -H 'Content-Type: application/json' -d @- > "$REVIEW_RESPONSE"
+if ! jq -er '.findings | select(type == "string" and length > 0)' "$REVIEW_RESPONSE" > "\${REVIEW_RESPONSE}.findings"; then
+ echo "Local reviewer failed: $(jq -r '.error // "missing .findings in reviewer response"' "$REVIEW_RESPONSE")" >&2
+ STATUS=cli-error # Never treat an absent or malformed response as clean.
+ exit 1
+else
+ cat "\${REVIEW_RESPONSE}.findings"
+fi
+\`\`\`
+Only a successfully extracted \`.findings\` value is the review text; treat it like any other reviewer's findings.`;
// Instruct the agent to request each username reviewer as a PR reviewer and
// gate the merge on their approval. `gh pr edit --add-reviewer` takes the bare
// login, so strip the `@`.
diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.js
index 01ee53a2a3..072f1881e6 100644
--- a/server/services/agentPromptBuilder.test.js
+++ b/server/services/agentPromptBuilder.test.js
@@ -1025,6 +1025,8 @@ describe('buildLightContextPrompt', () => {
expect(prompt).toMatch(/POST the diff to PortOS's local reviewer endpoint/);
expect(prompt).toMatch(/http:\/\/localhost:5555\/api\/code-review\/local/);
expect(prompt).toMatch(/gh pr diff 9 \| jq/);
+ expect(prompt).toMatch(/jq -er '\.findings \| select\(type == "string" and length > 0\)'/);
+ expect(prompt).toMatch(/Never treat an absent or malformed response as clean/);
});
it('threads reviewer into the TUI Completion Workflow as `/do:pr --review-with <reviewer>`', () => {
@@ -1469,6 +1471,15 @@ describe('buildReviewLoopFollowUpSection — CLI reviewer procedure inlining', (
});
}
+ it('fails the local reviewer command when its JSON response has no findings', () => {
+ const out = buildReviewLoopFollowUpSection(
+ { ...baseMeta, reviewLoopReviewers: ['ollama'] },
+ { verbose: false, localAgentLoopBody: null }
+ );
+ expect(out).toMatch(/Local reviewer failed:/);
+ expect(out).toMatch(/STATUS=cli-error[^]*exit 1/);
+ });
+
it('does NOT inline the procedure for a copilot-only loop', () => {
const out = buildReviewLoopFollowUpSection(
{ ...baseMeta, reviewLoopReviewers: ['copilot'] },