Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/server/__tests__/conversation-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ describe('ConversationService', () => {
)
expect(env.CC_HAHA_DESKTOP_SERVER_URL).toBe('http://127.0.0.1:3456')
expect(env.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING).toBe('1')
expect(env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN).toBe('1')
})

test('buildChildEnv does not force interrupted-turn resume for non-SDK sessions', async () => {
const service = new ConversationService() as any
const env = (await service.buildChildEnv('/tmp')) as Record<string, string>

expect(env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN).toBeUndefined()
})

test('uses bun entrypoint fallback on Windows dev mode', () => {
Expand Down
10 changes: 10 additions & 0 deletions src/server/services/conversationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,16 @@ export class ConversationService {
CLAUDE_CODE_ENABLE_TASKS: '1',
CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING: '1',
CLAUDE_CODE_DIAGNOSTICS_FILE: cliDiagnosticsPath,
// Desktop frequently restarts the SDK CLI in-place (stop generation,
// runtime/model switch, reconnect). When the previous turn was
// interrupted, print.ts only re-enqueues that interrupted user prompt if
// this env flag is enabled. Without it, the resumed transcript keeps the
// synthetic "[Request interrupted by user]" / "No response requested."
// pair, but the interrupted prompt is not actively resumed on restart,
// which can make follow-up turns appear to "forget" earlier user input.
...(sdkUrl
? { CLAUDE_CODE_RESUME_INTERRUPTED_TURN: '1' }
: {}),
CALLER_DIR: workDir,
PWD: workDir,
...(sdkUrl
Expand Down
Loading