feat(background-agent): integrate team-mode into background manager
This commit is contained in:
@@ -407,6 +407,7 @@ export class BackgroundManager {
|
||||
spawnDepth: spawnReservation.spawnContext.childDepth,
|
||||
parentSessionId: input.parentSessionId,
|
||||
parentMessageId: input.parentMessageId,
|
||||
teamRunId: input.teamRunId,
|
||||
parentModel: input.parentModel,
|
||||
parentAgent: input.parentAgent,
|
||||
parentTools: input.parentTools,
|
||||
@@ -590,7 +591,7 @@ export class BackgroundManager {
|
||||
parentID: input.parentSessionId,
|
||||
})
|
||||
|
||||
if (this.onSubagentSessionCreated && this.tmuxEnabled && isInsideTmux()) {
|
||||
if (!input.suppressTmuxSpawn && this.onSubagentSessionCreated && this.tmuxEnabled && isInsideTmux()) {
|
||||
log("[background-agent] Invoking tmux callback NOW", { sessionID })
|
||||
await this.onSubagentSessionCreated({
|
||||
sessionID,
|
||||
@@ -602,7 +603,9 @@ export class BackgroundManager {
|
||||
log("[background-agent] tmux callback completed, waiting 200ms")
|
||||
await new Promise(r => setTimeout(r, 200))
|
||||
} else {
|
||||
log("[background-agent] SKIP tmux callback - conditions not met")
|
||||
log("[background-agent] SKIP tmux callback - conditions not met", {
|
||||
suppressTmuxSpawn: !!input.suppressTmuxSpawn,
|
||||
})
|
||||
}
|
||||
|
||||
if (this.tasks.get(task.id)?.status === "cancelled") {
|
||||
@@ -1507,6 +1510,19 @@ The fallback retry session is now created and can be inspected directly.
|
||||
canRetry,
|
||||
})
|
||||
|
||||
const sessionId = task.sessionId
|
||||
if (sessionId) {
|
||||
const sessionStillAlive = await this.verifySessionExists(sessionId)
|
||||
if (sessionStillAlive) {
|
||||
log("[background-agent] session.error received but session still alive, treating as transient:", {
|
||||
taskId: task.id,
|
||||
sessionId,
|
||||
errorMessage: errorMsg?.slice(0, 200),
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (task.currentAttemptID) {
|
||||
finalizeAttempt(task, task.currentAttemptID, "error", errorMsg)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user