Skip to content

Release v0.1.10 — Persistent Cortex storage and seamless auto-update#25

Merged
ApiliumDevTeam merged 9 commits intomainfrom
dev
Mar 9, 2026
Merged

Release v0.1.10 — Persistent Cortex storage and seamless auto-update#25
ApiliumDevTeam merged 9 commits intomainfrom
dev

Conversation

@ApiliumDevTeam
Copy link
Collaborator

Summary

  • Cortex sidecar now passes --db for persistent Sled storage (~/.mayros/cortex-data/)
  • Graceful flush-before-update flow: /api/flush + SIGTERM before binary replacement
  • Lifecycle callback registry bridging plugin and infra layers
  • Sidecar hardening: lock files, port conflict detection, stderr ring buffer, stale lock reclaim, auto-restart fix
  • Secrets migration to dataDir, auto-install when binary missing
  • Slash commands show clean display text instead of internal AI instructions
  • Bump REQUIRED_CORTEX_VERSION to 0.4.1

Test plan

  • pnpm build && pnpm test — all tests pass
  • Full gateway lifecycle: start → use → update binary → verify data persists
  • Kill sidecar → auto-restart recovers within seconds
  • /kg, /tools, /trace show user-friendly text

Release v0.1.9 — Ineru rename & Cortex 0.4.0
Pass --db flag to Cortex sidecar for Sled-backed persistent storage
(~/.mayros/cortex-data/graph.sled). Add flush-before-update to prevent
data loss during binary replacement, and dataDir config option.

- Add dataDir to CortexConfig type and parser
- Pass --db <dataDir>/graph.sled in sidecar spawn args
- Create data directory on first start (mkdir -p)
- Add flushCortexBeforeUpdate() — POST /api/v1/flush before replace
- Integrate flush into installOrUpdateCortex()
- Add cortex.dataDir uiHint in memory-semantic config
- Bump REQUIRED_CORTEX_VERSION to 0.4.1
- Bump package version 0.1.9 → 0.1.10
- Sync 49 extension versions via plugins:sync
Add flushBeforeStop() to CortexSidecar to POST /api/v1/flush before
SIGTERM, increase SIGKILL timeout to 10s, and add restartForUpdate()
method. Add onBeforeReplace/onAfterReplace callbacks to
installOrUpdateCortex so callers can wire sidecar stop/start around
binary replacement.
Add displayText parameter to sendMessage so TUI shows a clean command
label (e.g. /kg, /trace stats) instead of exposing raw AI instructions
to the user. Affected commands: /tools, /kg, /trace, /team, /tasks,
/workflow, /rules, /mailbox, /sync.
Addresses all identified gaps in Cortex sidecar management:

- Capture stderr in ring buffer for crash diagnostics (getLastLogs)
- Add stopping flag to prevent auto-restart during deliberate stop
- Lock file in dataDir to prevent concurrent sidecar instances
- Port availability check before spawn (detect port conflicts)
- Auto-install binary on first start when not explicitly configured
- Skip health monitor restart while sidecar is still starting
- Drain pending write queue before stopping sidecar
- Secrets follow dataDir with migration from ~/.mayros/
- Wire lifecycle callbacks from plugin to update-runner via registry
- Pass actual host/port from config to flush-before-update
- Add 10s timeout to writeQueue.drain() during update and shutdown to
  prevent blocking if Cortex is unresponsive
- Distinguish permission errors from lock conflicts in acquireLock
- Log stale lock reclamation for diagnostics
- Fix bug where external Cortex detection returned false instead of
  true (status was overwritten from "running" to "failed")
When the sidecar child process crashes and auto-restart triggers,
acquireLock() found the existing lock with our own Node.js PID.
Since the parent process is alive, the probe succeeded and the lock
was refused — silently breaking all auto-restarts.

Now checks if the lock belongs to the current process before probing,
allowing self-reclaim for restart scenarios while still blocking
concurrent instances from different processes.
## Summary
- Pass `--db` flag to Cortex sidecar for persistent storage
(`~/.mayros/cortex-data/`)
- Graceful flush-before-update: sends `/api/flush` + SIGTERM before
binary replacement
- Lifecycle callback registry bridging plugin layer with update-runner
- Sidecar hardening: lock files, port conflict detection, stderr
capture, stale lock reclaim
- Secrets migration to `dataDir`, auto-install when binary missing
- Hide internal AI instructions from slash command display
(`displayText` pattern)
- Bump `REQUIRED_CORTEX_VERSION` to 0.4.1

## Test plan
- [ ] `pnpm build && pnpm test` — all tests pass
- [ ] `mayros gateway` → verify `--db` in sidecar spawn args
- [ ] Simulate binary update → data survives restart
- [ ] Kill sidecar process → auto-restart reclaims lock and recovers
- [ ] `/kg` and other slash commands show clean text to user
@ApiliumDevTeam ApiliumDevTeam merged commit 600e970 into main Mar 9, 2026
4 of 5 checks passed
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.

1 participant