Merge pull request 'Fix #150: fresh-install genesis boot SIGSEGV in mem_save' (#95) from fix/genesis-boot-crash into hotfix/elc-source-typos

This commit was merged in pull request #95.
This commit is contained in:
2026-07-21 16:53:52 +00:00
5 changed files with 18 additions and 12 deletions
Generated Vendored
+2 -2
View File
@@ -120,8 +120,8 @@ el_val_t mem_consolidate(void) {
}
el_val_t mem_save(el_val_t path) {
el_val_t save_result = engram_save(path);
if (str_eq(save_result, EL_STR(""))) {
el_val_t saved = engram_save(path);
if (saved == 0) {
println(el_str_concat(el_str_concat(EL_STR("[memory] mem_save: engram_save failed for "), path), EL_STR(" \xe2\x80\x94 snapshot may be incomplete")));
}
return 0;
Generated Vendored
+2 -2
View File
@@ -744,8 +744,8 @@ el_val_t handle_api_consolidate(el_val_t body) {
el_val_t summary = json_get(body, EL_STR("summary"));
el_val_t snap = state_get(EL_STR("soul_snapshot_path"));
if (!str_eq(snap, EL_STR(""))) {
el_val_t save_result = engram_save(snap);
if (str_eq(save_result, EL_STR(""))) {
el_val_t saved = engram_save(snap);
if (saved == 0) {
println(el_str_concat(el_str_concat(EL_STR("[api] consolidate: engram_save failed for "), snap), EL_STR(" \xe2\x80\x94 snapshot may be out of sync")));
}
}
Generated Vendored
+4 -4
View File
@@ -25383,8 +25383,8 @@ el_val_t mem_consolidate(void) {
}
el_val_t mem_save(el_val_t path) {
el_val_t save_result = engram_save(path);
if (str_eq(save_result, EL_STR(""))) {
el_val_t saved = engram_save(path);
if (saved == 0) {
println(el_str_concat(el_str_concat(EL_STR("[memory] mem_save: engram_save failed for "), path), EL_STR(" \xe2\x80\x94 snapshot may be incomplete")));
}
return 0;
@@ -29336,8 +29336,8 @@ el_val_t handle_api_consolidate(el_val_t body) {
el_val_t summary = json_get(body, EL_STR("summary"));
el_val_t snap = state_get(EL_STR("soul_snapshot_path"));
if (!str_eq(snap, EL_STR(""))) {
el_val_t save_result = engram_save(snap);
if (str_eq(save_result, EL_STR(""))) {
el_val_t saved = engram_save(snap);
if (saved == 0) {
println(el_str_concat(el_str_concat(EL_STR("[api] consolidate: engram_save failed for "), snap), EL_STR(" \xe2\x80\x94 snapshot may be out of sync")));
}
}
+6 -2
View File
@@ -133,8 +133,12 @@ fn mem_consolidate() -> String {
}
fn mem_save(path: String) -> Void {
let save_result: String = engram_save(path)
if str_eq(save_result, "") {
// engram_save returns an Int (1 = ok, 0 = failure), NOT a String. Calling
// str_eq on it casts EL_CSTR(1) -> (char*)0x1 and SIGSEGVs on a SUCCESSFUL
// save which is exactly what a fresh-install genesis boot does first
// (seeds the brain, saves, crashes). This is issue #150. Check the Int.
let saved: Int = engram_save(path)
if saved == 0 {
println("[memory] mem_save: engram_save failed for " + path + " — snapshot may be incomplete")
}
}
+4 -2
View File
@@ -725,8 +725,10 @@ fn handle_api_consolidate(body: String) -> String {
let summary: String = json_get(body, "summary")
let snap: String = state_get("soul_snapshot_path")
if !str_eq(snap, "") {
let save_result: String = engram_save(snap)
if str_eq(save_result, "") {
// engram_save returns an Int (1 = ok, 0 = failure); str_eq on it derefs
// EL_CSTR(1)=0x1 and SIGSEGVs on success (issue #150). Check the Int.
let saved: Int = engram_save(snap)
if saved == 0 {
println("[api] consolidate: engram_save failed for " + snap + " — snapshot may be out of sync")
}
}