From 01e801aace87f689e19dea0d2a8921428c28df44 Mon Sep 17 00:00:00 2001 From: AndyMik90 Date: Tue, 16 Dec 2025 14:19:39 +0100 Subject: [PATCH] Integrate profile environment for OAuth token in task handlers - Added functionality to retrieve and include the active Claude profile environment, specifically the OAuth token, in the task handlers for AI merge resolution. - Enhanced debugging output to log the presence of the OAuth token and configuration directory during the merge process. - Ensured consistency by applying the profile environment in both the merge and preview processes. --- .../src/main/ipc-handlers/task-handlers.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/auto-claude-ui/src/main/ipc-handlers/task-handlers.ts b/auto-claude-ui/src/main/ipc-handlers/task-handlers.ts index a86a278d..e97d287f 100644 --- a/auto-claude-ui/src/main/ipc-handlers/task-handlers.ts +++ b/auto-claude-ui/src/main/ipc-handlers/task-handlers.ts @@ -11,6 +11,7 @@ import { titleGenerator } from '../title-generator'; import { AgentManager } from '../agent'; import { PythonEnvManager } from '../python-env-manager'; import { getEffectiveSourcePath } from '../auto-claude-updater'; +import { getProfileEnv } from '../rate-limit-detector'; /** @@ -1325,11 +1326,19 @@ export function registerTaskHandlers( debug('Running command:', pythonPath, args.join(' ')); debug('Working directory:', sourcePath); + // Get profile environment with OAuth token for AI merge resolution + const profileEnv = getProfileEnv(); + debug('Profile env for merge:', { + hasOAuthToken: !!profileEnv.CLAUDE_CODE_OAUTH_TOKEN, + hasConfigDir: !!profileEnv.CLAUDE_CONFIG_DIR + }); + return new Promise((resolve) => { const mergeProcess = spawn(pythonPath, args, { cwd: sourcePath, env: { ...process.env, + ...profileEnv, // Include active Claude profile OAuth token PYTHONUNBUFFERED: '1' } }); @@ -1770,10 +1779,13 @@ export function registerTaskHandlers( const pythonPath = pythonEnvManager.getPythonPath() || 'python3'; console.log('[IPC] Running merge preview:', pythonPath, args.join(' ')); + // Get profile environment for consistency + const previewProfileEnv = getProfileEnv(); + return new Promise((resolve) => { const previewProcess = spawn(pythonPath, args, { cwd: sourcePath, - env: { ...process.env, PYTHONUNBUFFERED: '1', DEBUG: 'true' } + env: { ...process.env, ...previewProfileEnv, PYTHONUNBUFFERED: '1', DEBUG: 'true' } }); let stdout = '';