Skip to content

Commit b9016ba

Browse files
refactor: Improve Aider process environment setup
- Refactored environment variable preparation for Aider process - Moved environment setup before process spawn to ensure proper configuration - Simplified model provider environment configuration - Improved separation of concerns in environment variable management
1 parent 145ce09 commit b9016ba

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/patch.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -481,20 +481,21 @@ export class PatchClient {
481481
console.log(`Running aider with mode: ${this.options.mode}, model: ${model}`);
482482
console.log(`Arguments: ${args.join(' ')}`);
483483

484+
// Create environment with model provider setup
485+
const processEnv = { ...process.env };
486+
processEnv.AIDER_MODE = this.options.mode || 'patcher';
487+
processEnv.AIDER_DEBUG = '1';
488+
489+
// Setup the model provider's environment variables
490+
this.modelProvider.setupEnvironment(processEnv);
491+
484492
// Run aider with a timeout
485493
const aiderProcess = spawn('aider', args, {
486494
cwd: issueDir,
487495
stdio: 'pipe',
488-
env: {
489-
...process.env,
490-
AIDER_MODE: this.options.mode || 'patcher',
491-
AIDER_DEBUG: '1'
492-
}
496+
env: processEnv
493497
});
494498

495-
// Setup the model provider's environment variables
496-
this.modelProvider.setupEnvironment(aiderProcess.env as NodeJS.ProcessEnv);
497-
498499
let stdout = '';
499500
let stderr = '';
500501

0 commit comments

Comments
 (0)