fix(deploy): guard legacy Quadlet ownership#352
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Reviewer's GuideMakes Quadlet deployment environment-specific (dev vs prod), tightens legacy Quadlet ownership detection to avoid cross-environment teardown, and updates docs/tests to reflect namespaced units and a local safety-net model hop. Sequence diagram for Quadlet stack ownership detection and safe teardownsequenceDiagram
actor User
participant start_stack_sh
participant podman
participant systemd
User->>start_stack_sh: safe_pod_teardown
activate start_stack_sh
start_stack_sh->>start_stack_sh: stack_ownership
alt pod exists
start_stack_sh->>podman: podman pod exists POD_NAME
podman-->>start_stack_sh: exists
start_stack_sh->>podman: podman pod inspect POD_NAME
podman-->>start_stack_sh: InfraContainerID
start_stack_sh->>podman: podman inspect PODMAN_SYSTEMD_UNIT
podman-->>start_stack_sh: infra_unit
alt infra_unit == LLM_ROUTING_POD_UNIT
start_stack_sh-->>start_stack_sh: ownership=quadlet:LLM_ROUTING_POD_UNIT
else infra_unit == LEGACY_LLM_ROUTING_POD_UNIT
start_stack_sh->>systemd: systemctl --user cat LEGACY_LLM_ROUTING_POD_UNIT
systemd-->>start_stack_sh: unit contents
alt legacy_unit_owns_pod
start_stack_sh-->>start_stack_sh: ownership=quadlet:LEGACY_LLM_ROUTING_POD_UNIT
else
start_stack_sh-->>start_stack_sh: ownership=absent
end
else other unit
start_stack_sh-->>start_stack_sh: ownership=legacy
end
else pod absent
start_stack_sh->>systemd: systemctl --user show LLM_ROUTING_POD_UNIT
systemd-->>start_stack_sh: LoadState
alt LLM_ROUTING_POD_UNIT loaded
start_stack_sh-->>start_stack_sh: ownership=quadlet:LLM_ROUTING_POD_UNIT
else
start_stack_sh->>systemd: systemctl --user show LEGACY_LLM_ROUTING_POD_UNIT
systemd-->>start_stack_sh: LoadState
alt LEGACY_LLM_ROUTING_POD_UNIT loaded and legacy_unit_owns_pod
start_stack_sh-->>start_stack_sh: ownership=quadlet:LEGACY_LLM_ROUTING_POD_UNIT
else
start_stack_sh-->>start_stack_sh: ownership=absent
end
end
end
start_stack_sh-->>start_stack_sh: result ownership
alt ownership starts with quadlet:
start_stack_sh->>start_stack_sh: owner_unit="${ownership#quadlet:}"
start_stack_sh->>systemd: systemctl --user stop owner_unit
systemd-->>start_stack_sh: stopped
start_stack_sh->>systemd: systemctl --user reset-failed owner_unit
systemd-->>start_stack_sh: reset
start_stack_sh->>podman: podman pod rm -f POD_NAME
podman-->>start_stack_sh: removed
else legacy or absent
start_stack_sh-->>User: skip Quadlet teardown
end
deactivate start_stack_sh
Flow diagram for updated premium routing fallback with local-qwen-3.6 safety netflowchart LR
A[agent-advanced-core] --> L[local-qwen-3.6]
L --> O[llm-routing-ollama]
O --> R[openrouter-auto]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In the embedded Quadlet rendering Python,
namespace_identifierhas overlapping handling forPod(both in the mainif field in {...}branch and the subsequentelif field == "Pod"), which is currently unreachable and could be simplified to avoid double-replacement pitfalls and make the namespace logic easier to reason about. - The
legacy_unit_owns_podhelper relies ongrep -Fqx "PodName=${POD_NAME}", which is very strict; consider matching more robustly (e.g., allowing trailing whitespace or multiplePodNamelines) so small unit-file formatting changes don’t silently break legacy ownership detection.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the embedded Quadlet rendering Python, `namespace_identifier` has overlapping handling for `Pod` (both in the main `if field in {...}` branch and the subsequent `elif field == "Pod"`), which is currently unreachable and could be simplified to avoid double-replacement pitfalls and make the namespace logic easier to reason about.
- The `legacy_unit_owns_pod` helper relies on `grep -Fqx "PodName=${POD_NAME}"`, which is very strict; consider matching more robustly (e.g., allowing trailing whitespace or multiple `PodName` lines) so small unit-file formatting changes don’t silently break legacy ownership detection.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Superseded by #353 with the final foreign legacy-pod conflict abort and complete fallback documentation consistency. |
Supersedes #351.
Final review fixes:
local-qwen-3.6) in all fallback diagrams and routing bullets.Validation:
bash -n start-stack.shpassed.git diff --checkpassed.http://127.0.0.1:8083is reachable with the approved models loaded.Summary by Sourcery
Isolate dev and prod Quadlet deployments by introducing environment-specific namespaces, updating unit naming and ownership handling to safely coexist with legacy deployments, and documenting the new behavior and local safety-net routing.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: