Skip to content
Merged
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
9 changes: 2 additions & 7 deletions src/main/lib/agentRuntime/backgroundExecSessionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import path from 'path'
import { nanoid } from 'nanoid'
import logger from '@shared/logger'
import { getShellEnvironment, getUserShell } from './shellEnvHelper'
import { getUserShell } from './shellEnvHelper'
import { terminateProcessTree } from './processTree'
import { resolveSessionDir } from './sessionPaths'

Expand Down Expand Up @@ -121,7 +121,6 @@
const config = getConfig()
const sessionId = `bg_${nanoid(12)}`
const { shell, args } = getUserShell()
const shellEnv = await getShellEnvironment()

const sessionDir = resolveSessionDir(conversationId)
if (sessionDir) {
Expand All @@ -134,11 +133,7 @@

const child = spawn(shell, [...args, command], {
cwd,
env: {
...process.env,
...shellEnv,
...options?.env
},
env: { ...process.env, ...(options?.env ?? {}) },

Check warning on line 136 in src/main/lib/agentRuntime/backgroundExecSessionManager.ts

View workflow job for this annotation

GitHub Actions / build-check (x64)

eslint-plugin-unicorn(no-useless-fallback-in-spread)

Empty fallbacks in spreads are unnecessary
detached: process.platform !== 'win32',
stdio: ['pipe', 'pipe', 'pipe']
})
Expand Down
17 changes: 7 additions & 10 deletions src/main/lib/agentRuntime/rtkRuntimeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
UsageDashboardRtkSummary
} from '@shared/types/agent-interface'
import logger from '@shared/logger'
import { getShellEnvironment } from './shellEnvHelper'
import { getShellEnvironment, mergeCommandEnvironment } from './shellEnvHelper'
import { RuntimeHelper } from '../runtimeHelper'

const RTK_ENABLED_SETTING_KEY = 'rtkEnabled'
Expand Down Expand Up @@ -650,15 +650,12 @@ export class RtkRuntimeService {
dbPath?: string
): Promise<Record<string, string>> {
const shellEnv = await this.getShellEnvironmentImpl()
const env = this.runtimeHelper.prependBundledRuntimeToEnv({
...Object.fromEntries(
Object.entries(process.env).filter(
(entry): entry is [string, string] => typeof entry[1] === 'string'
)
),
...shellEnv,
...baseEnv
})
const env = this.runtimeHelper.prependBundledRuntimeToEnv(
mergeCommandEnvironment({
shellEnv,
overrides: baseEnv
})
)

if (dbPath) {
fs.mkdirSync(path.dirname(dbPath), { recursive: true })
Expand Down
Loading
Loading