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: keep one-shot Codex stages single-agent

[._.]/ Adam Eivy3274e11c77a5
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index caa0dfa840..8cb7fb3c2d 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -106,3 +106,5 @@
- **An arc write now repairs duplicate volume numbers instead of preserving them forever.** Two volumes sharing a number is not a state you can act on — the Arc Canvas draws both, an export can't tell which is canonical, and arc-verify blocks on it every round — but the sanitizer only ever de-duplicated by `id`, so the pair survived every pass untouched. Any ordinary arc write now collapses them, keeping whichever record has the strongest claim to the episodes underneath it (a volume you locked, else the one holding the most episodes, else the original), and re-points episodes stranded under the absorbed copies onto the survivor rather than dropping them into "Un-grouped". Content is only ever rescued, never overwritten: a field the survivor left empty is back-filled from the newest copy, and a field it already has is kept. A number shared by *two locked volumes* is deliberately left alone and warns instead — only you can say which freeze was meant. Installs already carrying duplicates heal on their next arc write, with no migration to run.
- **Autopilot now repairs duplicate volumes before it can waste work filling them.** Resume previously looked for empty volumes before any arc write reached the duplicate-volume self-heal, so malformed empty copies could receive a full issue breakdown only to be absorbed later. A zero-cost structural preflight now runs first, keeps existing issues attached to the canonical volume, and only then considers episode generation. If locks make the repair ambiguous, the run pauses before spending and asks for full edit control. Dry-run estimates mirror the same repair and no longer charge issue-generation calls for copies that will be absorbed.
+
+- **Synchronous Codex TUI stages stay single-agent.** A machine-consumed pipeline prompt could inherit Codex's general multi-agent feature, fan out work it never needed, and then spend its entire timeout waiting on those agents before repeating the same request on a fallback provider. The one-shot TUI runner now disables that feature only for Codex prompt calls; long-running CoS coding agents keep their configured collaboration posture, and other TUI providers are unchanged.
diff --git a/server/lib/tuiPromptRunner.js b/server/lib/tuiPromptRunner.js
index 5940c199d3..6f98d6e01f 100644
--- a/server/lib/tuiPromptRunner.js
+++ b/server/lib/tuiPromptRunner.js
@@ -58,6 +58,7 @@ import {
detectMissingTuiBinary,
} from './tuiHandshake.js';
import { buildCliChildEnv } from './cliChildEnv.js';
+import { isCodexCommand } from './codex.js';
// One-shot defaults that don't apply to the long-running agent path:
// - hard run cap (5 min vs unbounded for agents)
@@ -67,6 +68,22 @@ import { buildCliChildEnv } from './cliChildEnv.js';
const DEFAULT_TIMEOUT_MS = 300000;
const DEFAULT_ONE_SHOT_IDLE_MS = 8000;
+// A one-shot prompt must return one machine-consumed answer. Codex's general
+// interactive TUI inherits the user's multi-agent feature flag, which can turn
+// that bounded request into agent fan-out + wait loops that consume the entire
+// timeout before the fallback provider repeats the work. Long-running CoS
+// agents use agentTuiSpawning.js and keep their configured collaboration
+// posture; only this synchronous prompt runner pins the feature off.
+function buildOneShotTuiArgs(command, args) {
+ if (!isCodexCommand(command)) return args;
+ const alreadyDisabled = args.some((arg, index) => (
+ arg === '--disable=multi_agent'
+ || (arg === '--disable' && args[index + 1] === 'multi_agent')
+ || (arg === '-c' && args[index + 1] === 'features.multi_agent=false')
+ ));
+ return alreadyDisabled ? args : [...args, '--disable', 'multi_agent'];
+}
+
// Wide PTY so TUI doesn't wrap responses at narrow widths, which makes
// downstream parsing harder.
const PTY_COLS = 200;
@@ -118,7 +135,9 @@ export async function executeTuiRun({ runId, provider, prompt, workspacePath, on
throw new Error('executeTuiRun: prompt must be a non-empty string');
}
- const { command, args } = buildTuiInvocation(provider, provider.defaultModel);
+ const invocation = buildTuiInvocation(provider, provider.defaultModel);
+ const { command } = invocation;
+ const args = buildOneShotTuiArgs(command, invocation.args);
const promptDelayMs = provider.tuiPromptDelayMs ?? DEFAULT_TUI_PROMPT_DELAY_MS;
const idleThresholdMs = idleMs ?? provider.tuiOneShotIdleMs ?? DEFAULT_ONE_SHOT_IDLE_MS;
const totalTimeoutMs = timeout ?? provider.timeout ?? DEFAULT_TIMEOUT_MS;
diff --git a/server/lib/tuiPromptRunner.test.js b/server/lib/tuiPromptRunner.test.js
index 2565f19ba4..0b1f6c33cc 100644
--- a/server/lib/tuiPromptRunner.test.js
+++ b/server/lib/tuiPromptRunner.test.js
@@ -316,6 +316,40 @@ describe('executeTuiRun', () => {
});
describe('startup hooks', () => {
+ it('disables Codex multi-agent fan-out for one-shot prompt runs', async () => {
+ const provider = {
+ id: 'codex-tui', type: 'tui', command: '/opt/homebrew/bin/codex', defaultModel: 'gpt-x',
+ };
+ const promise = executeTuiRun({
+ runId: 'run-codex-one-shot', provider, prompt: 'return one structured response',
+ workspacePath: TEST_WORKSPACE,
+ });
+ await flushAsync();
+
+ const args = ptySpawnMock.mock.calls[0][1];
+ expect(args).toContain('--disable');
+ expect(args[args.indexOf('--disable') + 1]).toBe('multi_agent');
+
+ ptyInstances[0].emitExit({ exitCode: 0 });
+ await promise;
+ });
+
+ it('does not add Codex feature flags to other one-shot TUI providers', async () => {
+ const provider = {
+ id: 'claude-tui', type: 'tui', command: 'claude', defaultModel: 'claude-fable-5',
+ };
+ const promise = executeTuiRun({
+ runId: 'run-claude-one-shot', provider, prompt: 'return one structured response',
+ workspacePath: TEST_WORKSPACE,
+ });
+ await flushAsync();
+
+ expect(ptySpawnMock.mock.calls[0][1]).not.toContain('--disable');
+
+ ptyInstances[0].emitExit({ exitCode: 0 });
+ await promise;
+ });
+
it('registers the PTY in the active-runs map and fires emitRunStarted with provider + defaultModel', async () => {
const provider = {
id: 'claude', type: 'tui', command: 'echo', defaultModel: 'claude-3.5',