soul: engram_save int return str_eq'd as string — segfault on first heartbeat in local mode (mem_save + handle_api_consolidate) #80

Closed
opened 2026-07-17 17:27:08 +00:00 by tim.lingo · 1 comment
Member

engram_save returns an int (0 fail / 1 ok) in el_runtime, but memory.el's mem_save and the consolidate handler compare the result with str_eq(..., "") — on success that strcmp's address 1 and segfaults. Repro: build dist/soul.c @ 64c1789 darwin-arm64, boot LOCAL mode (SOUL_ENGRAM_PATH set), crash <1s after '[awareness] entering' (first heartbeat's mem_save). Container/HTTP mode never hits it (snapshot_path empty skips mem_save) which is why the soak missed it. Crash bt: strcmp <- str_eq <- mem_save <- awareness_run. We hand-patched both sites in dist/soul.c for the desktop test wave (precedent c8cb425): if (!save_result) instead of str_eq. Proper fix belongs in memory.el (+ the consolidate .el site). — Neuron (Tim's machine), 2026-07-17

engram_save returns an int (0 fail / 1 ok) in el_runtime, but memory.el's mem_save and the consolidate handler compare the result with str_eq(..., "") — on success that strcmp's address 1 and segfaults. Repro: build dist/soul.c @ 64c1789 darwin-arm64, boot LOCAL mode (SOUL_ENGRAM_PATH set), crash <1s after '[awareness] entering' (first heartbeat's mem_save). Container/HTTP mode never hits it (snapshot_path empty skips mem_save) which is why the soak missed it. Crash bt: strcmp <- str_eq <- mem_save <- awareness_run. We hand-patched both sites in dist/soul.c for the desktop test wave (precedent c8cb425): if (!save_result) instead of str_eq. Proper fix belongs in memory.el (+ the consolidate .el site). — Neuron (Tim's machine), 2026-07-17
Owner

Resolved. The engram_save Int return being str_eq'd as a String (deref of EL_CSTR(1)=0x1 -> SIGSEGV in mem_save, and the same at the consolidate handler) was fixed in the merged #95 — its description matches this report exactly: "engram_save returns Int(0/1) but mem_save str_eq'd it as a String ... Fixed mem_save + handle_api_consolidate to check the Int." Genesis boot survives (/health 200) and the soul-contract gate passes. Closing.

Resolved. The `engram_save` Int return being `str_eq`'d as a String (deref of `EL_CSTR(1)`=0x1 -> SIGSEGV in `mem_save`, and the same at the consolidate handler) was fixed in the merged **#95** — its description matches this report exactly: "engram_save returns Int(0/1) but mem_save str_eq'd it as a String ... Fixed mem_save + handle_api_consolidate to check the Int." Genesis boot survives (/health 200) and the soul-contract gate passes. Closing.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: neuron-technologies/neuron#80