Skip to content

Conversation

@sehoon38
Copy link
Collaborator

…ote agent loading

Summary

Details

Related Issues

How to Validate

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @sehoon38, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the agent registry by introducing support for remote agents. It refactors the agent registration mechanism to be asynchronous, allowing for dynamic loading and description updates of agents from external URLs. The changes also extend the TOML configuration to define remote agents and include robust error handling to ensure system stability even if remote agent fetching encounters issues.

Highlights

  • Remote Agent Support: Introduced the ability to register 'remote' agents, extending the AgentDefinition with a 'kind' property and an 'agentCardUrl' to specify external agent sources.
  • Asynchronous Agent Registration: The agent registration process, including registerAgent, loadBuiltInAgents, and refreshAgents, has been updated to be asynchronous, allowing for operations like fetching remote agent details.
  • Dynamic Remote Agent Descriptions: Remote agents' descriptions are now dynamically updated based on the skills retrieved from their agentCardUrl via the A2AClientManager. If no skills are found, the original description is retained.
  • TOML Schema Extension: The TOML agent definition schema has been expanded to include kind and agent_card_url fields, enabling the definition of remote agents directly within TOML configuration files. The prompts section is now optional for remote agents.
  • Robust Remote Agent Loading: The system now gracefully handles failures during the loading of remote agent details, logging errors but ensuring that agent registration does not block the CLI from starting.
  • Updated Test Suite: Comprehensive tests have been added and updated in registry.test.ts to cover the new asynchronous registration logic, remote agent loading, description updates, and error handling scenarios.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for remote agents, which are loaded via an agentCardUrl. A critical Server-Side Request Forgery (SSRF) vulnerability has been identified in the handling of these remote agent definitions, as user-controlled URLs are used without proper validation, potentially allowing access to internal network resources. It is highly recommended to implement a strict allow-list for URLs to mitigate this risk. Additionally, the review highlights the need to improve the robustness of the new TOML parsing logic, ensure consistent error handling, address an incorrect agent type inference, and align error reporting with the existing event-based feedback system.

Comment on lines +134 to +140
// Validate local agent requirements
if (!definition.agent_card_url && !definition.prompts?.system_prompt) {
throw new AgentLoadError(
filePath,
`Validation failed: Local agents must specify a 'prompts.system_prompt'.`,
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The current validation for agent definitions is not strict enough and can allow ambiguous definitions. For example, it doesn't prevent a TOML file from having both agent_card_url and prompts.system_prompt. With the kind field now being the discriminator, the validation should be updated to enforce consistency.

  // Validate agent definition based on its kind.
  if (definition.kind === 'remote') {
    if (!definition.agent_card_url) {
      throw new AgentLoadError(
        filePath,
        `Validation failed: Agents with kind='remote' must specify 'agent_card_url'.`
      );
    }
  } else { // 'local' or undefined
    if (!definition.prompts?.system_prompt) {
      throw new AgentLoadError(
        filePath,
        `Validation failed: Local agents must specify a 'prompts.system_prompt'.`
      );
    }
    if (definition.agent_card_url && definition.kind !== 'local') {
      throw new AgentLoadError(
        filePath,
        `Validation failed: 'agent_card_url' is present but 'kind' is not 'remote'. If this is a remote agent, please set kind = "remote".`
      );
    }
  }

toml: TomlAgentDefinition,
): AgentDefinition {
// If a model is specified, use it. Otherwise, inherit
if (toml.agent_card_url) {
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The logic to determine if an agent is remote should be based on the kind field, not just the presence of agent_card_url. This makes parsing deterministic and avoids misinterpreting a local agent that might have a URL for documentation as a remote agent. This change should be made in conjunction with stricter validation in parseAgentToml.

  if (toml.kind === 'remote') {

Comment on lines +176 to +192
if (definition.kind === 'remote') {
try {
const clientManager = A2AClientManager.getInstance();
const agentCard = await clientManager.loadAgent(
definition.name,
definition.agentCardUrl,
);
if (agentCard.skills && agentCard.skills.length > 0) {
definition.description = agentCard.skills
.map((skill) => `${skill.name}: ${skill.description}`)
.join('\n');
}
} catch (e) {
// Log the error, but don't block the CLI from starting.
console.error(`Error loading A2A agent "${definition.name}":`, e);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

security-high high

A Server-Side Request Forgery (SSRF) vulnerability exists in the handling of remote agent definitions. The agentCardUrl is loaded from a user-configurable TOML file and is used to make a network request without proper validation, potentially allowing an attacker to access internal network resources. It is recommended to implement a strict allow-list for URLs or ensure they resolve to public IP addresses. Additionally, the error handling for remote agent loading is inconsistent, using console.error instead of the centralized coreEvents.emitFeedback system, which should be used for all user-facing errors to ensure consistent reporting.

@sehoon38 sehoon38 closed this Dec 30, 2025
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.

1 participant