Skip to content

fix(cli): make fresh installs portable and persistent - #8

Merged
codeasier merged 1 commit into
v0.9.29-patchfrom
fix/cli-portable-installs
Sep 28, 2026
Merged

codeasier merged 1 commit into
v0.9.29-patchfrom
fix/cli-portable-installs

Conversation

@codeasier

Copy link
Copy Markdown
Owner

Port of upstream main e04ba88 (rohitg00#892) onto v0.9.29-patch, aligned with upstream implementation text.

What upstream did

The bundled iii-config.yaml uses cwd-relative paths and the engine was spawned without a cwd, so on global/npx installs ./data/state_store.db and ./data/stream_store landed in the invocation directory, and the iii-exec supervision block never resolved — nothing respawned the worker, surfacing as "all data gone" reports against a live REST port.

  • startIiiBin → prepareEngineLaunch: when the resolved config is the bundled one, regenerates ~/.agentmemory/data/iii-config.runtime.yaml each boot with absolute data paths and an absolute worker exec line, anchors engine cwd at ~/.agentmemory, and copies legacy ./data stores from the invocation dir on first run. Repo checkouts keep cwd config; user overrides pass through verbatim.
  • New modules: src/cli/engine-config.ts (renderEngineConfig), src/cli/engine-launch.ts (launch prep + exec-command rewriting + legacy migrations), src/cli/startup-stderr.ts, src/runtime-paths.ts (AGENTMEMORY_RUNTIME_DIR).
  • Viewer port configurable (III_VIEWER_PORT, default REST + 2) through config.viewerPort.
  • Docker installs: uid/gid/chown controls (AGENTMEMORY_DOCKER_UID/GID/SKIP_CHOWN).
  • agentmemory remove covers the generated runtime config; doctor + startup-failure reporting expanded.
  • 10 new/expanded test files (+54 tests).

Adaptations for this line

Area Adaptation
test/engine-config.test.ts Upstream adds this file for renderEngineConfig; this line already had an observability-off drift guard of the same name. Both suites kept side by side.
src/index.ts imports Conflict resolved keeping this line's logger + parsePositiveIntervalMs alongside upstream's runtimeMetadataPath.
REFERENCE.md Regenerated via skills:gen (55 → 60 vars): upstream's five new variables added, this line's retained.
Engine pin III_PINNED_VERSION indirection (0.11.2) carried through untouched — all launch paths route through it.
README Endpoint count stays 132 (this line's REST surface).
iii-config.docker.yaml This line's observability-off setting kept (upstream's clean apply already preserved it).

Verification

  • npm test: 1844 passed, 1 skipped (baseline 1790 + 54 upstream tests)
  • npm run build: clean
  • npm run skills:gen + skills:check: pass
  • npx tsc --noEmit: error set identical to the post-perf(index): store vectors in buckets and rebuild BM25 from content #7 baseline (31 normalized lines, zero new)
  • Worker pidfile path computes to the same ~/.agentmemory/worker.pid; local systemd deployment (direct node dist/index.mjs) is unaffected by the CLI launcher changes

Port of upstream main e04ba88 (rohitg00#892) onto v0.9.29-patch, aligned with
upstream: startIiiBin regenerates a runtime iii-config (absolute data
paths under ~/.agentmemory/data, absolute worker exec line, engine cwd
anchored at ~/.agentmemory), migrates legacy ./data stores on first run,
and passes user overrides through verbatim. Viewer port becomes
configurable (III_VIEWER_PORT); worker pidfiles honor
AGENTMEMORY_RUNTIME_DIR; docker installs gain uid/gid/chown controls;
agentmemory remove covers the runtime config; doctor and startup-failure
reporting expanded.

Adaptations for this line:
- test/engine-config.test.ts: upstream adds the file for
  renderEngineConfig while this line already had an observability-off
  drift guard of the same name; both suites are kept side by side.
- src/index.ts import conflict: kept this line's logger +
  parsePositiveIntervalMs imports alongside upstream's runtimeMetadataPath.
- plugin/skills/agentmemory-config/REFERENCE.md regenerated via
  skills:gen (55 -> 60 vars; upstream's five new variables added,
  this line's variables retained).
- III_PINNED_VERSION indirection (0.11.2) carried through untouched.
- README endpoint count stays 132 (this line's REST surface).

tsc error set identical to the post-#7 baseline; 1844 tests pass
(+54 from upstream suites).
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