fix: stabilize pico channel and hdn connection

This commit is contained in:
stevef 2026-04-13 21:02:45 +02:00
parent 98aaed0498
commit 050083d7ef
3 changed files with 10 additions and 2 deletions

View file

@ -196,6 +196,7 @@
},
"pico": {
"enabled": true,
"token": "picoclaw-secret-123",
"allow_token_query": true,
"ping_interval": 30,
"read_timeout": 60,

View file

@ -203,6 +203,7 @@ data:
},
"pico": {
"enabled": true,
"token": "picoclaw-secret-123",
"allow_token_query": true,
"ping_interval": 30,
"read_timeout": 60,

View file

@ -784,10 +784,16 @@ func overridePicoToken(cfg *config.Config, token string) {
return
}
picoToken := cfg.Channels.Pico.Token.String()
if picoToken == "" || strings.HasPrefix(picoToken, pico.PicoTokenPrefix) {
// Only return early if the token already has the official 'pico-' prefix and is NOT just the base 'picoclaw' name
if picoToken != "" && strings.HasPrefix(picoToken, pico.PicoTokenPrefix) && !strings.HasPrefix(picoToken, "picoclaw") {
return
}
cfg.Channels.Pico.SetToken(pico.PicoTokenPrefix + token + picoToken)
newToken := pico.PicoTokenPrefix + token
if picoToken != "" && picoToken != "[NOT_HERE]" {
newToken += "-" + picoToken
}
cfg.Channels.Pico.SetToken(newToken)
logger.DebugCF("gateway", "Pico channel token set", map[string]any{"enabled": true, "token_preview": newToken[:8] + "..."})
}
func createHeartbeatHandler(agentLoop *agent.AgentLoop) func(prompt, channel, chatID string) *tools.ToolResult {