fix: use websocket for openenv data plane calls - #9952
Conversation
🔗 Linked Issue RequiredThanks for the contribution! Please link a GitHub issue to this PR by adding |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 21 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
Browser cancellation can destroy the shared session, keepalives are absent, initialization compatibility changes, and two lines fail lint limits.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds persistent WebSocket transport for stateful OpenEnv calls while retaining HTTP for safe endpoints.
Changes:
- Shares one WebSocket session between the shell and playground.
- Adds WebSocket protocol and lifecycle tests.
- Expands
initto select OpenEnv catalog environments.
File summaries
| File | Description |
|---|---|
README.md |
Documents catalog environment initialization. |
websocket_runtime.go |
Implements persistent WebSocket sessions. |
websocket_runtime_test.go |
Tests WebSocket behavior and concurrency. |
scaffold.go |
Generalizes OpenEnv environment checkout. |
scaffold_test.go |
Tests generalized scaffolding. |
runtime.go |
Adds injectable runtime caller support. |
root_test.go |
Updates initialization tests. |
invoke.go |
Integrates WebSockets with shell and playground. |
invoke_test.go |
Tests remote WebSocket invocation. |
init.go |
Changes positional initialization semantics. |
go.mod |
Adds Gorilla WebSocket dependency. |
go.sum |
Records dependency checksums. |
extension.yaml |
Updates initialization example. |
Review details
Suppressed comments (1)
cli/azd/extensions/azure.ai.rle/internal/project/scaffold.go:110
- This line is 144 columns wide and will fail the repository's 125-column
lllcheck (cli/azd/AGENTS.md:115-126). Move the detailed explanation above the command while retaining a concisenolintrationale.
process := exec.Command("git", args...) //nolint:gosec // Arguments are passed directly; the user value is validated as an environment name.
- Files reviewed: 12/13 changed files
- Comments generated: 4
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Preserve positional init naming with an explicit OpenEnv source flag. Add bounded WebSocket keepalives and drain browser responses without allowing client disconnects to corrupt the shared session. Authored-by: GitHub Copilot CLI v1.0.68 Model: GPT-5.4 (gpt-5.4) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use repository-recognized wording in the WebSocket drain comment. Authored-by: GitHub Copilot CLI v1.0.68 Model: GPT-5.4 (gpt-5.4) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Connection-level OpenEnv errors are treated as recoverable even though the server closes the socket.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 12/13 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The destination-preservation test currently exercises the wrong directory and cannot detect the intended regression.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
cli/azd/extensions/azure.ai.rle/internal/project/scaffold_test.go:98
- The sentinel is created under
missing_env, but the function is asked to replacetarget_env. This test therefore passes even if the destination replacement happens before source validation. PointsessionDirattarget_envso the assertion covers the directory thatforcecould delete.
- Files reviewed: 12/13 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Use the positional init argument as the OpenEnv catalog selector and suggest close matches without replacing existing destinations. Treat connection-level OpenEnv errors as terminal and align client timeouts and message limits with the service contract. Authored-by: GitHub Copilot CLI v1.0.68 Model: GPT-5.4 (gpt-5.4) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The message-size cap and breaking init semantics need resolution, alongside required Go modernization.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
cli/azd/extensions/azure.ai.rle/internal/cmd/init.go:77
- This changes the existing
azd ai rle init <name>contract:<name>previously renamed the echo sample, but it now selects a catalog entry, so scripts using custom names fail. Preserve positional naming and add a separate catalog selector, or provide an explicit compatibility path.
sessionDir, err := checkoutOpenEnvEnvironmentFunc(envName, ".", a.flags.force)
cli/azd/extensions/azure.ai.rle/internal/project/websocket_runtime_test.go:245
- The repository's Go 1.26 convention requires
errors.AsType, andgo fixis CI-enforced (cli/azd/AGENTS.md:369-395). Use the typed result directly.
var localError *azdext.LocalError
if err == nil || terminal || !errors.As(err, &localError) ||
!strings.Contains(localError.Suggestion, "payload and retry") {
- Files reviewed: 12/13 changed files
- Comments generated: 3
- Review effort level: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The no-timeout mode remains capped for playground calls, and initialization introduces a breaking argument semantic.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
cli/azd/extensions/azure.ai.rle/internal/cmd/init.go:77
- This reinterprets the existing positional argument from a local session/RLE name into an OpenEnv catalog key. For example, the previously documented
azd ai rle init code_rlcopiedecho_envintocode_rl; it now looks forenvs/code_rland fails, breaking existing scripts and workflows. Preserve the existing name argument and add an explicit source selector (or provide a deliberate compatibility/migration path).
sessionDir, err := checkoutOpenEnvEnvironmentFunc(envName, ".", a.flags.force)
- Files reviewed: 12/13 changed files
- Comments generated: 1
- Review effort level: Balanced
| if !cancelAfterSend && !hasDeadline { | ||
| deadline = time.Now().Add(c.drainTimeout) | ||
| hasDeadline = true | ||
| } |
azure.ai.rle 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/9952/azure-ai-rle.zip"
|
There was a problem hiding this comment.
🟡 Changes recommended
The sample supply chain is mutable and personally hosted, and initialization no longer supports non-interactive use.
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.rle/internal/project/websocket_runtime_test.go:53
- The HTTP handler appends to
requestswhile the test goroutine later reads that slice without a lock or a handler-completion signal;safePathsandupgradeshave the same issue. Network request completion does not establish a Go memory-model happens-before edge, and the server is not closed until after the assertions, so this test is racy undergo test -race. Protect all three values with a mutex/atomics or send captured results through a channel before asserting.
- Files reviewed: 14/15 changed files
- Comments generated: 2
- Review effort level: Balanced
| rleSamplesRepoURL = "https://github.com/sujit-kamireddy/rle-samples.git" | ||
| rleSamplesRepoRef = "main" |
| response, err := azdClient.Prompt().Select(azdext.WithAccessToken(ctx), &azdext.SelectRequest{ | ||
| Options: &azdext.SelectOptions{ | ||
| Message: "Select an RLE sample", | ||
| Choices: choices, | ||
| DisplayNumbers: new(true), | ||
| EnableFiltering: new(true), | ||
| }, | ||
| }) |
No description provided.