Skip to content

Commit 9350f22

Browse files
committed
fix: restore deploy session carryover
1 parent 47bb741 commit 9350f22

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • cli/azd/extensions/azure.ai.agents/internal/cmd

cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"sync"
1616

1717
"azureaiagent/internal/exterrors"
18+
"azureaiagent/internal/pkg/agents/agent_api"
1819
"azureaiagent/internal/pkg/agents/optimize_api"
1920
"azureaiagent/internal/project"
2021

@@ -231,6 +232,13 @@ func predeployHandler(ctx context.Context, azdClient *azdext.AzdClient, args *az
231232
return fmt.Errorf("failed to update environment for service %q: %w", svc.Name, err)
232233
}
233234

235+
// Capture the current session so it can be resumed on the newly deployed
236+
// version after deploy (see session_carryover.go). Best-effort; hosted
237+
// agents only.
238+
if isHostedAgentService(svc, args.Project) {
239+
captureSessionForCarryover(ctx, azdClient, svc)
240+
}
241+
234242
// Run developer RBAC pre-flight checks only for hosted agent deployments.
235243
// Guarded by sync.Once since this handler fires per-service but the check
236244
// is project-scoped.
@@ -420,6 +428,12 @@ func postdeployHandler(ctx context.Context, azdClient *azdext.AzdClient, args *a
420428
)
421429
}()
422430

431+
// Resume the pre-deploy session on the newly deployed version so the next
432+
// invoke continues on the new code with the session's persisted volume
433+
// intact (see session_carryover.go). Best-effort; never blocks deploy.
434+
agentClient := agent_api.NewAgentClient(endpoint, cred)
435+
carryOverSessionAfterDeploy(ctx, azdClient, agentClient, svc, envName)
436+
423437
return nil
424438
}
425439

0 commit comments

Comments
 (0)