Merge pull request #731 from oussamadouhou/fix/background-task-directory-inheritance

fix(background-agent): inherit parent session directory for background tasks
This commit is contained in:
Kenny
2026-01-13 12:38:38 -05:00
committed by GitHub
5 changed files with 43 additions and 1 deletions
+12
View File
@@ -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