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: report oversized CLI review prompts as a size failure, not a credential error (#10273)
Adam Eivy96e2dc6337de
diff --git a/server/lib/cliProviderRun.js b/server/lib/cliProviderRun.jsindex f66ce6e056..9f7752fea0 100644--- a/server/lib/cliProviderRun.js+++ b/server/lib/cliProviderRun.js@@ -35,6 +35,16 @@ const STDERR_TAIL_LIMIT = 500;const stderrTailOf = (stderr) => stderr.trim().slice(-STDERR_TAIL_LIMIT);+// Sanitized result for a synchronous spawn exception. Only the OS error code+// and the configured command name are echoed; `err.message` can embed argv.+function spawnThrowResult(err, command) {+ const code = typeof err?.code === 'string' && /^[A-Z0-9_]{2,32}$/.test(err.code) ? err.code : 'SPAWN_FAILED';+ const error = code === 'E2BIG'+ ? `Prompt is too large for ${command}'s command-line transport (E2BIG); the run was not started. Reduce the input size.`+ : `Failed to spawn ${command} (${code}).`;+ return { error, code };+}+/*** Resolve which CLI provider + model a feature should use from the providers* list and the feature's stored `{ providerId, model }` config.@@ -184,12 +194,22 @@ export function runCliProviderPrompt(args = {}) {// the harness running past the run (#7496). False for every unwrapped// spawn — including the `sandboxed-actions` posture, which is never wrapped.const processGroup = needsProcessGroup(wrapped);- const child = spawn(spawnCommand, wrappedArgs, {- cwd: effectiveCwd,- stdio: ['pipe', 'pipe', 'pipe'],- env: childEnv,- detached: processGroup,- });+ let child;+ try {+ child = spawn(spawnCommand, wrappedArgs, {+ cwd: effectiveCwd,+ stdio: ['pipe', 'pipe', 'pipe'],+ env: childEnv,+ detached: processGroup,+ });+ } catch (err) {+ // spawn can THROW synchronously (E2BIG for an argv-delivered prompt over+ // the OS limit, EINVAL, ...) which the 'error' listener below never sees.+ // Honor the never-reject contract: release the prompt file and return a+ // bounded diagnostic — never argv, env, or prompt text (#10273).+ cleanupPromptFile();+ return resolve(spawnThrowResult(err, provider.command));+ }// Remember the detached group so the graceful-shutdown sweep can reach it:// detaching moved this child out of the server's own process group, and a// shutdown driven by a signal to THAT group would otherwise orphan it (#7496).diff --git a/server/lib/cliProviderRun.test.js b/server/lib/cliProviderRun.test.jsindex 7610146506..5fb4e3a03b 100644--- a/server/lib/cliProviderRun.test.js+++ b/server/lib/cliProviderRun.test.js@@ -379,3 +379,30 @@ describe('runCliProviderPrompt — credential-bootstrap process-group teardown',expect(alive).toBe(false);});});++describe('runCliProviderPrompt — synchronous spawn failure (#10273)', () => {+ it('resolves a sanitized E2BIG failure for an argv-delivered oversized prompt, releasing prompt resources', async () => {+ const { mkdtemp, writeFile, rm } = await import('node:fs/promises');+ const { tmpdir } = await import('node:os');+ const { join } = await import('node:path');+ const dir = await mkdtemp(join(tmpdir(), 'portos-e2big-'));+ try {+ // Antigravity delivers the prompt as the --print argv VALUE (no stdin).+ const command = join(dir, 'agy');+ await writeFile(command, '#!/bin/sh\necho ok\n', { mode: 0o755 });+ const provider = cli('agy', { command });+ const secret = 'SECRET-PROMPT-BODY';+ const result = await runCliProviderPrompt({ provider, prompt: secret + 'x'.repeat(3_000_000), cwd: dir, timeoutMs: 10000 });+ expect(result).toMatchObject({ code: 'E2BIG' });+ expect(result.error).toMatch(/too large/i);+ expect(JSON.stringify(result)).not.toContain(secret);+ expect(result.error.length).toBeLessThan(300);++ // Negative control: a normal prompt through the same provider launches.+ const ok = await runCliProviderPrompt({ provider, prompt: 'hello', cwd: dir, timeoutMs: 10000 });+ expect(ok).toMatchObject({ text: 'ok', exitCode: 0, partial: false });+ } finally {+ await rm(dir, { recursive: true, force: true });+ }+ });+});diff --git a/server/services/codeReview.providers.test.js b/server/services/codeReview.providers.test.jsindex c1b21cfd53..5ae37e4205 100644--- a/server/services/codeReview.providers.test.js+++ b/server/services/codeReview.providers.test.js@@ -140,6 +140,16 @@ describe('configured provider reviewers', () => {expect(await runLocalCodeReview({ backend, diff: 'example diff' })).toMatchObject({ ok: false });});+ it('reports an oversized-input spawn failure as a specific non-verdict, not a credential fault (#10273)', async () => {+ getProviderById.mockResolvedValue({ ...provider, type: 'tui', command: 'claude' });+ runCliProviderPrompt.mockResolvedValue({ error: "Prompt is too large for agy's command-line transport (E2BIG); the run was not started. Reduce the input size.", code: 'E2BIG' });+ const result = await runLocalCodeReview({ backend, diff: 'example diff' });+ expect(result).toMatchObject({ ok: false, code: 'E2BIG' });+ expect(result.error).toMatch(/too large/);+ expect(result.error).not.toMatch(/credential/i);+ expect(result).not.toHaveProperty('findings');+ });+// #7720: a bootstrap-credentialed harness has a maintained no-tool recipe and// must be usable as a reviewer, not refused at selection time. The record// reaches the CLI spawn with its `credentialBootstrap` intact — that is what