From 3f6c3459a6ce08fe06d739b7fac05a247830ceda Mon Sep 17 00:00:00 2001 From: axisrow Date: Sat, 1 Aug 2026 16:19:04 +0800 Subject: [PATCH] fix: replay buffered thread lifecycle events before turn filtering thread/started and thread/name/updated notifications for subagent threads can arrive before the main turn ID is known and get buffered. The live notification handler already special-cases these two methods to bypass belongsToTurn() filtering, but the buffered-replay path in captureTurn() did not, so early subagent thread labels were silently dropped and job logs fell back to raw thread IDs like thr_2. Apply the same bypass when replaying buffered notifications. Closes #36 --- plugins/codex/scripts/lib/codex.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/codex/scripts/lib/codex.mjs b/plugins/codex/scripts/lib/codex.mjs index fead00cc4..c3aaf2205 100644 --- a/plugins/codex/scripts/lib/codex.mjs +++ b/plugins/codex/scripts/lib/codex.mjs @@ -589,7 +589,9 @@ async function captureTurn(client, threadId, startRequest, options = {}) { state.threadTurnIds.set(state.threadId, state.turnId); } for (const message of state.bufferedNotifications) { - if (belongsToTurn(state, message)) { + if (message.method === "thread/started" || message.method === "thread/name/updated") { + applyTurnNotification(state, message); + } else if (belongsToTurn(state, message)) { applyTurnNotification(state, message); } else { if (previousHandler) {