Skip to content

fix(agents): make invocations_ws protocol priority order-independent in loadServiceProtocol#9192

Draft
v1212 with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-review-comment-9009-again
Draft

fix(agents): make invocations_ws protocol priority order-independent in loadServiceProtocol#9192
v1212 with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-review-comment-9009-again

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

loadServiceProtocol returned ProtocolInvocationsWS immediately on first match, so a manifest listing invocations_ws before invocations would shadow the higher-priority invocable protocol. The selection should be deterministic regardless of declaration order.

Fix

Changed state.go to track sawInvocationsWS with a flag (same pattern as sawInvocations) instead of returning early. Priority is now enforced post-loop: responses > invocations > invocations_ws.

// Before — order-dependent
case ProtocolInvocationsWS:
    return ProtocolInvocationsWS  // returns early, misses invocations below it

// After — order-independent
case ProtocolInvocationsWS:
    sawInvocationsWS = true
// ...
if sawInvocations {
    return ProtocolInvocations
}
if sawInvocationsWS {
    return ProtocolInvocationsWS
}

Also included (PR #9009 base changes)

  • resolver.go: Added ProtocolInvocationsWS = "invocations_ws" constant; suppress invoke hints in appendInvokeLocalSecondary for WS agents (not invocable via azd ai agent invoke)
  • init_from_code.go: Added invocations_ws to knownProtocols with version 2.0.0
  • init.go: Plumbed --protocol invocations_ws through synthesizeImageManifestFile; default protocol now uses knownProtocols[0] instead of a hardcoded literal
  • schemas/azure.ai.agent.json: Added invocations_ws to protocol field descriptions
  • hosted-agent-regions.json: Added westus2
  • Tests covering single invocations_ws, responses wins over WS regardless of order, invocations wins over WS regardless of order

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
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.

Copilot AI and others added 2 commits July 17, 2026 09:20
…erviceProtocol

Fixes review comment r3601867100 on PR #9009.

The original code returned ProtocolInvocationsWS immediately when encountered in
the protocols list, making the selection order-dependent. If invocations_ws appeared
before invocations in the list, the function would return early without checking for
the higher-priority invocations protocol.

The fix uses the same flag-based approach as invocations: track sawInvocationsWS
and only return ProtocolInvocationsWS if neither responses nor invocations was found.
Priority order is now: responses > invocations > invocations_ws (order-independent).

Also includes the full PR 9009 changes:
- Add invocations_ws to knownProtocols in init_from_code.go
- Support --protocol invocations_ws in synthesizeImageManifestFile
- Add invocations_ws to schema description
- Add westus2 to hosted-agent-regions.json
- Add VOICELIVE to cspell dictionary
- Add tests for all new behavior

Co-authored-by: v1212 <49907914+v1212@users.noreply.github.com>
- Use knownProtocols[0] for default protocol in protocolRecordsForImageManifest
  to avoid hardcoding 'responses' 2.0.0 in two places
- Add flagProtocols parameter documentation to synthesizeImageManifestFile

Co-authored-by: v1212 <49907914+v1212@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix the code for review comment on PR 9009 fix(agents): make invocations_ws protocol priority order-independent in loadServiceProtocol Jul 17, 2026
Copilot finished work on behalf of v1212 July 17, 2026 09:23
Copilot AI requested a review from v1212 July 17, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants