Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(agent/agentcontainers): prevent reassigning proc.agent until successful #18609

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

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Jun 26, 2025

This change applies a bit more defensive coding to the SubAgentClient. I don't have any concrete evidence of this going wrong other than some random observations of "duplicate agent", which are likely unrelated but prompted me to explore.

@mafredri mafredri force-pushed the mafredri/fix-agent-agentcontainers-subagent-assignment branch 3 times, most recently from a147216 to 20d2cf1 Compare June 26, 2025 17:19
@mafredri mafredri force-pushed the mafredri/fix-agent-agentcontainers-subagent-assignment branch from 20d2cf1 to 77a3d19 Compare June 26, 2025 17:25
if err != nil {
return agent, err
return SubAgent{}, err
Copy link
Member Author

Choose a reason for hiding this comment

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

Review: In either this or above, we could have returned a semi-valid agent and assigned to proc.agent was is not ideal.

defer func() {
if err != nil {
// Best effort.
_, _ = a.api.DeleteSubAgent(ctx, &agentproto.DeleteSubAgentRequest{
Copy link
Member Author

Choose a reason for hiding this comment

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

The steps below should never fail, but if they do, we try to clean up.

@mafredri mafredri changed the title fix(agent/agentcontainers): do not reassign proc.agent until success fix(agent/agentcontainers): prevent reassigning proc.agent until successful Jun 26, 2025
@mafredri mafredri marked this pull request as ready for review June 26, 2025 17:30
@mafredri mafredri merged commit 4f44dd0 into main Jun 26, 2025
42 checks passed
@mafredri mafredri deleted the mafredri/fix-agent-agentcontainers-subagent-assignment branch June 26, 2025 18:30
@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 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.

3 participants