fix: add missing threadId to native event logger in ClaudeCodeAdapter

The logNativeSdkMessage function was missing the canonical threadId in the
event payload and was passing null as the thread ID to nativeEventLogger.write(),
routing all Claude native events to the global log instead of per-thread files.

Add context.session.threadId to both the event object and as the second argument
to write(), matching how the Codex adapter routes native events per-thread.

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Cursor AgentandJulius Marminge committed 2026-03-06 05:05:06 +00:00
1 parent 1beeff2564
commit 8489584240
1 file changed
+2 -1
@@ -502,6 +502,7 @@ function makeClaudeCodeAdapter(options?: ClaudeCodeAdapterLiveOptions) {
provider: PROVIDER,
createdAt: observedAt,
method: sdkNativeMethod(message),
threadId: context.session.threadId,
...(typeof message.session_id === "string"
? { providerThreadId: message.session_id }
: {}),
@@ -510,7 +511,7 @@ function makeClaudeCodeAdapter(options?: ClaudeCodeAdapterLiveOptions) {
payload: message,
},
},
null,
context.session.threadId,
);
});