lk-backend is declared kind = "server" — lab build --start wrongly starts it (apply hero_skills#315 install-only fix) #41
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?
crates/hero_livekit_backend/service.toml:41-42declareslk-backendwithkind = "server", even though its owndescsays "Supervised by hero_livekit_server."In
lab(builder/orchestrator.rs:441),Kind::Server→is_service = true, solab build --startcallsstart_binary_nowfor it (gates at:510and:702). On a fresh box this startslk-backenddirectly — with none of the env its parent injects (LIVEKIT_API_KEY/SECRET,SQLITE_PATH,PORT) and racing the child thatLiveKitService.start()(hero_livekit_server/src/livekit/rpc.rs:614) is meant to supervise.This is the downstream half of hero_skills#315, whose adopted resolution is to reclassify supervised binaries as install-only.
Fix (either):
lk-backendtokind = "cli"inservice.toml→is_cmdline_exception = true→ still built + installed, never started. Self-contained, but mislabels a real TCP daemon ([[binaries.tcp]]:8080) as a CLI tool.lk-backendtoCMDLINE_EXCEPTIONSinhero_skillslab/src/builder/known_services.rs(alongsidehero_shrimp,hero_slides). Keeps the manifest honest (kind = "server"stays true); cost is hardcoding a downstream name into lab.Acceptance:
lab build --starton a clean checkout builds + installslk-backendbut does not start it; onlyhero_livekit_server(+ admin) come up.Design spec (source of truth) — declarative hybrid B1, after org-wide consistency check
This supersedes the original "pick band-aid A or B" framing. After checking the live ecosystem (hero_collab reference impl, hero_proc redesign issues, and the lab-hardcode direction), the design and the interim fix have both firmed up.
Decision summary
lk-backendtokind = "cli"incrates/hero_livekit_backend/service.toml. This makes it install-only (built + installed, never auto-started bylab build --start), stopping the double-start that currently fails on fresh installs (no parent-injected env).lk-backend, and do NOT useCMDLINE_EXCEPTIONS. See "Whykind = "cli"over the alternatives".Why
kind = "cli"over the alternativesCMDLINE_EXCEPTIONS(the earlier "preferred B"): that addslk-backendto a lab hardcode list. hero_skills#308 explicitly calls lab's hardcodedSERVICE_MAP"a parallel source of truth that diverges from each binary'sservice.toml", and hero_proc#135 is wiringservice.toml [[dependencies]]as the authoritative mechanism. Adding a lab hardcode cuts directly against that direction.kind = "cli"keeps the decision inservice.toml— the source of truth the ecosystem is converging on — and is trivially reversible when B1 lands.lk-backend, which is a repo crate and should be a normal declarativeservice.tomlservice — not a launcher script. The only legitimate future use of a lab acquire module is the externallivekit-serverbinary (see wrinkle 1), which is separate, later work and does not address this issue.lk-backendis genuinely a TCP daemon, sokind = "cli"is a white lie. It is acceptable here because (a)lk-backendis TCP-only ([[binaries.tcp]], port 8081) with norpc.sock, so it is not part of the socket-discovery mesh and the mislabel does not corrupt discovery; (b) it is explicitly temporary and reverts tokind = "server"under B1.Target architecture — declarative hybrid B1
Mirrors the hero_collab reference (one crate per binary, each
service.tomldeclares[[dependencies]]on the socket it needs):lk-backend→ its own hero_proc service,kind = "server", declaring[[dependencies]]onhero_livekit_serverrpc.sock. Started by hero_proc in dependency order — no longer hand-spawned byhero_livekit_server. (Requireslk-backendto self-load its config frombackend.envrather than rely on env injected by the parent at spawn — see wrinkle 2.)hero_livekit_admin→ declare the missing[[dependencies]]onhero_livekit_serverrpc.sock(tracked separately; it is missing today, unlike hero_collab_admin).hero_livekit_server→ absorbs config-gen (mint secret, writelivekit.yaml+backend.env) as a boot step (it already self-heals config instart()), and stops holdingChildhandles /pkill-ing. Becomes pure control plane.livekit-server(external downloaded SFU) → acquired + registered the onlyoffice way (it is not a repo crate, so it has noservice.toml). Depends on config + redis/hero_db.Three wrinkles the check surfaced (design constraints)
livekit-serveris an external binary — no crate, noservice.toml. The declarative model can't register it; it needs a bespoke acquire path. Hence "hybrid".[[dependencies]]. TheDependency { repo, crate, bin, socket }model is socket-readiness only. We ride it via "server writes config on boot → dependents gate on the server's socket." This also meanslk-backendmust readbackend.envitself when hero_proc starts it (today the parent injects those env vars at spawn).[[dependencies]]ordering is enforced by lab only (ensure_dependency_running), not the supervisor — so CLI/service.startstarts are unordered. This is the same half-working state hero_collab lives in now.Sequencing
kind = "cli"interim (this issue). Also reconcile the port mismatch:service.tomlsays 8080,DEFAULT_BACKEND_PORTis 8081.Related
depends_onfromservice.toml [[dependencies]]— the enforcement mechanism B1 rides)