Skip to content

Conversation

@tlongwell-block
Copy link
Collaborator

No description provided.

@tlongwell-block tlongwell-block marked this pull request as draft October 24, 2025 17:27
@tlongwell-block tlongwell-block marked this pull request as ready for review October 27, 2025 15:57
Copy link
Collaborator

@zanesq zanesq left a comment

Choose a reason for hiding this comment

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

Verified working locally. Copilot had a few things that might be worth looking into:

Observation: list_tools always appends the dynamic task and subagent execute tools and reply_parts later filters them out for subagents. That means callers of list_tools who do not run through reply_parts could see those tools even for subagents.

Recommendation: filter out subagent-spawning tools inside list_tools when self.is_subagent is true (so the agent never sees them at the source). That centralizes behavior and avoids surprising callers.

Observation: is_subagent is a plain bool (pub(super) is_subagent) and mark_as_subagent(&mut self) mutates it. Current code sets the flag before Arc::new(agent), which is safe. But making it public(super) allows other code in the module to modify it after the Agent is shared.

Recommendation: make the flag private (or readonly after initialization) or only set at construction time (e.g., Agent::new_subagent()) to enforce immutability after creation.

Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

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

I don't know about this approach. it feels heavy handed given what we are trying to do here. the real solution would be to make creating sub agents a real extension and then just not enable that extension for subagents

}

pub fn mark_as_subagent(&mut self) {
self.is_subagent = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this doesn't seem like a property that should be mutable


let agent = agent_manager
.get_or_create_agent(session.id.clone())
.get_or_create_agent(session.id.clone(), true) // true = is_subagent
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't do this

@alexhancock
Copy link
Collaborator

@tlongwell-block Are you able to give thoughts or take a rev on this per @DOsinga's comment?

I don't know about this approach. it feels heavy handed given what we are trying to do here. the real solution would be to make creating sub agents a real extension and then just not enable that extension for subagents

@tlongwell-block
Copy link
Collaborator Author

tlongwell-block commented Nov 6, 2025

@tlongwell-block Are you able to give thoughts or take a rev on this per @DOsinga's comment?

I don't know about this approach. it feels heavy handed given what we are trying to do here. the real solution would be to make creating sub agents a real extension and then just not enable that extension for subagents

I totally agree. This is hamfisted and not the right way.

I mocked up moving subagents/subrecipes tools to a platform extension and it it just a big change. Want to get #5082 in before proposing something that significant.

This PR was just an option as an emergency fix if we needed one for a new release.

Since we seem to have figured out the endless subagent spawning root cause (no developer tools enabled, which caused goose to spawn endless subagents to try to do anything) we could just address that with a system prompt change or a tool description change.

@tlongwell-block
Copy link
Collaborator Author

Closing this for now. Don't think this is a good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants