mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-17 10:14:23 +00:00
This fixes a data integrity issue affecting fresh installations of Desktop Lite and any environment where agent.other_config and serveral columns are not pre-initialized. This will stop Desktop Lite edtion from saving any agent setting. (#897)
The root cause is missing default initialization of JSON field in update flow, leading to NOT NULL violations in both SQLite and Postgres. Fix ensures consistent behavior across Lite and Standard deployments. Co-authored-by: Viet Tran <viettranx@gmail.com> Co-authored-by: Chunning Ha <cn@ha.td>
This commit is contained in:
3 files changed
+23
-9
No files matched your search
@@ -196,14 +196,18 @@ func (s *PGAgentStore) Update(ctx context.Context, id uuid.UUID, updates map[str
|
||||
updates[col] = ""
|
||||
}
|
||||
}
|
||||
// Promoted INT columns: null → 0.
|
||||
for _, col := range []string{"skill_nudge_interval", "max_tokens"} {
|
||||
// Promoted INT/BOOL columns: null → 0/false.
|
||||
for _, col := range []string{"skill_nudge_interval", "max_tokens", "self_evolve", "skill_evolve", "is_default"} {
|
||||
if v, ok := updates[col]; ok && v == nil {
|
||||
updates[col] = 0
|
||||
if col == "self_evolve" || col == "skill_evolve" || col == "is_default" {
|
||||
updates[col] = false
|
||||
} else {
|
||||
updates[col] = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
// NOT NULL JSONB columns: null → empty object.
|
||||
for _, col := range []string{"chatgpt_oauth_routing", "reasoning_config", "workspace_sharing", "shell_deny_groups", "kg_dedup_config"} {
|
||||
for _, col := range []string{"other_config", "tools_config", "chatgpt_oauth_routing", "reasoning_config", "workspace_sharing", "shell_deny_groups", "kg_dedup_config"} {
|
||||
if v, ok := updates[col]; ok && v == nil {
|
||||
updates[col] = []byte("{}")
|
||||
}
|
||||
|
||||
@@ -140,10 +140,20 @@ func (s *SQLiteAgentStore) Update(ctx context.Context, id uuid.UUID, updates map
|
||||
updates[col] = ""
|
||||
}
|
||||
}
|
||||
// Promoted INT columns: null → 0.
|
||||
for _, col := range []string{"skill_nudge_interval", "max_tokens"} {
|
||||
// Promoted INT/BOOL columns: null → 0/false.
|
||||
for _, col := range []string{"skill_nudge_interval", "max_tokens", "self_evolve", "skill_evolve", "is_default"} {
|
||||
if v, ok := updates[col]; ok && v == nil {
|
||||
updates[col] = 0
|
||||
if col == "self_evolve" || col == "skill_evolve" || col == "is_default" {
|
||||
updates[col] = false
|
||||
} else {
|
||||
updates[col] = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
// NOT NULL JSON columns: null → empty object.
|
||||
for _, col := range []string{"other_config", "tools_config", "reasoning_config", "workspace_sharing", "chatgpt_oauth_routing", "shell_deny_groups", "kg_dedup_config"} {
|
||||
if v, ok := updates[col]; ok && v == nil {
|
||||
updates[col] = []byte("{}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,11 +114,11 @@ export function useAgentDetailState(
|
||||
max_tool_iterations: maxToolIterations,
|
||||
is_default: isDefault,
|
||||
status,
|
||||
other_config: Object.keys(otherConfig).length > 0 ? otherConfig : null,
|
||||
other_config: Object.keys(otherConfig).length > 0 ? otherConfig : {},
|
||||
context_pruning: pruningEnabled ? pruningConfig : null,
|
||||
compaction_config: compactionConfig,
|
||||
subagents_config: subEnabled ? subConfig : null,
|
||||
tools_config: toolsEnabled ? toolsConfig : null,
|
||||
tools_config: toolsEnabled ? toolsConfig : {},
|
||||
sandbox_config: sandboxEnabled ? sandboxConfig : null,
|
||||
})
|
||||
onClose()
|
||||
|
||||
Reference in new issue
Block a user