[nu-demo] service_osis.nu does not populate contexts registry or pass HERO_CONTEXTS/HERO_SEED_DIR #129

Closed
opened 2026-04-23 23:14:36 +00:00 by mik-tf · 1 comment
Owner

Symptom

hero_osis --contexts root,default,geomind,incubaid,threefold spins up per-domain servers for each context, but:

  1. context.list RPC only returns [root]. The UI Contexts dropdown therefore only shows Root.
  2. During seed: Skipping seed for unregistered geomind/base (same for other non-root contexts) — most seed content is never applied.

Root cause

hero_osis's --contexts CLI flag ensures per-context directories and spins up per-domain OServer instances, but it NEVER writes the context list into .core/registry.toml. The context.list RPC and the seed step both read from that registry, so anything not in it is invisible.

Additionally, service_osis.nu's default action spec does not include HERO_CONTEXTS or HERO_SEED_DIR in the env, so even if the operator sets them at the shell, the action launched by hero_proc doesn't see them.

Demo workaround (applied 2026-04-23)

  1. After startup, called context.add RPC explicitly for each non-root context (default/geomind/incubaid/threefold) to populate the registry.
  2. Patched the hero_osis action env in service_osis.nu to include HERO_CONTEXTS and HERO_SEED_DIR.
  3. Restarted hero_osis and re-ran seed; domains then seeded correctly.

Proper fix

(a) hero_osis --contexts <list> should populate .core/registry.toml with all specified contexts on startup — not just create directories.
(b) service_osis.nu should accept --contexts and --seed-dir flags (or env) and pass both through to the action env so hero_proc launches the server with them.

Filed 2026-04-23 nu-shell demo bring-up. Signed-off-by: mik-tf

## Symptom `hero_osis --contexts root,default,geomind,incubaid,threefold` spins up per-domain servers for each context, but: 1. `context.list` RPC only returns `[root]`. The UI Contexts dropdown therefore only shows Root. 2. During seed: `Skipping seed for unregistered geomind/base` (same for other non-root contexts) — most seed content is never applied. ## Root cause `hero_osis`'s `--contexts` CLI flag ensures per-context directories and spins up per-domain OServer instances, but it NEVER writes the context list into `.core/registry.toml`. The `context.list` RPC and the seed step both read from that registry, so anything not in it is invisible. Additionally, `service_osis.nu`'s default action spec does not include `HERO_CONTEXTS` or `HERO_SEED_DIR` in the env, so even if the operator sets them at the shell, the action launched by hero_proc doesn't see them. ## Demo workaround (applied 2026-04-23) 1. After startup, called `context.add` RPC explicitly for each non-root context (default/geomind/incubaid/threefold) to populate the registry. 2. Patched the hero_osis action env in `service_osis.nu` to include `HERO_CONTEXTS` and `HERO_SEED_DIR`. 3. Restarted hero_osis and re-ran seed; domains then seeded correctly. ## Proper fix (a) `hero_osis --contexts <list>` should populate `.core/registry.toml` with all specified contexts on startup — not just create directories. (b) `service_osis.nu` should accept `--contexts` and `--seed-dir` flags (or env) and pass both through to the action env so hero_proc launches the server with them. Filed 2026-04-23 nu-shell demo bring-up. Signed-off-by: mik-tf
Author
Owner

Fixed by both parts (a) and (b):

Part (a) — hero_rpc commit f299402 on development.

OServer::register now ensures every registered context is persisted to ~/hero/var/osisdb/.core/registry.toml. Previously OServer::new called ensure_default() (root only); per-domain registers for non-root contexts silently created storage directories but never appeared in context.list RPC, so the seed step refused to seed them ("Skipping seed for unregistered geomind/base").

Idempotent — existing entries left untouched, only missing ones added. save_default() is fail-soft (warns, doesn't abort registration) so filesystem hiccups don't tank a domain spawn that would otherwise work fine.

// in OServer::register, before A::create:
let mut registry = self.registry.write().await;
if registry.get(context).is_none() {
    registry.add(ContextConfig::new(context));
    if let Err(e) = registry.save_default() {
        tracing::warn!(
            context = %context, error = %e,
            "failed to persist context registry — context.list/seed may be inconsistent"
        );
    }
}

Part (b) — hero_skills commit 3f8b700 on development.

service_osis.nu svx_server_action reads HERO_CONTEXTS and HERO_SEED_DIR from the operator's shell env and forwards each to the action's env block when set. Previously the action env hardcoded {RUST_LOG: "info"}, so any operator-set HERO_CONTEXTS was invisible to hero_osis once hero_proc launched it.

Combined runtime flow — the chain that wasn't working:

1. operator: export HERO_CONTEXTS=root,default,geomind,…
2. service_osis start         ← part (b) feeds env to hero_proc
3. hero_osis registers each   ← part (a) persists to registry.toml
4. context.list RPC returns full list
5. UI populates Contexts dropdown
6. seed step seeds every context ← no more "Skipping seed for unregistered"

Closes home#151 transitively — combined with hero_router commit fe1cbd6 (home#125, X-Hero-Context passthrough), the full context-switching flow now works end-to-end.

Verification:

  • Part (a): cargo fmt, cargo clippy --all-targets -- -D warnings, 13/13 hero_rpc_server tests pass.
  • Part (b): nu -c 'source service_osis.nu' parses cleanly, env passthrough smoke test confirmed both vars reach the action when set.

Meta-tracker: home#193.

Signed-off-by: mik-tf

Fixed by both parts (a) and (b): **Part (a)** — hero_rpc commit `f299402` on `development`. `OServer::register` now ensures every registered context is persisted to `~/hero/var/osisdb/.core/registry.toml`. Previously `OServer::new` called `ensure_default()` (root only); per-domain registers for non-root contexts silently created storage directories but never appeared in `context.list` RPC, so the seed step refused to seed them ("Skipping seed for unregistered geomind/base"). Idempotent — existing entries left untouched, only missing ones added. `save_default()` is fail-soft (warns, doesn't abort registration) so filesystem hiccups don't tank a domain spawn that would otherwise work fine. ```rust // in OServer::register, before A::create: let mut registry = self.registry.write().await; if registry.get(context).is_none() { registry.add(ContextConfig::new(context)); if let Err(e) = registry.save_default() { tracing::warn!( context = %context, error = %e, "failed to persist context registry — context.list/seed may be inconsistent" ); } } ``` **Part (b)** — hero_skills commit `3f8b700` on `development`. `service_osis.nu` `svx_server_action` reads HERO_CONTEXTS and HERO_SEED_DIR from the operator's shell env and forwards each to the action's env block when set. Previously the action env hardcoded `{RUST_LOG: "info"}`, so any operator-set HERO_CONTEXTS was invisible to hero_osis once hero_proc launched it. **Combined runtime flow** — the chain that wasn't working: ``` 1. operator: export HERO_CONTEXTS=root,default,geomind,… 2. service_osis start ← part (b) feeds env to hero_proc 3. hero_osis registers each ← part (a) persists to registry.toml 4. context.list RPC returns full list 5. UI populates Contexts dropdown 6. seed step seeds every context ← no more "Skipping seed for unregistered" ``` **Closes home#151 transitively** — combined with hero_router commit `fe1cbd6` (home#125, X-Hero-Context passthrough), the full context-switching flow now works end-to-end. **Verification:** - Part (a): `cargo fmt`, `cargo clippy --all-targets -- -D warnings`, 13/13 hero_rpc_server tests pass. - Part (b): `nu -c 'source service_osis.nu'` parses cleanly, env passthrough smoke test confirmed both vars reach the action when set. Meta-tracker: home#193. Signed-off-by: mik-tf
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/home#129
No description provided.