Skip to content

fix(runtime): load persisted runtime state safely#52

Merged
DonPrus merged 3 commits into
nullclaw:mainfrom
vernonstinebaker:fix/runtime-state-load
May 7, 2026
Merged

fix(runtime): load persisted runtime state safely#52
DonPrus merged 3 commits into
nullclaw:mainfrom
vernonstinebaker:fix/runtime-state-load

Conversation

@vernonstinebaker
Copy link
Copy Markdown
Contributor

Summary

  • parse persisted runtime metadata through a read-only JSON shape before copying owned strings into PersistedRuntime
  • avoid returning slices that still alias the JSON parser arena after parsed.deinit()
  • add a regression test that loads runtime metadata written in the same JSON form used by the supervisor

Why

Fresh NullHub builds could crash on boot while reconciling persisted managed runtime state. The loader parsed JSON directly into the owned runtime struct and then deinitialized the parser, leaving fields like binary_path and launch_command pointing at freed memory. Boot reconciliation then compared those invalid slices and could segfault before the server started.

Validation

  • zig build test -Dbuild-ui=false -Dembed-ui=false
  • local smoke: rebuilt NullHub booted cleanly and served /api/status instead of crashing during reconcile-on-boot

@DonPrus DonPrus merged commit 15c5604 into nullclaw:main May 7, 2026
4 checks passed
@vernonstinebaker vernonstinebaker deleted the fix/runtime-state-load branch May 7, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants