这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@allisoneer
Copy link
Contributor

@allisoneer allisoneer commented May 14, 2025

Important

Adds PUT support for updating agents, including MCP server management, with validation and tests.

  • Behavior:
    • Adds PUT /v1/agents/:name endpoint in server.go to update existing agents.
    • Supports updating LLM, SystemPrompt, and MCPServers.
    • Validates required fields and checks for unknown fields in UpdateAgentRequest.
    • Handles creation, update, and deletion of MCP servers and associated secrets.
    • Returns appropriate HTTP status codes for errors (e.g., 404 for non-existent agent or LLM, 400 for invalid input).
  • Models:
    • Introduces UpdateAgentRequest struct for updating agents.
  • Tests:
    • Adds tests in server_test.go for updating agents, including scenarios for updating MCP servers, handling non-existent agents or LLMs, and validating input.

This description was created by Ellipsis for 9756f6b. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 9756f6b in 3 minutes and 5 seconds. Click for details.
  • Reviewed 591 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. acp/internal/server/server_test.go:853
  • Draft comment:
    The PUT /v1/agents endpoint tests are comprehensive and cover various scenarios, which is excellent.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. acp/internal/server/server.go:676
  • Draft comment:
    Typographical: In the error message "llm and systemPrompt are required", consider capitalizing "LLM" for consistency with its usage elsewhere in the code (e.g., using "LLM" instead of "llm").
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While the suggestion would make the error messages more consistent, this is an extremely minor cosmetic change that doesn't affect functionality. The error message is still clear and understandable. The rules state not to make comments that are obvious or unimportant, and this feels like a very low-priority stylistic suggestion. The inconsistency in capitalization could be seen as a legitimate style issue that affects code quality and professionalism. Multiple occurrences of "LLM" in the codebase do use capital letters. While consistency is good, this is such a minor issue that it doesn't warrant a PR comment. The error message is still perfectly clear to users, and this kind of minor stylistic feedback could be better handled in team style guides or linters. Delete the comment. While technically correct, it's too minor of a stylistic issue to warrant a PR comment.

Workflow ID: wflow_13vwixa91a3A5s2F

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.


// Parse request
var req UpdateAgentRequest
if err := json.Unmarshal(rawData, &req); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid double JSON decoding; use a single strict JSON decoder with DisallowUnknownFields to simplify and avoid potential inconsistencies.

return
}
}
mcpServer := createMCPServer(mcpName, namespace, config, secretName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid variable shadowing; use assignment rather than ':=' when creating the new MCP server.

Suggested change
mcpServer := createMCPServer(mcpName, namespace, config, secretName)
mcpServer = createMCPServer(mcpName, namespace, config, secretName)

}

// updateAgent handles updating an existing agent and its associated MCP servers
func (s *APIServer) updateAgent(c *gin.Context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider refactoring the long updateAgent handler into smaller helper functions to improve readability and maintainability.

@dexhorthy dexhorthy merged commit e1f81fc into humanlayer:main May 14, 2025
3 of 5 checks passed
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.

2 participants