Persist explicit session IDs for reuse in subsequent commands.#7635
Persist explicit session IDs for reuse in subsequent commands.#7635trangevi merged 2 commits intoAzure:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses #7602 by ensuring that when a user explicitly provides a session (and conversation) ID, it is persisted to the local .foundry-agent.json context so subsequent commands (notably azd ai agent monitor) can reuse it without requiring the flag again.
Changes:
- Persist explicit IDs in
resolveStoredID()by saving them into the local agent context store. - Add unit tests intended to validate that explicit session/conversation IDs are persisted and reusable (including overwrite behavior).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/cmd/helpers.go |
Persists explicit IDs via saveContextValue() when resolveStoredID() receives an explicit value. |
cli/azd/extensions/azure.ai.agents/internal/cmd/monitor_test.go |
Adds tests around persisting/reloading explicit session/conversation IDs and overwrite behavior. |
jongio
left a comment
There was a problem hiding this comment.
Fix correctly addresses the root cause - when an explicit session ID is passed, it now gets persisted so subsequent commands (like monitor) can find it. The saveContextValue call is consistent with how the same function already persists generated IDs (line 170-171).
Two notes:
-
The new tests verify that the config persistence round-trip works (save + load), but they don't call
resolveStoredIDdirectly. If thesaveContextValuecall gets removed in a future refactor, these tests would still pass. Not blocking since mockingazdClientisn't trivial, but worth considering if there's a test helper for it. -
resolveConversationID(line 307 in helpers.go) has the same early-return-without-persist pattern for explicit conversation IDs. Not blocking since monitor only reads session IDs, but if you want explicit--conversationIDs to also be remembered across commands, that'd be the same one-line fix.
…xplicit session IDs
Fixes #7602
Before:
Does not save the session when explicitly passed, so monitor fails saying to invoke first.
After: