fix(chat): prefer devcontainer sub-agents over host agent in AI chat#23682
Open
BillionClaw wants to merge 1 commit intocoder:mainfrom
Open
fix(chat): prefer devcontainer sub-agents over host agent in AI chat#23682BillionClaw wants to merge 1 commit intocoder:mainfrom
BillionClaw wants to merge 1 commit intocoder:mainfrom
Conversation
In workspaces with devcontainers, the AI chat always connected to the host agent (agents[0]) instead of the devcontainer sub-agent, causing all AI chat commands to run on the host instead of inside the devcontainer. This change adds a selectPreferredAgent() helper that prefers agents with a parent_id (sub-agents) over the parent/host agent. Applied to: - loadWorkspaceAgentLocked (chatd.go): persisted agent binding + fallback - getWorkspaceConn (chatd.go): lazy dial validation fallback - watchChatGit (exp_chats.go): git operation agent - watchChatDesktop (exp_chats.go): desktop/VNC agent No schema changes required.
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In workspaces with devcontainers, the AI chat always connected to
agents[0]fromGetWorkspaceAgentsInLatestBuildByWorkspaceID, which is always the host agent. This caused all AI chat commands to run on the host instead of inside the devcontainer.This PR adds a
selectPreferredAgent()helper that prefers agents with aparent_id(sub-agents) over the parent/host agent. Applied to 5 locations across two files.Changes
selectPreferredAgent()helper that iterates agents and returns the first one with a validParentID(sub-agent), falling back toagents[0]loadWorkspaceAgentLocked: UseselectPreferredAgent()when creating the initial agent binding and persisting itgetWorkspaceConn: UseselectPreferredAgent()in the lazy dial validation fallbackselectPreferredAgent()helper (separate package)watchChatGit: UseselectPreferredAgent()for both the agent status check and the dialwatchChatDesktop: UseselectPreferredAgent()for both the agent status check and the dialNo Schema Changes Required
The
parent_idfield already exists onworkspace_agentsand is populated for devcontainer sub-agents.Fixes
Fixes #23547
Testing
No new tests were added. The change is intentionally minimal and localized. The existing tests for
GetWorkspaceAgentsInLatestBuildByWorkspaceIDalready cover the agent ordering.