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: surface an already-aborted Codex turn without dispatching turn/start (#5649)
Adam Eivyf8d807951aea
diff --git a/server/services/codexAppServer.js b/server/services/codexAppServer.jsindex 75b7a17fd7..548fd05e6c 100644--- a/server/services/codexAppServer.js+++ b/server/services/codexAppServer.js@@ -848,6 +848,11 @@ export async function runCodexTextTurn({else signal?.addEventListener('abort', onAbort, { once: true });try {+ // Already aborted: `onAbort` has rejected `finished`, so awaiting it here+ // surfaces the cancellation WITHOUT dispatching a turn — no quota is spent,+ // and Stop does not have to wait out a `turn/start` response that would+ // only be thrown away. The `finally` below still runs the shared cleanup.+ if (signal?.aborted) await finished;const response = await sendRequest(owner, CODEX_TURN_RPC.turnStart, {threadId,input: [{ type: 'text', text: prompt }],diff --git a/server/services/codexAppServer.turn.test.js b/server/services/codexAppServer.turn.test.jsindex b2e1e95272..b61d1e7652 100644--- a/server/services/codexAppServer.turn.test.js+++ b/server/services/codexAppServer.turn.test.js@@ -197,11 +197,11 @@ describe('running a text turn', () => {controller.abort();child.reply(frame, { thread: { id: 'thread-1' } });});- await awaitRequest(child, 'turn/start', { turn: { id: 'turn-1', items: [], status: 'inProgress' } });await expect(promise).rejects.toMatchObject({ code: CODEX_TURN_ERROR_CODES.turnInterrupted });- await vi.waitFor(() => expect(child.lastRequest('turn/interrupt')).toBeTruthy());- expect(child.lastRequest('turn/interrupt').params).toEqual({ threadId: 'thread-1', turnId: 'turn-1' });+ // Cancellation is surfaced without dispatching the turn at all, so Stop+ // neither spends quota nor waits out a `turn/start` round trip.+ expect(child.lastRequest('turn/start')).toBeUndefined();});it('carries a quota failure out as a usage-limit category', async () => {