@@ -692,36 +692,34 @@ When creating pull requests, add the following footer at the end of the PR descr
692692 let configOptions : SessionConfigOption [ ] | undefined ;
693693 let agentSessionId : string ;
694694
695- if ( isReconnect && adapter === "codex" && config . sessionId ) {
696- const existingSessionId = config . sessionId ;
697- const loadResponse = await connection . loadSession ( {
698- sessionId : existingSessionId ,
699- cwd : repoPath ,
700- mcpServers,
701- } ) ;
702- configOptions = loadResponse . configOptions ?? undefined ;
703- agentSessionId = existingSessionId ;
704- } else if ( isReconnect && adapter === "claude" && config . sessionId ) {
695+ if ( isReconnect && config . sessionId ) {
705696 const existingSessionId = config . sessionId ;
706697
707- const posthogAPI = agent . getPosthogAPI ( ) ;
708- if ( posthogAPI ) {
709- await hydrateSessionJsonl ( {
710- sessionId : existingSessionId ,
711- cwd : repoPath ,
712- taskId,
713- runId : taskRunId ,
714- permissionMode : config . permissionMode ,
715- posthogAPI,
716- log,
717- } ) ;
698+ // Claude-specific: hydrate session JSONL from PostHog before resuming
699+ if ( adapter !== "codex" ) {
700+ const posthogAPI = agent . getPosthogAPI ( ) ;
701+ if ( posthogAPI ) {
702+ await hydrateSessionJsonl ( {
703+ sessionId : existingSessionId ,
704+ cwd : repoPath ,
705+ taskId,
706+ runId : taskRunId ,
707+ permissionMode : config . permissionMode ,
708+ posthogAPI,
709+ log,
710+ } ) ;
711+ }
718712 }
719713
720714 const systemPrompt = this . buildSystemPrompt (
721715 credentials ,
722716 taskId ,
723717 customInstructions ,
724718 ) ;
719+
720+ // Both adapters implement unstable_resumeSession:
721+ // - Claude: delegates to SDK's resumeSession with JSONL hydration
722+ // - Codex: delegates to codex-acp's loadSession internally
725723 const resumeResponse = await connection . unstable_resumeSession ( {
726724 sessionId : existingSessionId ,
727725 cwd : repoPath ,
0 commit comments