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

refactor: state the already-terminal turn guard plainly

[._.]/ Adam Eivy798455240e7f
diff --git a/server/lib/codexTurn.js b/server/lib/codexTurn.js
index e36f1a6bdf..df75af7745 100644
--- a/server/lib/codexTurn.js
+++ b/server/lib/codexTurn.js
@@ -327,7 +327,9 @@ const appendText = (acc, text) => {
* Returns `true` when the turn has reached a terminal state.
*/
export const applyCodexTurnEvent = (acc, method, params) => {
- if (!acc || acc.status !== 'inProgress') return acc?.status !== 'inProgress';
+ // Already terminal: report it as such so a late frame cannot settle the turn
+ // a second time, and never fold it into the answer.
+ if (!acc || acc.status !== 'inProgress') return true;
if (!params || typeof params !== 'object') return false;
if (acc.turnId && typeof params.turnId === 'string' && params.turnId !== acc.turnId) return false;