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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: accept a pinned Antigravity code review whose complete envelope is wrapped in one markdown fence (#10832)
Adam Eivy5f0cd1465a1c
diff --git a/server/services/codeReview.js b/server/services/codeReview.jsindex 985523e656..fef66fb1d0 100644--- a/server/services/codeReview.js+++ b/server/services/codeReview.js@@ -612,12 +612,20 @@ orA clean verdict requires an empty findings array. A findings verdict requires one to five complete findings. severity is "blocking" or "recommended"; location names the file:line when known (otherwise the affected boundary). Explain the concrete wrong outcome + suggested fix in one or two sentences, with each field at most 1000 characters. Never mix a clean verdict with findings, emit an incomplete finding, or add fields beyond this envelope.`+// An agentic CLI reviewer (agy) routinely returns the requested envelope as ONE+// markdown-fenced block despite "no markdown" — the reply is the whole envelope,+// only dressed. Unwrap it only when the fence spans the entire reply, so prose+// before/after a fence, an unclosed (truncated) fence, or several blocks still+// fall through to the strict parse and stay inconclusive (#10832).+const WHOLE_REPLY_JSON_FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n```$/i+// Transport success is not a review verdict. Accept only the exact legacy// clean reply or the complete bounded envelope we request; never extract a// clean substring from contradictory prose or salvage a truncated JSON reply.function normalizeCodeReviewVerdict(content) {- const text = typeof content === 'string' ? content.trim() : ''- if (/^no findings\.?$/i.test(text)) return { verdict: { verdict: 'clean', findings: text } }+ const trimmed = typeof content === 'string' ? content.trim() : ''+ if (/^no findings\.?$/i.test(trimmed)) return { verdict: { verdict: 'clean', findings: trimmed } }+ const text = WHOLE_REPLY_JSON_FENCE.exec(trimmed)?.[1].trim() ?? trimmedif (text.length > 20000) return { reason: 'oversized_content' }let parsedtry {diff --git a/server/services/codeReview.providers.test.js b/server/services/codeReview.providers.test.jsindex e719e903d2..81e176fef4 100644--- a/server/services/codeReview.providers.test.js+++ b/server/services/codeReview.providers.test.js@@ -92,6 +92,46 @@ describe('configured provider reviewers', () => {expect(config.optionalReviewers.includes(backend)).toBe(optional);});+ // #10832: agy answered a pinned claim review with the complete envelope inside+ // one ```json fence, which the strict parse reported as invalid_json.+ describe('pinned Antigravity CLI reviewer envelope', () => {+ const agy = { ...provider, id: 'antigravity-cli', type: 'cli', command: 'agy', models: [] };+ const agyBackend = 'provider:antigravity-cli';+ const finding = { severity: 'blocking', location: 'example.js:2', outcome: 'The sum now subtracts.', fix: 'Restore the addition.' };+ const findings = JSON.stringify({ verdict: 'findings', findings: [finding] });+ const review = text => {+ runCliProviderPrompt.mockResolvedValue({ text, partial: false, exitCode: 0, stderr: '' });+ return runLocalCodeReview({ backend: agyBackend, model: 'gemini-3.8-flash', effort: 'low', kind: 'claim-review', toolFree: true, diff: 'example diff' });+ };++ beforeEach(() => getProviderById.mockResolvedValue(agy));++ it.each([+ ['a json fence', `\`\`\`json\n${findings}\n\`\`\``],+ ['a bare fence with surrounding whitespace', `\n \`\`\`\n${findings}\n\`\`\`\n`],+ ])('accepts the complete envelope wrapped whole in %s', async (_label, text) => {+ expect(await review(text)).toMatchObject({ ok: true, verdict: 'findings',+ findings: '## Blocking\n\n- example.js:2: The sum now subtracts. Restore the addition.' });+ expect(runCliProviderPrompt.mock.lastCall[0]).toMatchObject({ provider: { id: 'antigravity-cli', effort: 'low' }, model: 'gemini-3.8-flash', exactPins: true, codeReview: true });+ expect(await review('```json\n{"verdict":"clean","findings":[]}\n```')).toMatchObject({ ok: true, verdict: 'clean', findings: 'No findings.' });+ });++ it.each([+ ['an unclosed (truncated) fence', `\`\`\`json\n${findings}`],+ ['a truncated envelope inside a fence', '```json\n{"verdict":"findings","findings":[{"severity":"blocking"\n```'],+ ['prose after the fence', `\`\`\`json\n{"verdict":"clean","findings":[]}\n\`\`\`\nBut a blocking defect remains.`],+ ['prose before the fence', `Here is my review:\n\`\`\`json\n{"verdict":"clean","findings":[]}\n\`\`\``],+ ['two fenced blocks', '```json\n{"verdict":"clean","findings":[]}\n```\n```json\n{"verdict":"clean","findings":[]}\n```'],+ ['a fenced contradictory envelope', '```json\n{"verdict":"clean","findings":[{"severity":"blocking","location":"a.js:1","outcome":"x","fix":"y"}]}\n```'],+ ])('keeps %s inconclusive with bounded diagnostics', async (_label, text) => {+ const result = await review(text);+ expect(result).toMatchObject({ ok: false, code: 'MALFORMED_REVIEW' });+ expect(result).not.toHaveProperty('verdict');+ expect(result).not.toHaveProperty('findings');+ expect(JSON.stringify(result)).not.toContain('Restore the addition');+ });+ });+it('uses only this provider default when unpinned and returns provider failure without substitution', async () => {callProviderAISimple.mockResolvedValue({ error: 'Selected model is unavailable' });expect(await runLocalCodeReview({ backend, diff: 'example diff' })).toMatchObject({ ok: false, error: 'Selected model is unavailable' });