Skip to content

fix: fix duplicated agent logs #17806

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 11 commits into from
May 15, 2025
Merged

Conversation

BrunoQuaresma
Copy link
Collaborator

Fix #16355

@BrunoQuaresma BrunoQuaresma requested a review from Parkreiner May 13, 2025 19:31
@BrunoQuaresma BrunoQuaresma self-assigned this May 13, 2025
@BrunoQuaresma BrunoQuaresma changed the title fix: duplicated agent logs fix: fix duplicated agent logs May 13, 2025
Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

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

Nothing jumped out to me with the logic, but obviously the stories a little wrong now. Happy to re-review once those get fixed up

) => {
const searchParams = new URLSearchParams({
follow: "true",
after: after.toString(),
after: params?.after ? params?.after.toString() : "",
Copy link
Member

Choose a reason for hiding this comment

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

Could we make this params?.after.toString() ?? ""?

jest.spyOn(apiModule, "watchWorkspaceAgentLogs").mockImplementation(
() =>
new OneWayWebSocket({
apiRoute: "",
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to pass in an empty string for the API route? I don't know if we've updated the class since I merged it in originally, but I remember that it was originally made so that you couldn't update the URL after instantiation

A socket like this would always be useless, right?

Comment on lines 9 to 10
): readonly WorkspaceAgentLog[] | undefined {
const [logs, setLogs] = useState<WorkspaceAgentLog[]>();
Copy link
Member

Choose a reason for hiding this comment

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

What do you think of making the hook so that it always returns an array, and if we don't have logs, we return an empty array?

I feel like that might help clean up some of the render logic long-term, but I also don't know if we need to differentiate between logs not existing because we haven't gotten anything back from the server yet, versus logs not existing because the server explicitly told us that it doesn't have anything

Copy link
Member

Choose a reason for hiding this comment

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

It'd also simplify line 29's state update logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For now, I don't think it would be a problem. I like the idea 👍

@BrunoQuaresma BrunoQuaresma requested a review from Parkreiner May 14, 2025 16:56
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

LGTM and tested in my dogfood env, but deferring to @Parkreiner for approval on the TS side.

Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

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

I'm okay with this, too

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

LGTM!

@BrunoQuaresma BrunoQuaresma merged commit 952c254 into main May 15, 2025
34 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/fix-duplicated-agent-logs branch May 15, 2025 18:21
@github-actions github-actions bot locked and limited conversation to collaborators May 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.

bug: ui: workspace build logs duplicated during build process
4 participants