v0.2.6 - Fix DM freeze by removing adopted-skills mutex reentrancy in trigger context assembly
This commit is contained in:
@@ -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.5
|
||||
## Current Status — v0.2.6
|
||||
|
||||
**Active build — this project is barely working. Experiment at your own risk.**
|
||||
|
||||
> Last release update: v0.2.5 — Fix increment_and_push upstream auto-setup and finalize SIGINT shutdown fix
|
||||
> Last release update: v0.2.6 — Fix DM freeze by removing adopted-skills mutex reentrancy in trigger context assembly
|
||||
|
||||
- Connects to configured relays with auto-reconnect and relay state transition logging
|
||||
- Publishes configured startup events per relay as each relay becomes connected
|
||||
|
||||
+19
-5
@@ -1596,8 +1596,12 @@ static char* build_context_from_triggers(trigger_type_t trigger_type,
|
||||
}
|
||||
}
|
||||
|
||||
char* matched_skill_contents[AGENT_ADOPTED_SKILLS_MAX];
|
||||
int matched_skill_count = 0;
|
||||
memset(matched_skill_contents, 0, sizeof(matched_skill_contents));
|
||||
|
||||
pthread_mutex_lock(&g_adopted_skills_mutex);
|
||||
for (int i = 0; i < g_adopted_skills_count; i++) {
|
||||
for (int i = 0; i < g_adopted_skills_count && matched_skill_count < AGENT_ADOPTED_SKILLS_MAX; i++) {
|
||||
const agent_adopted_skill_t* s = &g_adopted_skills[i];
|
||||
if (!s->has_trigger || s->trigger_type != trigger_type) {
|
||||
continue;
|
||||
@@ -1606,8 +1610,16 @@ static char* build_context_from_triggers(trigger_type_t trigger_type,
|
||||
continue;
|
||||
}
|
||||
|
||||
char* expanded = resolve_skill_references_local(s->content ? s->content : "");
|
||||
const char* skill_text = expanded ? expanded : (s->content ? s->content : "");
|
||||
matched_skill_contents[matched_skill_count] = strdup(s->content ? s->content : "");
|
||||
if (matched_skill_contents[matched_skill_count]) {
|
||||
matched_skill_count++;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_adopted_skills_mutex);
|
||||
|
||||
for (int i = 0; i < matched_skill_count; i++) {
|
||||
char* expanded = resolve_skill_references_local(matched_skill_contents[i] ? matched_skill_contents[i] : "");
|
||||
const char* skill_text = expanded ? expanded : (matched_skill_contents[i] ? matched_skill_contents[i] : "");
|
||||
|
||||
size_t need = strlen("\n\n---\n\n") + strlen(skill_text) + 1U;
|
||||
if (used + need >= cap) {
|
||||
@@ -1616,7 +1628,9 @@ static char* build_context_from_triggers(trigger_type_t trigger_type,
|
||||
char* grown = (char*)realloc(out, next);
|
||||
if (!grown) {
|
||||
free(expanded);
|
||||
pthread_mutex_unlock(&g_adopted_skills_mutex);
|
||||
for (int j = i; j < matched_skill_count; j++) {
|
||||
free(matched_skill_contents[j]);
|
||||
}
|
||||
free(out);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1635,8 +1649,8 @@ static char* build_context_from_triggers(trigger_type_t trigger_type,
|
||||
matched++;
|
||||
|
||||
free(expanded);
|
||||
free(matched_skill_contents[i]);
|
||||
}
|
||||
pthread_mutex_unlock(&g_adopted_skills_mutex);
|
||||
|
||||
if (matched == 0) {
|
||||
const char* fallback = "You are an AI agent. Respond to the message.";
|
||||
|
||||
+2
-2
@@ -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 5
|
||||
#define DIDACTYL_VERSION "v0.2.5"
|
||||
#define DIDACTYL_VERSION_PATCH 6
|
||||
#define DIDACTYL_VERSION "v0.2.6"
|
||||
|
||||
// Agent metadata
|
||||
#define DIDACTYL_NAME "Didactyl"
|
||||
|
||||
Reference in New Issue
Block a user