refactor(background-agent): rename registerExternalTask to trackTask

Update BackgroundManager to rename the method for tracking external tasks, improving clarity and consistency in task management. Adjust related tests to reflect the new method name.
This commit is contained in:
Jeremy Gollehon 2026-01-15 10:53:08 -08:00
parent b5bd837025
commit 8e2410f1a0
No known key found for this signature in database
2 changed files with 12 additions and 12 deletions

View File

@ -960,7 +960,7 @@ describe("BackgroundManager.tryCompleteTask", () => {
}) })
}) })
describe("BackgroundManager.registerExternalTask", () => { describe("BackgroundManager.trackTask", () => {
let manager: BackgroundManager let manager: BackgroundManager
beforeEach(() => { beforeEach(() => {
@ -985,8 +985,8 @@ describe("BackgroundManager.registerExternalTask", () => {
} }
// #when // #when
await manager.registerExternalTask(input) await manager.trackTask(input)
await manager.registerExternalTask(input) await manager.trackTask(input)
// #then // #then
const concurrencyManager = getConcurrencyManager(manager) const concurrencyManager = getConcurrencyManager(manager)
@ -1010,7 +1010,7 @@ describe("BackgroundManager.resume concurrency key", () => {
test("should re-acquire using external task concurrency key", async () => { test("should re-acquire using external task concurrency key", async () => {
// #given // #given
const task = await manager.registerExternalTask({ const task = await manager.trackTask({
taskId: "task-1", taskId: "task-1",
sessionID: "session-1", sessionID: "session-1",
parentSessionID: "parent-session", parentSessionID: "parent-session",

View File

@ -248,10 +248,10 @@ export class BackgroundManager {
} }
/** /**
* Register an external task (e.g., from sisyphus_task) for notification tracking. * Track a task created elsewhere (e.g., from sisyphus_task) for notification tracking.
* This allows tasks created by external tools to receive the same toast/prompt notifications. * This allows tasks created by other tools to receive the same toast/prompt notifications.
*/ */
async registerExternalTask(input: { async trackTask(input: {
taskId: string taskId: string
sessionID: string sessionID: string
parentSessionID: string parentSessionID: string
@ -419,11 +419,11 @@ export class BackgroundManager {
existingTask.error = errorMessage existingTask.error = errorMessage
existingTask.completedAt = new Date() existingTask.completedAt = new Date()
// Release concurrency on error to prevent slot leaks // Release concurrency on error to prevent slot leaks
if (existingTask.concurrencyKey) { if (existingTask.concurrencyKey) {
this.concurrencyManager.release(existingTask.concurrencyKey) this.concurrencyManager.release(existingTask.concurrencyKey)
existingTask.concurrencyKey = undefined existingTask.concurrencyKey = undefined
} }
this.markForNotification(existingTask) this.markForNotification(existingTask)
this.notifyParentSession(existingTask).catch(err => { this.notifyParentSession(existingTask).catch(err => {
log("[background-agent] Failed to notify on resume error:", err) log("[background-agent] Failed to notify on resume error:", err)