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: retain reviewer refusal detection after stderr truncation (#10666)

Adam Eivybce220784abc
diff --git a/server/services/codeReview.js b/server/services/codeReview.js
index 3c42db7e6c..985523e656 100644
--- a/server/services/codeReview.js
+++ b/server/services/codeReview.js
@@ -927,8 +927,10 @@ async function runConfiguredProviderCompletion({ backend, model: pinnedModel, me
.finally(() => isolatedCwd && rm(isolatedCwd, { recursive: true, force: true }))
// A failed headless command request is a configuration fault, not a verdict.
// Replace vendor prose with a bounded remedy before health or bridge output.
- if (result.error || result.partial || !result.text?.trim()) {
- const code = reviewerCommandPermissionFailureCode(result.error || result.stderr)
+ if (!isTimeoutFailure(result.error) && (result.error || result.partial || !result.text?.trim())) {
+ // The CLI runner truncates error to a stderr prefix; the full stderr can
+ // carry the explicit refusal after that prefix. A timeout stays transient.
+ const code = reviewerCommandPermissionFailureCode(result.error) || reviewerCommandPermissionFailureCode(result.stderr)
if (code) return {
ok: false,
code,
diff --git a/server/services/codeReview.providers.test.js b/server/services/codeReview.providers.test.js
index 84abc10a0e..e719e903d2 100644
--- a/server/services/codeReview.providers.test.js
+++ b/server/services/codeReview.providers.test.js
@@ -153,20 +153,22 @@ describe('configured provider reviewers', () => {
it('returns a bounded configuration fault for an explicit headless command refusal without a verdict', async () => {
getProviderById.mockResolvedValue({ ...provider, type: 'cli', command: 'agy' });
const diagnostic = 'jetski: no output produced — a tool required the "command" permission that headless mode cannot prompt for, so it was auto-denied.';
- for (const failure of [{ error: `${diagnostic} Synthetic vendor advice follows.` }, { stderr: diagnostic, text: '', partial: false }, { stderr: diagnostic, text: 'incomplete', partial: true }]) {
+ for (const failure of [{ error: `${diagnostic} Synthetic vendor advice follows.` }, { error: 'Synthetic log prelude'.repeat(30), stderr: diagnostic }, { stderr: diagnostic, text: '', partial: false }, { stderr: diagnostic, text: 'incomplete', partial: true }]) {
runCliProviderPrompt.mockResolvedValue({ ...failure, stderr: `${diagnostic}\nsynthetic-private-path-or-credential` });
const result = await runLocalCodeReview({ backend, diff: 'example diff' });
expect(result).toEqual({ ok: false, code: 'REVIEWER_COMMAND_PERMISSION_DENIED', error: expect.stringContaining('supported tool-free vendor configuration') });
expect(isReviewerConfigFault(result.code)).toBe(true);
expect(JSON.stringify(result)).not.toContain('synthetic-private');
}
- expect(runCliProviderPrompt).toHaveBeenCalledTimes(3);
+ expect(runCliProviderPrompt).toHaveBeenCalledTimes(4);
expect(callProviderAISimple).not.toHaveBeenCalled();
});
it.each(['permission denied', 'headless mode cannot prompt for permission', 'Reviewer returned no content.', 'Provider call timed out after 1000ms', 'connection reset'])('keeps generic CLI failure transient: %s', async error => {
getProviderById.mockResolvedValue({ ...provider, type: 'cli', command: 'agy' });
- runCliProviderPrompt.mockResolvedValue({ error });
+ runCliProviderPrompt.mockResolvedValue({ error, ...(error.includes('timed out') ? {
+ stderr: 'jetski: no output produced — a tool required the "command" permission that headless mode cannot prompt for, so it was auto-denied.',
+ } : {}) });
const result = await runLocalCodeReview({ backend, diff: 'example diff', timeoutMs: 1000 });
expect(result.ok).toBe(false);
expect(result.error).toContain(error.includes('timed out') ? 'timed out after 1000ms' : error);