From b9e90f0b21468254efdf46b601ed0c0cb58c627d Mon Sep 17 00:00:00 2001 From: Didactyl User Date: Tue, 14 Apr 2026 17:47:57 -0400 Subject: [PATCH] v0.2.40 - Fix adoption list freshness by selecting newest kind 10123 event and temporarily disable periodic relay-backed trigger reconciliation for validation --- README.md | 4 ++-- src/main.h | 4 ++-- src/tools/tool_skill.c | 24 ++++++++++++++++++++---- src/trigger_manager.c | 8 +++++++- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5e564d6..a3a7d74 100644 --- a/README.md +++ b/README.md @@ -54,11 +54,11 @@ Skills compose by adoption-list order (`10123`) and trigger tags carry runtime e Didactyl will support local inference, which is very privacy preserving. Remote inference does however have it's advantages, and in those cases Didactyl supports using Bitcoin Lightning and eCash inference providers. -## Current Status — v0.2.39 +## Current Status — v0.2.40 **Active build — this project is barely working. Experiment at your own risk.** -> Last release update: v0.2.39 — Add 15-minute relay-backed trigger reconciliation in trigger_manager_poll to recover missed self-skill events and re-register missing triggers +> Last release update: v0.2.40 — Fix adoption list freshness by selecting newest kind 10123 event and temporarily disable periodic relay-backed trigger reconciliation for validation - Connects to configured relays with auto-reconnect and relay state transition logging - Publishes configured startup events per relay as each relay becomes connected diff --git a/src/main.h b/src/main.h index d2fa8fb..0ad6371 100644 --- a/src/main.h +++ b/src/main.h @@ -12,8 +12,8 @@ // Using DIDACTYL_ prefix to avoid conflicts with nostr_core_lib VERSION macros #define DIDACTYL_VERSION_MAJOR 0 #define DIDACTYL_VERSION_MINOR 2 -#define DIDACTYL_VERSION_PATCH 39 -#define DIDACTYL_VERSION "v0.2.39" +#define DIDACTYL_VERSION_PATCH 40 +#define DIDACTYL_VERSION "v0.2.40" // Agent metadata #define DIDACTYL_NAME "Didactyl" diff --git a/src/tools/tool_skill.c b/src/tools/tool_skill.c index 8efafad..1ca2f43 100644 --- a/src/tools/tool_skill.c +++ b/src/tools/tool_skill.c @@ -333,9 +333,25 @@ static int fetch_adoption_list_tags_local(tools_context_t* ctx, cJSON** out_tags free(events_json); if (events && cJSON_IsArray(events) && cJSON_GetArraySize(events) > 0) { - cJSON* ev0 = cJSON_GetArrayItem(events, 0); - if (ev0 && cJSON_IsObject(ev0)) { - cJSON* ev_content = cJSON_GetObjectItemCaseSensitive(ev0, "content"); + cJSON* best = NULL; + double best_created = -1.0; + int n = cJSON_GetArraySize(events); + for (int i = 0; i < n; i++) { + cJSON* ev = cJSON_GetArrayItem(events, i); + if (!ev || !cJSON_IsObject(ev)) { + continue; + } + + cJSON* created_at = cJSON_GetObjectItemCaseSensitive(ev, "created_at"); + double created = (created_at && cJSON_IsNumber(created_at)) ? created_at->valuedouble : 0.0; + if (!best || created > best_created) { + best = ev; + best_created = created; + } + } + + if (best && cJSON_IsObject(best)) { + cJSON* ev_content = cJSON_GetObjectItemCaseSensitive(best, "content"); if (ev_content && cJSON_IsString(ev_content) && ev_content->valuestring) { free(content); content = strdup(ev_content->valuestring); @@ -346,7 +362,7 @@ static int fetch_adoption_list_tags_local(tools_context_t* ctx, cJSON** out_tags } } - cJSON* ev_tags = cJSON_GetObjectItemCaseSensitive(ev0, "tags"); + cJSON* ev_tags = cJSON_GetObjectItemCaseSensitive(best, "tags"); if (ev_tags && cJSON_IsArray(ev_tags)) { cJSON* dup = cJSON_Duplicate(ev_tags, 1); if (!dup) { diff --git a/src/trigger_manager.c b/src/trigger_manager.c index c3fefe8..8a2bc93 100644 --- a/src/trigger_manager.c +++ b/src/trigger_manager.c @@ -1568,7 +1568,13 @@ int trigger_manager_poll(trigger_manager_t* mgr) { } pthread_mutex_unlock(&mgr->mutex); - if (mgr->last_reconcile_at <= 0 || (now - mgr->last_reconcile_at) >= 900) { + /* + * Temporarily disable periodic relay-backed trigger reconciliation. + * Keep code path in place for quick re-enable after adoption/cache fix validation. + */ + int enable_periodic_reconcile = 0; + if (enable_periodic_reconcile && + (mgr->last_reconcile_at <= 0 || (now - mgr->last_reconcile_at) >= 900)) { mgr->last_reconcile_at = now; (void)trigger_manager_reconcile_from_relays(mgr); }