Persist Lyra Redview encoder and worker authentication #269
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:cosmos
host:electra
host:fleet
host:lena
host:lyra
host:mass-storage
host:media1
host:nimmog-de
host:nova
host:pangolin
host:pangolin-vps
host:phone
host:router
host:vega
investigation
phase:cutover
phase:deploy
phase:mcp
phase:module
phase:packaging
phase:prep
phase:validation
priority:high
priority:medium
project:attic-postgres-lyra-rollout
project:auto-update-reliability
project:auto-update-remediation
project:declarative-purity-cleanup
project:external-review
project:fleet-boundary-cleanup
project:host-facts-refactor
project:lyra-nixos-deploy
project:lyra-service-stack-migration
project:nebula-mesh-network
project:nix-idioms-hygiene
project:nixos-build-deployment-pipeline
project:security-hardening
project:service-stack-migration
project:vega-sillytavern-cutover
project:wiki-rebuild
repo:numtide/flake-utils
repo:numtide/nix-auth
repo:numtide/nixos-passthru-cache
repo:numtide/nix-relay
service:auto-update
service:gitlab
service:hermes
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
service:tdarr
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!269
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lyra-redview-persistent-encoder"
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?
Lyra's encoder and worker authentication currently rely on temporary RC3 runtime units. Declare the validated encoder runtime/cache and protected worker-key file persistently, wait for matching model metadata before API/worker startup, and monitor encoder failures.
Only three existing files change: service configuration, its evaluation check and README. No new test or operational scripts are included. Refs #268; leave the issue open for live activation and follow-up evidence.
The expected model identity is a typed nixosConfig.redview.encoder.expectedIdentity option with the unchanged validated SHA-256 default. README documents deriving metadata from the selected package, service-user image/text inference acceptance, coordinated model/cache/runtime updates and derived-index rebuilding. The focused option regression failed before implementation and now confirms an override is rendered into readiness rather than retaining the default literal.
The completed flake update (action #1056, main commit
4d8adab) is integrated; its lock selects stable Redview 2.4.0 at 81a247f. On current head3e7b9ec, local full flake checks and full Lyra system build pass. CI action #1065 passes tests; CI build/cache jobs are skipped. Three private cleanup safety tests and the exercised metadata-generation command pass. Automated review removed the identity finding; its remaining fixed port/runtime flexibility concern is assessed in the review response as a deliberate Lyra deployment choice. The inherited encoder restart policy is on-failure with 5s backoff.Deployment: the operator has held Lyra updates. The tested one-off helper is privately staged on Lyra, outside this repository, and has not been executed. Issue #268 contains the exact RC3 retirement, backup/recovery and operator activation checklist; the trial must release port 3212 before declarative activation. Keep the validated runtime GC-rooted and the protected worker environment available. Gracefully interrupted jobs may require explicit resume. Nova's worker/encoder/tunnel remain stopped. No host activation or hold release performed.
WIP: Persist Lyra Redview encoder and worker authenticationto Persist Lyra Redview encoder and worker authenticationAutomated code review
Reviewed commit:
3e7b9ec58e00307087b6024d9e6a3fb0fc6c6151Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The PR implements persistent authentication for the Lyra Redview encoder and remote workers. It introduces a
redview-v2-encodersystemd service that validates model identity via SHA-256 hash before allowing dependent API/worker services to start. It updates worker configuration to load a protected key file (remote-worker.env) and adds assertions to ensure the Redview input version supports these features. Documentation in README.md is expanded to cover the encoder update procedure, identity pinning, and cutover plans.Blocking findings
None.
Important findings
The
redview-v2-encoderservice definition hardcodesport = 3212;andencoderRuntime = "/var/lib/redview-v2/encoder-runtime-rc3";. The README and check script also assume these values.Impact: Reduced flexibility for deployment in environments where port 3212 is unavailable or if the runtime path needs to change. Requires code changes rather than configuration overrides.
Suggested fix: Consider making the encoder port and runtime path configurable via Nix options with sensible defaults, allowing host-specific overrides if necessary.
Suggestions
Encoder readiness check timeout behavior (modules/services/redview.nix:215; medium confidence)
The
postStartscript uses a 240-second deadline to poll the encoder metadata. If it fails, the service exits with code 1.Impact: If the encoder takes longer than 240 seconds to load or if there is a transient network issue, the service will fail. Depending on
Restart=settings (not fully visible in diff but implied by typical patterns), this may cause a restart loop, blocking API/worker startup.Suggested fix: Ensure
Restart=is set appropriately (e.g.,on-failurewith backoff) or consider using a dedicated readiness probe script that systemd can monitor more gracefully. Document the expected max startup time for the encoder model loading.Hardcoded worker key file path (modules/services/redview.nix:19; medium confidence)
workerKeyFile = "/var/lib/redview-v2/remote-worker.env";is defined in the module. The check script also hardcodes this path.Impact: If the key file location needs to change for security or operational reasons, both the module and the check script must be updated consistently.
Suggested fix: Consider making the worker key file path configurable via an option, defaulting to the current value, to allow future flexibility without code changes.
Tests and validation
Questions
redview-v2-encoderservice fails its readiness check? Is there aRestart=policy defined elsewhere that might cause a restart loop?remote-worker.envfile been created and populated with the correct key on Lyra before this configuration is deployed? The module assumes it exists.Review limitations
remote-worker.envfile or its permissions, as it is a SOPS-managed secret not included in the diff.nix flake checkor build the configuration to confirm that the assertions pass and the service definitions are syntactically correct.flake.lockchanges, only the commit message referencing the update. I assume the lock update is correct based on the PR description.Diff coverage
README.md: reviewed — included in a context-limited batchmodules/services/redview.nix: reviewed — included in a context-limited batchscripts/check-redview-v2-production.nix: reviewed — included in a context-limited batchReview metadata
Addressed the automated review in commit
984273d. The expected hash intentionally pins the operator-validated model contract independently of the application version. README now explains the SHA-256 metadata inputs and gives an exercised read-only command deriving metadata from the actual selected Lyra package; that command returns the readiness predicate's current identity and 2048 dimensions. Model updates require staged cache/runtime, service-user image/text inference acceptance, coordinated identity/dimension updates, flake/full-host checks and planning the derived index rebuild. CI configuration checks are explicitly distinguished from real inference acceptance.Issue #268 now contains the one-off RC3 cutover, backup/recovery sequence and live acceptance checklist. The tested helper is privately staged at /home/nimmo/redview2-test/amd-validation/retire-rc3-runtime.py on Lyra; its help command was checked but cleanup was not executed. It stays outside nixos-config. Three focused cleanup safety tests pass, as does the full flake check after these documentation/comment corrections. The prior exact final system build remains applicable to unchanged service behavior.
No services were activated or stopped during this correction; Lyra's update hold remains, and Nova workers remain off. Please reassess the documented identity-update process and tracked cutover plan.
Follow-up correction now adds the requested named option
nixosConfig.redview.encoder.expectedIdentity, validated as a 64-character lowercase hex SHA-256 identity. The readiness predicate consumes this option; its default is the unchanged operator-validated hash. README documents setting it in the host configuration only after staged model/cache/runtime and inference acceptance, without editing the service script.A focused regression in the existing config check failed first with the option absent, then passed after implementation. It renders a distinct configured identity into the readiness predicate and confirms the original default does not remain there. Full flake checks and the full Lyra system build pass after this change. No extra scripts were added to nixos-config.
The 240-second readiness deadline already sits within TimeoutStartSec=300; timeout/mismatch behavior has private tests. The worker-key path remains the existing protected operator-provisioned file. Making unrelated paths/timers configurable is not required for this rollout. RC3 retirement and recovery remain documented/staged in #268; nothing has been activated and the hold remains.
Assessed the review on
3e7b9ec. The identity finding is resolved by the typed expectedIdentity option and its failed-then-passing override regression. The new port/runtime-path finding concerns future portability rather than a demonstrated Lyra defect: this production configuration deliberately retains the validated runtime/cache under /var/lib/redview-v2/encoder-runtime-rc3 and existing loopback port 3212. The reusable Redview module exposes encoder.port/pythonExecutable/url; changing this deployment requires coordinated runtime/cache/readiness validation. The current port conflict with the RC3 trial is handled by the retirement plan in #268. Broader host-layout configurability is deferred.The inherited encoder policy is Restart=on-failure with RestartSec=5. The readiness deadline is 240s within TimeoutStartSec=300; dependencies wait for postStart. Persistent mismatches/cache failures intentionally block startup and need operator correction under the hold. The worker environment was provisioned during RC3 activation; it is a protected external file, separate from the SOPS redview-env secret. No secret contents were exported.
Local full flake checks and the Lyra system build pass, as does CI action #1065's test job; CI build/cache jobs are skipped. No host activation, hold release or Nova worker start was performed.
Final merge assessment: the operator explicitly authorises proceeding when automated findings are not valid defects. I assessed the remaining fixed-port/runtime and key-path findings as future portability preferences for this Lyra-specific deployment, not defects requiring changes: these preserve the existing provisioned runtime/cache/credential location and validated loopback port. No generic deployment compatibility is claimed. The typed model identity option resolves the original substantive maintenance finding.
Local flake checks/full Lyra build, focused identity-override regression, private readiness/cleanup safety checks and required CI pass. Live RC3 canary exercises the same pinned model/cache/port with successful NVIDIA text/image inference, healthy API/four workers and progressing vectorization; the final declarative transition remains explicit operator acceptance in #268. Keep that issue open. Merging does not activate Lyra or release its update hold; the staged RC cleanup must run once as part of operator cutover before the declarative encoder takes port3212. Nova workers remain stopped until stable Lyra confirmation. Normal protected merge only; no gate bypass.