@@ -232,31 +232,6 @@ export class AgentService extends TypedEventEmitter<AgentServiceEvents> {
232232 return count ;
233233 }
234234
235- /**
236- * Flag to force invalid sdkSessionId on next reconnect (dev tool for testing error handling).
237- */
238- private forceInvalidSdkSessionId = false ;
239-
240- /**
241- * Enable forcing an invalid sdkSessionId on the next reconnect.
242- * This triggers the "No conversation found" error for testing.
243- */
244- public setForceInvalidSdkSessionId ( enabled : boolean ) : void {
245- this . forceInvalidSdkSessionId = enabled ;
246- log . info ( "Force invalid sdkSessionId" , { enabled } ) ;
247- }
248-
249- /**
250- * Check and consume the forceInvalidSdkSessionId flag.
251- */
252- private consumeForceInvalidSdkSessionId ( ) : boolean {
253- if ( this . forceInvalidSdkSessionId ) {
254- this . forceInvalidSdkSessionId = false ;
255- return true ;
256- }
257- return false ;
258- }
259-
260235 /**
261236 * Respond to a pending permission request from the UI.
262237 * This resolves the promise that the agent is waiting on.
@@ -436,44 +411,22 @@ export class AgentService extends TypedEventEmitter<AgentServiceEvents> {
436411 const mcpServers = this . buildMcpServers ( credentials ) ;
437412
438413 if ( isReconnect ) {
439- // Dev tool: force invalid sdkSessionId to test error handling
440- const effectiveSdkSessionId = this . consumeForceInvalidSdkSessionId ( )
441- ? "00000000-0000-0000-0000-000000000000"
442- : sdkSessionId ;
443-
444- if ( effectiveSdkSessionId !== sdkSessionId ) {
445- log . warn ( "Using forced invalid sdkSessionId for testing" , {
446- original : sdkSessionId ,
447- forced : effectiveSdkSessionId ,
448- } ) ;
449- }
450-
451- try {
452- await connection . extMethod ( "_posthog/session/resume" , {
453- sessionId : taskRunId ,
454- cwd : repoPath ,
455- mcpServers,
456- _meta : {
457- ...( logUrl && {
458- persistence : { taskId, runId : taskRunId , logUrl } ,
459- } ) ,
460- ...( effectiveSdkSessionId && {
461- sdkSessionId : effectiveSdkSessionId ,
462- } ) ,
463- ...( additionalDirectories ?. length && {
464- claudeCode : {
465- options : { additionalDirectories } ,
466- } ,
467- } ) ,
468- } ,
469- } ) ;
470- } catch ( resumeError ) {
471- log . error ( "Failed to resume session via extMethod" , {
472- taskRunId,
473- error : resumeError ,
474- } ) ;
475- throw resumeError ;
476- }
414+ await connection . extMethod ( "_posthog/session/resume" , {
415+ sessionId : taskRunId ,
416+ cwd : repoPath ,
417+ mcpServers,
418+ _meta : {
419+ ...( logUrl && {
420+ persistence : { taskId, runId : taskRunId , logUrl } ,
421+ } ) ,
422+ ...( sdkSessionId && { sdkSessionId } ) ,
423+ ...( additionalDirectories ?. length && {
424+ claudeCode : {
425+ options : { additionalDirectories } ,
426+ } ,
427+ } ) ,
428+ } ,
429+ } ) ;
477430 } else {
478431 await connection . newSession ( {
479432 cwd : repoPath ,
0 commit comments