Skip to content

fix(site): only attempt to watch containers when agent connected #18873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025

Conversation

DanielleMaywood
Copy link
Contributor

This PR ensures we do not attempt to call containers/watch on the agent before it is connected.

@DanielleMaywood DanielleMaywood requested a review from Copilot July 15, 2025 10:03
@DanielleMaywood DanielleMaywood marked this pull request as ready for review July 15, 2025 10:03
Copy link
Contributor

@Copilot 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 prevents the WebSocket connection from being established until the agent is in the "connected" state.

  • Guard the useEffect to early return when agent.status is not "connected"
  • Add agent.status to the effect’s dependency array
  • Add a unit test to verify no connection is made if the agent is disconnected

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
site/src/modules/resources/useAgentContainers.ts Early return in effect and updated dependencies
site/src/modules/resources/useAgentContainers.test.tsx New test to confirm no socket call on disconnected agent

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

👍

@DanielleMaywood DanielleMaywood merged commit 089f960 into main Jul 15, 2025
35 checks passed
@DanielleMaywood DanielleMaywood deleted the danielle/fix-race-condition branch July 15, 2025 10:16
@github-actions github-actions bot locked and limited conversation to collaborators Jul 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants