fix(background-agent): inherit parent session directory for background tasks
Background tasks were defaulting to $HOME instead of the parent session's working directory. This caused background agents to scan the entire home directory instead of the project directory, leading to: - High CPU/memory load from scanning unrelated files - Permission errors on system directories - Task failures and timeouts The fix retrieves the parent session's directory before creating a new background session and passes it via the query.directory parameter. Files modified: - manager.ts: Look up parent session directory in launch() - call-omo-agent/tools.ts: Same fix for sync mode - look-at/tools.ts: Same fix for look_at tool - sisyphus-task/tools.ts: Same fix + interface update for directory prop - index.ts: Pass directory to sisyphusTask factory
This commit is contained in:
@@ -75,11 +75,23 @@ export class BackgroundManager {
|
||||
|
||||
await this.concurrencyManager.acquire(concurrencyKey)
|
||||
|
||||
const parentSession = await this.client.session.get({
|
||||
path: { id: input.parentSessionID },
|
||||
}).catch((err) => {
|
||||
log(`[background-agent] Failed to get parent session: ${err}`)
|
||||
return null
|
||||
})
|
||||
const parentDirectory = parentSession?.data?.directory ?? this.directory
|
||||
log(`[background-agent] Parent dir: ${parentSession?.data?.directory}, using: ${parentDirectory}`)
|
||||
|
||||
const createResult = await this.client.session.create({
|
||||
body: {
|
||||
parentID: input.parentSessionID,
|
||||
title: `Background: ${input.description}`,
|
||||
},
|
||||
query: {
|
||||
directory: parentDirectory,
|
||||
},
|
||||
}).catch((error) => {
|
||||
this.concurrencyManager.release(concurrencyKey)
|
||||
throw error
|
||||
|
||||
Reference in New Issue
Block a user