[bug] hero_osis bin codegen regressed #41 — silent X-Hero-Context fallback to root is back #42
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_osis#42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Hero OS shell's Contexts island shows the same context (named "Root") repeated for every registered context, instead of the actual distinct names (root, default, geomind, incubaid, threefold, …). All per-context API calls silently return data from the root context.
Live on herodemo as of 2026-04-30:
All 5 distinct headers return the SAME root-context data. Every per-context query is silently falling back to root.
This is a regression of #41
Issue #41 ("fix(server): register MOCK_CONTEXTS by default to prevent silent X-Hero-Context fallback to root") was closed by commit
7807258oncrates/hero_osis_server/src/bin/hero_osis.rs. That commit expandedcli.contextsfrom the upstream default of"root"to the canonical demo list when no explicit--contexts/HERO_CONTEXTSwas passed.Since then,
crates/hero_osis_server/src/bin/hero_osis.rshas been converted to an auto-generated file (the per-domain single-binary refactor). Its current header literally says:The codegen template that produces this file does not include the MOCK_CONTEXTS expansion. So #41's fix has been silently undone by regeneration.
Confirmation in the running binary
So
cli.contextsfalls back to its upstreamServerClidefault of"root"and the dispatcher only registers a single context. Per the dispatcher's pre-#41 behaviour (also documented in #41's body), unknownX-Hero-Context: …values silently fall back to the lone registeredrootcontext.Why launcher-side workaround isn't enough
We can mitigate operationally by:
…but that only fixes this specific deploy. Tests, fresh installs, and other deployments still get the silent-fallback footgun. #41's original argument (running
hero_osis --startshould be sane out of the box) still applies. The right fix is in the codegen template so the canonical default ships with every regenerated bin.Acceptance criteria
build.rsor wherever the generator emitshero_osis.rs) expanded so that whencli.contexts == "root"(the upstreamServerClidefault), it auto-expands to the canonical context list — same logic as #41's7807258.--contexts <list>/HERO_CONTEXTSenv var overrides untouched.cargo build), verifycrates/hero_osis_server/src/bin/hero_osis.rscontains the expansion in its prelude.--contextspassed, the running server has more than one context registered.Cross-references
// DO NOT EDIT — auto-generatedfile MUST instead be applied at the generator layer, otherwise next regen drops it.Signed-off-by: mik-tf
After discussion, taking a different approach than the codegen template fix proposed in the issue body.
What we considered: lift the MOCK_CONTEXTS expansion into the codegen template (or via a new
OschemaBuildConfig::contexts_default(...)builder method, hero_rpc#36) so every regeneratedhero_osis.rsships with the canonical demo list as its--contextsdefault.Why we backed off: that approach hardcodes deployment-specific data (
geomind,incubaid,threefold, ...) into shared infrastructure source code. Every other hero_osis consumer would inherit the demo's identity. Adding a new context still requires a rebuild + redeploy. It's a more durable place for the workaround, but it's not architecture — it's contamination.What we're doing instead:
HERO_CONTEXTSenv var is the official deploy knob, required, documented inhero_demo/docs/ops/DEPLOYMENT.md§0.x and §4.4. Each deployment carries its own list in its env overlay;hero_osissource stays clean of any deploy-specific names.hero_skills/tools/modules/services/service_osis.nuforwardsHERO_CONTEXTSfrom the operator's env into the hero_proc action env.root(the structural bug).Closing this issue. The structural fix — contexts as data in OSIS storage, loaded at boot from a registry instead of from CLI default, with strict (no-silent-fallback) dispatcher resolution — is tracked in #43. That's where this should land properly.
hero_rpc#36 (the codegen API gap) is also being dropped — adding API surface that we just argued shouldn't be used is noise.
Signed-off-by: mik-tf
contexts_default(...)setter so single-bin codegen can override theServerCliroot-only default #36