Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(heterogeneous-agent): spawn Codex quota RPC without retired untrusted flag (#18603)

AmAzing-cbbf5fb3d15f
diff --git a/apps/desktop/src/main/modules/heterogeneousAgent/codexQuota.test.ts b/apps/desktop/src/main/modules/heterogeneousAgent/codexQuota.test.ts
index e99af6b2ab6..a89f1837381 100644
--- a/apps/desktop/src/main/modules/heterogeneousAgent/codexQuota.test.ts
+++ b/apps/desktop/src/main/modules/heterogeneousAgent/codexQuota.test.ts
@@ -183,7 +183,7 @@ describe('fetchCodexQuota', () => {
expect(readFile).toHaveBeenCalledWith('/tmp/codex-home/auth.json', 'utf8');
expect(spawnMock).toHaveBeenCalledWith(
'/custom/bin/codex',
- ['-s', 'read-only', '-a', 'untrusted', 'app-server'],
+ ['app-server'],
expect.objectContaining({
env: expect.objectContaining({
CODEX_HOME: '/tmp/codex-home',
diff --git a/apps/desktop/src/main/modules/heterogeneousAgent/codexQuota.ts b/apps/desktop/src/main/modules/heterogeneousAgent/codexQuota.ts
index b0296caa002..d01580683d7 100644
--- a/apps/desktop/src/main/modules/heterogeneousAgent/codexQuota.ts
+++ b/apps/desktop/src/main/modules/heterogeneousAgent/codexQuota.ts
@@ -12,7 +12,7 @@ import type {
CodexRateLimitResetOutcome,
CodexRateLimitSnapshot,
} from '@lobechat/electron-client-ipc';
-import { resolveCliSpawnPlan } from '@lobechat/heterogeneous-agents/spawn';
+import { buildCodexAppServerArgs, resolveCliSpawnPlan } from '@lobechat/heterogeneous-agents/spawn';
const RPC_TIMEOUT_MS = 10_000;
const CODEX_PRIMARY_WINDOW_MINUTES = 5 * 60;
@@ -438,7 +438,10 @@ const requestViaRpc = async <T>(
let rpcId = 0;
let timeout: ReturnType<typeof setTimeout> | undefined;
- const rpcArgs = ['-s', 'read-only', '-a', 'untrusted', 'app-server'];
+ // Headless app-server only. TUI flags such as `-a untrusted` are parsed
+ // before the subcommand, and current Codex CLI rejects `untrusted`
+ // (`--ask-for-approval` accepts only `on-request` and `never`).
+ const rpcArgs = buildCodexAppServerArgs();
const cleanup = (kill: boolean) => {
if (finished) return false;