Skip to content

chore: remove inspector autolaunch readiness timeout#8532

Open
anchenyi wants to merge 1 commit into
mainfrom
fix/inspector-wait-timeout
Open

chore: remove inspector autolaunch readiness timeout#8532
anchenyi wants to merge 1 commit into
mainfrom
fix/inspector-wait-timeout

Conversation

@anchenyi
Copy link
Copy Markdown
Contributor

@anchenyi anchenyi commented Jun 4, 2026

Summary

Removes the fixed 30s readiness timeout before launching Agent Inspector from azd ai agent run.

The Inspector autolaunch now waits until either:

  • the local agent port starts accepting connections, or
  • the agent run context is cancelled, such as when the process exits or the user presses Ctrl+C.

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

@anchenyi anchenyi marked this pull request as ready for review June 4, 2026 01:32
@anchenyi anchenyi requested a review from JeffreyCA as a code owner June 4, 2026 01:32
Copilot AI review requested due to automatic review settings June 4, 2026 01:32
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

🔗 Linked Issue Required

Thanks for the contribution! Please link a GitHub issue to this PR by adding Fixes #123 to the description or using the sidebar.
No issue yet? Feel free to create one!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 startInspectorAfterAgentReadyWithOptions function 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

  • waitForLocalPort no longer uses a timeout/deadline here, so it can only return nil or ctx.Err() (and when it returns an error, ctx.Err() will always be non-nil). That makes the nested if 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",

@github-actions github-actions Bot added the ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.{agents,connections,inspector,projects,routines,skills,toolboxes} extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants