mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix(coderd/x/chatd/chattool): clarify complete goal ID schema
This commit is contained in:
@@ -32,7 +32,7 @@ type GoalToolOptions struct {
|
||||
type getGoalArgs struct{}
|
||||
|
||||
type completeGoalArgs struct {
|
||||
GoalID string `json:"goal_id" description:"The expected current goal ID. The tool fails if the current goal changed."`
|
||||
GoalID string `json:"goal_id" description:"The expected current goal ID as a UUIDv4 string. The tool fails if the current goal changed."`
|
||||
Summary string `json:"summary" description:"A concise non-empty summary of how the goal was completed."`
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ func CompleteGoal(db database.Store, options GoalToolOptions) fantasy.AgentTool
|
||||
}
|
||||
goalID, err := uuid.Parse(goalIDStr)
|
||||
if err != nil {
|
||||
return fantasy.NewTextErrorResponse("invalid goal_id"), nil
|
||||
return fantasy.NewTextErrorResponse("goal_id is required"), nil
|
||||
}
|
||||
summary := strings.TrimSpace(args.Summary)
|
||||
if summary == "" {
|
||||
|
||||
@@ -89,6 +89,7 @@ func TestCompleteGoalSchemaUsesStringGoalID(t *testing.T) {
|
||||
goalIDParam, ok := info.Parameters["goal_id"].(map[string]any)
|
||||
require.True(t, ok)
|
||||
require.Equal(t, "string", goalIDParam["type"])
|
||||
require.Contains(t, goalIDParam["description"], "UUIDv4 string")
|
||||
}
|
||||
|
||||
func TestGetGoalReturnsNullWithoutCurrentGoal(t *testing.T) {
|
||||
@@ -152,7 +153,7 @@ func TestCompleteGoalValidatesInput(t *testing.T) {
|
||||
{
|
||||
name: "invalid goal id",
|
||||
input: `{"goal_id":"not-a-uuid","summary":"done"}`,
|
||||
message: "invalid goal_id",
|
||||
message: "goal_id is required",
|
||||
},
|
||||
{
|
||||
name: "empty summary",
|
||||
|
||||
Reference in New Issue
Block a user