feat(ai): add unified invocation lifecycle commands - #9900
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). 20 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Legacy-state repair guidance is incorrect, core HTTP lifecycle paths lack tests, and several added lines violate the enforced length limit.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Replaces workflow-oriented resumable Responses with direct create, show, follow, and cancel primitives.
Changes:
- Adds background invocation with optional no-wait behavior.
- Adds Responses lifecycle commands and in-memory reconnect cursors.
- Simplifies persisted state to the latest Response ID.
File summaries
| File | Description |
|---|---|
internal/exterrors/codes.go |
Updates Response error and operation codes. |
internal/cmd/root.go |
Registers the Responses command group. |
internal/cmd/responses.go |
Implements show, follow, and cancel. |
internal/cmd/responses_test.go |
Tests command structure and formatting. |
internal/cmd/listen.go |
Updates cleanup terminology. |
internal/cmd/invoke.go |
Adds background and no-wait invocation. |
internal/cmd/invoke_responses_stream.go |
Classifies interrupted streams for reconnect. |
internal/cmd/invoke_response_store.go |
Simplifies state and supports legacy reads. |
internal/cmd/invoke_response_store_test.go |
Tests simplified persistence. |
internal/cmd/invoke_background.go |
Implements tracking and follow retries. |
internal/cmd/invoke_background_test.go |
Tests background primitives. |
internal/cmd/delete.go |
Updates cleanup terminology. |
internal/cmd/agent_endpoint.go |
Builds lifecycle endpoint URLs. |
docs/specs/long-running-agent-invoke.md |
Rewrites the protocol specification. |
Review details
Suppressed comments (1)
cli/azd/extensions/azure.ai.agents/internal/cmd/responses.go:385
- This line is 131 columns with tabs expanded to width 4, so the enabled
lllcheck will reject it. Split the error construction to comply with the 125-column limit documented incli/azd/AGENTS.md:115-126.
return responseSnapshotResult{}, fmt.Errorf("Response snapshot ID %q does not match requested ID %q", actualID, responseID)
- Files reviewed: 14/14 changed files
- Comments generated: 4
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
Live E2E validationBuilt and installed this stack with Passed:
Observed service constraint:
|
|
CI triage: the sole failed check on the previous head was live build 6797057. Its code-deploy scenario timed out after 30 activation polls with last status |
88843c3 to
7ff11bc
Compare
|
Azure Pipelines: Successfully started running 2 pipeline(s). 20 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
7ff11bc to
32583ba
Compare
There was a problem hiding this comment.
🟡 Changes recommended
JSON output can lose numeric precision, and the scenario impact mapping does not select the new lifecycle scenarios.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
cli/azd/extensions/azure.ai.agents/internal/cmd/invoke_response.go:339
- Decoding the service payload into
anyconverts JSON numbers tofloat64, so re-marshaling can corrupt valid values (for example,9007199254740993becomes9007199254740992). Indent the validated raw JSON directly so--output jsonpreserves the service response exactly.
- Files reviewed: 21/21 changed files
- Comments generated: 1
- Review effort level: Balanced
a4ce85e to
5a516ff
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The implementation matches the linked design and includes focused coverage for validation, persistence, streaming, and HTTP lifecycle behavior.
Review details
- Files reviewed: 21/21 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Final live invocation/regression checkTested exact head 5a516ff, with an independently built No newly introduced merge blocker observed in the tested invocation scope. Live PASS:
Additional focused HTTP/parser/raw/state/cleanup coverage passed under Baseline investigation: stdin via All test-created Responses were terminal; six test-created sessions were stopped. No shared agent or pre-existing session was stopped/deleted, and no infrastructure was provisioned or deployed. Temporary auth/config copies were removed. Scope: real CLI checks against existing agents, not an execution of the interactive MCP scenario runner or the init→provision→deploy→down suite. No live A2A or model-memory claim. Raw local evidence is retained privately because it contains test resource identifiers. Existing CI/approval gates still apply. |
|
/check-enforcer override |
azure.ai.agents PR buildNote This is an unsigned development build. Install it only if you trust this PR. Install the extension: azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/9900/azure-ai-agents.zip"
|
Summary
Implements the revised #9676 design: one
invocationslifecycle command group across protocols, with--long-runningcontrolling disconnect-independent execution and--no-waitcontrolling when the CLI returns.invoke --background/--resumablewithinvoke --long-runninginvocations show|follow|cancelcommands, initially backed by the Responses protocol--idselector and the same protocol inference rules asinvoke; explicit--protocolselects a protocol, while--agent-endpointidentifies it from the URLresponsesgroup; Responses lifecycle/identity/guidance, SSE, and store helpers are consolidated ininvoke_response.go, while existing invoke implementations remain ininvoke.goto minimize relocation-only diffinvocations.gofocused on shared command registration, resolution, validation, and dispatchstarting_after, retries/reconnect loops, periodic persistence, active-work guards, dedicated steering, or legacy-state compatibilityshowJSON/table output consistent withsessions showThe service request still uses
background=truefor--long-running; the flag does not promise crash recovery or automatic reconnect. Follow makes one streaming GET and replays from the beginning. The tested service requires the original Response to have been created withbackground=truefor follow; foreground snapshots can still be shown.CLI
Protocols are inferred when unambiguous. There are no compatibility aliases for the old command/flag forms.
Stack
Future protocols can implement suitable operations under the shared group; this does not add lifecycle support for A2A, Activity, WebSocket, or voice.
Validation
From
cli/azd/extensions/azure.ai.agents:go test ./...go build ./...go fix ./...Earlier live tests against the supplied Responses reference agent validated create, detach, replay, steering via ordinary create, show, and cancellation; those transcripts use the previous command spelling. New command help/routing is covered by the updated tests.
Fixes #9778
Part of #9676
Supersedes #9704 and the dedicated steering design in #9705.
Interactive scenario coverage
Added offline Tier 0 scenarios under
tests/cli-interactive-tester-scenarios/tier0/:0.17-invocations-help.yaml: group/subcommand discovery, selectors, and output formats0.18-invoke-long-running-validation.yaml: long-running/no-wait help and invalid combinations0.19-invocations-validation.yaml: unsupported operations, empty selectors, and removed flagsThe root-help scenario now includes
invocations; the extension-local tag taxonomy includescmd:invocations. Shared PR impact mappings are deferred to #9996.These scenarios were statically checked for YAML shape, tags, and placeholders and spell-checked. They were not executed through the interactive tester (MCP unavailable here). To run them, select
foundry-extension-scenario-orchestratorand request only the relevant Tier 0 scenarios.No new live/cloud scenarios, provisioning fixtures, profile requirements, or CI jobs were added. Existing Go HTTP tests cover lifecycle behavior; these scenarios deliberately cover the offline command surface only.
Approval boundary
This PR no longer changes
.github/skills/foundry-extension-scenario-pr-regression/references/impact-mapping.md. All mapping additions and its line-ending cleanup are isolated in follow-up #9996, so separate.github/owner approval does not block this feature PR.