From 8ee1fb5747e777f6e0672367148b2c8226f5a9d2 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Tue, 24 Feb 2026 01:59:59 +0000 Subject: Add json tags to Task, ClaudeConfig, and RetryConfig structs Without json tags, Go serialized fields with capitalized names (State, CreatedAt, Name) but the UI expected snake_case (task.state, task.created_at). This caused createTaskCard to throw TypeError when tasks existed, which poll() caught and displayed as "Could not reach server". Co-Authored-By: Claude Sonnet 4.6 --- internal/task/task.go | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'internal/task/task.go') diff --git a/internal/task/task.go b/internal/task/task.go index 3796cf3..5c28f63 100644 --- a/internal/task/task.go +++ b/internal/task/task.go @@ -24,36 +24,36 @@ const ( ) type ClaudeConfig struct { - Model string `yaml:"model"` - ContextFiles []string `yaml:"context_files"` - Instructions string `yaml:"instructions"` - WorkingDir string `yaml:"working_dir"` - MaxBudgetUSD float64 `yaml:"max_budget_usd"` - PermissionMode string `yaml:"permission_mode"` - AllowedTools []string `yaml:"allowed_tools"` - DisallowedTools []string `yaml:"disallowed_tools"` - SystemPromptAppend string `yaml:"system_prompt_append"` - AdditionalArgs []string `yaml:"additional_args"` + Model string `yaml:"model" json:"model"` + ContextFiles []string `yaml:"context_files" json:"context_files"` + Instructions string `yaml:"instructions" json:"instructions"` + WorkingDir string `yaml:"working_dir" json:"working_dir"` + MaxBudgetUSD float64 `yaml:"max_budget_usd" json:"max_budget_usd"` + PermissionMode string `yaml:"permission_mode" json:"permission_mode"` + AllowedTools []string `yaml:"allowed_tools" json:"allowed_tools"` + DisallowedTools []string `yaml:"disallowed_tools" json:"disallowed_tools"` + SystemPromptAppend string `yaml:"system_prompt_append" json:"system_prompt_append"` + AdditionalArgs []string `yaml:"additional_args" json:"additional_args"` } type RetryConfig struct { - MaxAttempts int `yaml:"max_attempts"` - Backoff string `yaml:"backoff"` // "linear", "exponential" + MaxAttempts int `yaml:"max_attempts" json:"max_attempts"` + Backoff string `yaml:"backoff" json:"backoff"` // "linear", "exponential" } type Task struct { - ID string `yaml:"id"` - Name string `yaml:"name"` - Description string `yaml:"description"` - Claude ClaudeConfig `yaml:"claude"` - Timeout Duration `yaml:"timeout"` - Retry RetryConfig `yaml:"retry"` - Priority Priority `yaml:"priority"` - Tags []string `yaml:"tags"` - DependsOn []string `yaml:"depends_on"` - State State `yaml:"-"` - CreatedAt time.Time `yaml:"-"` - UpdatedAt time.Time `yaml:"-"` + ID string `yaml:"id" json:"id"` + Name string `yaml:"name" json:"name"` + Description string `yaml:"description" json:"description"` + Claude ClaudeConfig `yaml:"claude" json:"claude"` + Timeout Duration `yaml:"timeout" json:"timeout"` + Retry RetryConfig `yaml:"retry" json:"retry"` + Priority Priority `yaml:"priority" json:"priority"` + Tags []string `yaml:"tags" json:"tags"` + DependsOn []string `yaml:"depends_on" json:"depends_on"` + State State `yaml:"-" json:"state"` + CreatedAt time.Time `yaml:"-" json:"created_at"` + UpdatedAt time.Time `yaml:"-" json:"updated_at"` } // Duration wraps time.Duration for YAML unmarshaling from strings like "30m". -- cgit v1.2.3