chore: remove inspector autolaunch readiness timeout#8532
Open
anchenyi wants to merge 1 commit into
Open
Conversation
🔗 Linked Issue RequiredThanks for the contribution! Please link a GitHub issue to this PR by adding |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the fixed 30s readiness timeout used when auto-launching Agent Inspector from azd ai agent run, so the Inspector launch waits until the local agent port is actually accepting connections (or until the run context is cancelled).
Changes:
- Removed the hard-coded Inspector readiness timeout constant and the corresponding timeout-based context wrapping.
- Simplified Inspector autolaunch readiness waiting to use the existing run context cancellation only.
- Updated unit tests to match the new
startInspectorAfterAgentReadyWithOptionsfunction signature.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.agents/internal/cmd/run.go | Removes the fixed readiness timeout and updates Inspector autolaunch to wait on port readiness until context cancellation. |
| cli/azd/extensions/azure.ai.agents/internal/cmd/run_test.go | Updates the Inspector autolaunch tests to match the updated helper signature (no timeout argument). |
Comments suppressed due to low confidence (1)
cli/azd/extensions/azure.ai.agents/internal/cmd/run.go:337
waitForLocalPortno longer uses a timeout/deadline here, so it can only returnnilorctx.Err()(and when it returns an error,ctx.Err()will always be non-nil). That makes the nestedif ctx.Err() == nil { ... }warning block effectively unreachable in the current call path and adds dead/ misleading code. Consider simplifying to just return on error (or introduce a separate “warn-after” timer if you still want user feedback without aborting the autolaunch).
go func() {
if err := waitForLocalPort(ctx, agentPort, pollPeriod); err != nil {
if ctx.Err() == nil {
fmt.Fprintf(
stderr,
"Warning: Agent Inspector was not launched because localhost:%d was not ready: %v\n",
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the fixed 30s readiness timeout before launching Agent Inspector from
azd ai agent run.The Inspector autolaunch now waits until either:
Why
Some local agents, especially Python agents on cold start, can take more than 30s before binding to the configured port. Previously, Inspector autolaunch was skipped even if the agent became ready shortly afterward.
Testing
go test ./internal/cmd -run "Test(Inspector|WaitForLocalPort|NoInspector)"go test ./internal/cmd