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

test: cover the codex effort values that killed agents at config load

[._.]/ Adam Eivy057ab5d26ed3
diff --git a/server/services/agentCliSpawning.test.js b/server/services/agentCliSpawning.test.js
index 4abdc5b7cb..08e185895a 100644
--- a/server/services/agentCliSpawning.test.js
+++ b/server/services/agentCliSpawning.test.js
@@ -394,6 +394,20 @@ describe('buildCliSpawnConfig', () => {
expect(config.args).toContain('model_reasoning_effort=xhigh');
});
+ // Regression for the 2026-08-17 incident: codex's config enum stops at
+ // `xhigh`, so a task dispatched at `effort:max` used to spawn
+ // `codex -c model_reasoning_effort=max`, which codex rejects while LOADING
+ // its config — before the prompt is read, so every retry died identically.
+ // The TUI builder has the twin of this assertion; the CLI builder is the one
+ // that actually shipped the bad argv.
+ it('clamps max/ultra down to xhigh for codex rather than emitting a value it rejects', () => {
+ for (const effort of ['max', 'ultra']) {
+ const config = buildCliSpawnConfig({ id: 'codex', command: 'codex' }, 'gpt-5.4', {}, { effort });
+ expect(config.args).toContain('model_reasoning_effort=xhigh');
+ expect(config.args.join(' ')).not.toContain(`model_reasoning_effort=${effort}`);
+ }
+ });
+
it('adds --effort for claude', () => {
const config = buildCliSpawnConfig({ id: 'claude-code', command: 'claude' }, 'claude-opus-4-8', {}, { effort: 'high' });
expect(config.args[config.args.indexOf('--effort') + 1]).toBe('high');
diff --git a/server/services/agentErrorAnalysis.test.js b/server/services/agentErrorAnalysis.test.js
index 43bb8e07fb..39e4d29f7e 100644
--- a/server/services/agentErrorAnalysis.test.js
+++ b/server/services/agentErrorAnalysis.test.js
@@ -129,6 +129,27 @@ describe('analyzeAgentFailure — ERROR_PATTERNS classification', () => {
expect(analysis.message).not.toContain('/home/x/');
});
+ // Same incident, the OTHER source: PortOS's own `-c model_reasoning_effort=max`
+ // override. Codex reports an override rejection with the same "Error loading
+ // config.toml" lead but NO file:line:col prefix, so this wording is what the
+ // three failing runs on 2026-08-17 actually recorded — verified by running
+ // `codex exec -c model_reasoning_effort=max -`. Classifying it (not falling
+ // through to `unknown`) is what keeps it a Tier 1 config fix instead of an
+ // escalated investigation. `resolveCliEffort` is what stops PortOS emitting
+ // the bad value in the first place (server/lib/providerModels.js).
+ it('classifies a codex -c override rejection (no file path in the message)', () => {
+ const line = 'Error loading config.toml: unknown variant `max`, expected one of `none`, `minimal`, `low`, `medium`, `high`, `xhigh`\n in `model_reasoning_effort`';
+ const analysis = analyzeAgentFailure(withLead(line), { id: 't' }, 'gpt-5.6-sol');
+ expect(analysis.category).toBe('cli-config-invalid');
+ expect(analysis.rejectedConfigKey).toBe('model_reasoning_effort');
+ expect(analysis.rejectedConfigValue).toBe('max');
+ // A CLI that dies at config load dies identically every time — the run must
+ // block on the FIRST failure rather than burn all three retries on it.
+ const decision = resolveFailedTaskDecision({ id: 't', metadata: {} }, analysis);
+ expect(decision.status).toBe('blocked');
+ expect(decision.metadataUpdates.blockedCategory).toBe('cli-config-invalid');
+ });
+
it('classifies a config file that fails to load at all', () => {
const analysis = analyzeAgentFailure(withLead('Error loading config.toml: expected a value after the equals sign'), { id: 't' }, 'x');
expect(analysis.category).toBe('cli-config-invalid');