Persist Lyra Redview encoder and worker authentication #269

Merged
nimmo merged 5 commits from fix/lyra-redview-persistent-encoder into main 2026-10-06 15:38:04 +01:00
Owner

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 head 3e7b9ec, 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.

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 head 3e7b9ec, 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.
Persist Lyra Redview encoder and remote-worker authentication
Some checks failed
AI pull-request review / review (pull_request) Successful in 7s
Build and Push Attic Cache / test (pull_request) Failing after 1m11s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
40eaa7707c
Refs #268. Declare the tested encoder runtime and protected worker key, and keep readiness inside the service definition. Update the existing production configuration check and deployment notes. Validation and one-off RC cutover scripts remain private, outside this repository.
chore: Auto-update flake inputs
Some checks are pending
AI pull-request review / review (pull_request) Has started running
Build and Push Attic Cache / test (pull_request) Successful in 2m45s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
fcd1fd4087
Validated-base: a12bb0cb69
Validated-lock-sha256: 7d67ca513bae138204e081636a61345daef9901a9e39f1eccf4b08689dd8bdcf
Cached-paths-sha256: 9ee603be6b8b842c8a41f9110ae751827fe72b02773e3ccdab5ad2b17f0f6ac1
Merge remote-tracking branch 'origin/main' into fix/lyra-redview-persistent-encoder
All checks were successful
AI pull-request review / review (pull_request) Successful in 26s
Build and Push Attic Cache / test (pull_request) Successful in 1m32s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
ae5b831434
nimmo changed title from WIP: Persist Lyra Redview encoder and worker authentication to Persist Lyra Redview encoder and worker authentication 2026-10-06 14:39:03 +01:00
Author
Owner

Automated code review

Reviewed commit: 3e7b9ec58e00307087b6024d9e6a3fb0fc6c6151

Verdict: 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-encoder systemd 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

  • Hardcoded encoder port and runtime paths (modules/services/redview.nix:152; medium confidence)
    The redview-v2-encoder service definition hardcodes port = 3212; and encoderRuntime = "/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 postStart script 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-failure with 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

  • No configured deterministic checks.

Questions

  • What is the expected behavior of systemd if the redview-v2-encoder service fails its readiness check? Is there a Restart= policy defined elsewhere that might cause a restart loop?
  • Has the remote-worker.env file been created and populated with the correct key on Lyra before this configuration is deployed? The module assumes it exists.
  • Are there any other services or hosts that depend on the encoder running on port 3212? If so, are they aware of this new dependency?

Review limitations

  • I cannot verify the actual content of the remote-worker.env file or its permissions, as it is a SOPS-managed secret not included in the diff.
  • I cannot run nix flake check or build the configuration to confirm that the assertions pass and the service definitions are syntactically correct.
  • I cannot verify the live health of the encoder or workers on Lyra, as I do not have access to the host.
  • The diff does not show the full flake.lock changes, 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 batch
  • modules/services/redview.nix: reviewed — included in a context-limited batch
  • scripts/check-redview-v2-production.nix: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: qwen3.6:35b-a3b-q8_0
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 5
  • Previous automated review: updated
  • Findings: 3
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `3e7b9ec58e00307087b6024d9e6a3fb0fc6c6151` ## Verdict: 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-encoder` systemd 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 - **Hardcoded encoder port and runtime paths** (modules/services/redview.nix:152; medium confidence) The `redview-v2-encoder` service definition hardcodes `port = 3212;` and `encoderRuntime = "/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 `postStart` script 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-failure` with 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 - No configured deterministic checks. ### Questions - What is the expected behavior of systemd if the `redview-v2-encoder` service fails its readiness check? Is there a `Restart=` policy defined elsewhere that might cause a restart loop? - Has the `remote-worker.env` file been created and populated with the correct key on Lyra before this configuration is deployed? The module assumes it exists. - Are there any other services or hosts that depend on the encoder running on port 3212? If so, are they aware of this new dependency? ### Review limitations - I cannot verify the actual content of the `remote-worker.env` file or its permissions, as it is a SOPS-managed secret not included in the diff. - I cannot run `nix flake check` or build the configuration to confirm that the assertions pass and the service definitions are syntactically correct. - I cannot verify the live health of the encoder or workers on Lyra, as I do not have access to the host. - The diff does not show the full `flake.lock` changes, 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 batch - `modules/services/redview.nix`: **reviewed** — included in a context-limited batch - `scripts/check-redview-v2-production.nix`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: qwen3.6:35b-a3b-q8_0 - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/nova-remote-builder.md, README.md - Commits considered: 5 - Previous automated review: updated - Findings: 3 </details>
Document encoder model validation and RC3 cutover procedure
All checks were successful
AI pull-request review / review (pull_request) Successful in 1m31s
Build and Push Attic Cache / test (pull_request) Successful in 1m35s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
984273d13b
Author
Owner

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.

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.
Make the validated encoder identity configurable
All checks were successful
AI pull-request review / review (pull_request) Successful in 1m22s
Build and Push Attic Cache / test (pull_request) Successful in 1m29s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
3e7b9ec58e
Author
Owner

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.

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.
Author
Owner

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.

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.
Author
Owner

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.

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.
nimmo merged commit 5a661813aa into main 2026-10-06 15:38:04 +01:00
Sign in to join this conversation.
No reviewers
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
nimmo/nixos-config!269
No description provided.