chore(ops): Phase 24 — hero_proc lifecycle integration (selfstart + nu_service module + canonical UDS paths) #9
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?
Why
hero_assistance is engineering-complete on the v1 peer-to-peer mycelium architecture (per #1 closure). To deploy onto a Hero OS box managed by
hero_proc, the service needs lifecycle integration:--start/--stopCLI on_serverand_uiperhero_proc_service_selfstartskillscripts/service_hero_assistance.nulifecycle module pernu_serviceskill~/hero/var/sockets/hero_assistance_*/hero_procsecrets (THEME, ADMIN_SECRETS) perhero_proc_metaskillToday the server binds dual TCP+UDS per D-07 but the UDS path is socket-dir-relative, not canonical.
_uidoesn't bind UDS at all. Nonu_servicemodule. No hero_proc registration.What
A.
hero_procselfstart on_server+_uiPer
hero_proc_service_selfstartskill (CLI binary owns lifecycle for both actions):hero_assistanceCLI gains--start/--stopflagshero_assistance_server+hero_assistance_ui_serverbinds:~/hero/var/sockets/hero_assistance_server/rpc.sock(canonical)_uibinds:~/hero/var/sockets/hero_assistance_ui/ui.sock(canonical)B.
scripts/service_hero_assistance.nuPer
nu_serviceskill. Providesservice_hero_assistance {install,start,stop,status}. Mirrors existingservice_proxy.nu/service_claude.nupattern.C.
hero_procsecrets viahero_proc_metaRead at startup, NOT from env vars or config files:
THEME— defaults to"dark"(used by both _ui SPA and Phase 25 admin dashboard)ADMIN_SECRETS— IP whitelist for admin dashboard (Phase 25 dependency)MYCELIUM_BIND— overrides D-08 broad-bind if customer policy needs targeted bindingD.
buildenv.shupdatesBINARIES: list all 4 bins (hero_assistance,hero_assistance_server,hero_assistance_ui,hero_assistance_app)Acceptance
hero_assistance --startregisters both actions and brings up server + uihero_assistance --stopcleanly unregisters and stopsservice_hero_assistance installbuilds + installs binaries to~/hero/bin/service_hero_assistance start/stop/statusworks end-to-endhero_proc service listshows both actions running/eventsfilter unchanged)Files to touch
crates/hero_assistance/src/main.rs— CLI lifecyclecrates/hero_assistance_server/src/main.rs— UDS path canonicalization, secrets readcrates/hero_assistance_ui/src/main.rs— UDS bind, secrets readscripts/service_hero_assistance.nu— NEWbuildenv.sh— BINARIES expansionOut of scope
References
hero_proc_service_selfstartnu_servicehero_proc_metahero_socketsPhase 24 part A landed (s43) + body reconciliation
What landed in s43
Phase 24 part A — additive, no behaviour change to existing code paths:
crates/hero_assistance_ui/src/admin_secrets.rs— canonical module fromhero_ui_whitelistsskill, dropped in verbatim.SECRET_KEY="ADMIN_SECRETS"+SECRET_CONTEXT="core"; reads from hero_proc; fail-open on supervisor-down (HeroProcUnreachable.permits()→ true) and on missing/all-invalid secret (NotSet/Allow(empty_vec)→ true).scripts/service_assistance.nu— canonical nu_service module per thenu_serviceskill (short name stripshero_prefix per the skill rule —service_assistance.nu, NOTservice_hero_assistance.nu). Action specs transcribed verbatim fromcrates/hero_assistance/src/main.rs::build_service_definitionsoservice_assistance start≡hero_assistance --start.admin_secrets: parse_csv whitespace/empty/invalid, fail-open on supervisor unreachable, fail-open on secret-unset, blocks non-whitelisted IP, permits whitelisted IP.Test posture: 248 → 253 native passing (+5 phase24 unit tests on
_uilib). Documentedphase10_multi_project_merged_stream_tags_by_project_idflake reproduced under concurrent load, passes in isolation as always (transient since s12). No regression.Body reconciliation — four discoveries from codebase confirmation
The issue body needs amendment based on what's actually in the codebase as of s43:
Lifecycle CLI is already done (commit ≤ s38).
crates/hero_assistance/src/main.rsalready has--start/--stop,self_start/self_stop, fullServiceBuilder+ActionBuilderfor both daemons, kill_other socket lists, health_checks, retry policies, andrestart_service. No changes needed to the manager binary in this phase.Singular UDS dir is canonical — not per-binary. The body says:
But the
hero_socketsskill is explicit: multi-binary services share one directory named after the service, not the binary. Current code already uses~/hero/var/sockets/hero_assistance/{rpc,events,ui}.sock— singular, matching the skill. No path migration needed.nu_service file naming — per
nu_serviceskill, short name stripshero_prefix. File isscripts/service_assistance.nu, notscripts/service_hero_assistance.nu. The skill is unambiguous:hero_proxy→service_proxy.nu,hero_db→service_db.nu, etc.ADMIN_SECRETS framing — the body lists ADMIN_SECRETS under "C. hero_proc secrets via hero_proc_meta" as a "Phase 25 dependency". In reality it was deferred FROM Phase 25 part 2c (s42) TO Phase 24, per the s42 closure note. The IP whitelist is in scope here —
admin_secrets.rshas shipped (this session); the hard TCP gate that consumes it is part B (see below).Phase 24 part B — remaining work (next session, ~0.5 session)
_ui/src/main.rs— currently_uibinds UDS only, so the gate has nowhere to live until a TCP listener is added. Either (a) add an optional--tcp <addr>flag to_uiand wirestate.admin_list.read().await.permits(ip)into the accept loop per the skill pattern; or (b) defer to Phase 26 (customer SPA island) where direct browser-over-TCP becomes a real consumer.--auth-mode=hero(real hero_proc identity, not just dev-mode-bypass)._uior_server(admin SPAThemePreferenceenum exists but is never populated from a hero_proc secret). Adding speculative reads is axiom-growth per the project's design principles; defer to whichever phase adds the consumer (likely Phase 26 island work or a Phase 25 follow-up).Files to touch (24a, this session)
crates/hero_assistance_ui/src/admin_secrets.rsscripts/service_assistance.nucrates/hero_assistance_ui/src/lib.rs(re-export module)crates/hero_assistance_ui/Cargo.toml(addhero_rpc_openrpcwithtransportfeature)Acceptance status
hero_assistance --startregisters both actions and brings up server + ui (already in place pre-s43)hero_assistance --stopcleanly unregisters and stops (already in place pre-s43)service_assistance install/start/stop/statusavailable viascripts/service_assistance.nu(s43)hero_assistance/directory, matching skill — was already correct)_uilib)_uiTCP listener exists)--auth-mode=hero