fix(sdlc): deploy auto-enables marked timers/services + activate FM-11 lane supervisor#3817
Conversation
…1 lane supervisor Close the deploy-activation gap (CASE-SDLC-REFORM-001, reform-improve-deploy-activation-20260601). `cp + daemon-reload + try-restart` is a no-op for a never-enabled unit, so a freshly-merged timer/service installs but never starts — the systemic "merged but sleeping" root behind the FM-11 lane supervisor being absent from the live user systemd dir. - hapax-post-merge-deploy: auto-`enable --now` any newly-installed unit carrying `# Hapax-Auto-Enable: true` (+ an [Install] section), covering services as well as timers. Unmarked new timers keep auto-enabling for back-compat; unmarked services stay manual (conservative). - New `--verify-auto-enable` mode: post-deploy assertion that every marked unit under systemd/units/ is enabled (and, for timers, active). Exits 1 on any sleeping marked unit. - hapax-lane-supervisor.timer: carry the auto-enable marker so the FM-11 supervisor goes live on merge instead of installing-but-sleeping. - hapax-lane-supervisor.service: repoint ExecStart/Documentation from the canonical integrator worktree (which floats across feature branches and often lacks this script) to the deploy-maintained ~/.local/bin symlink — the convention the supervisor script already uses for its launchers. - Tests: integration tests drive the real deploy via a fake systemctl over a throwaway git repo (marked service enabled; unmarked service not; marker-without-[Install] skipped; marked + plain timers enabled; verify-mode pass/fail); static tests pin the timer marker and the branch-stable ExecStart. Activated live this session: hapax-lane-supervisor.timer is installed + enabled + active; the service runs 0/SUCCESS and exercises FM-11. Codex lane respawns currently fail with "codex not found in PATH" — a pre-existing codex-headless env gap (reform Sec 6 P0), bounded by the supervisor's cooldown/burst control; out of scope here. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR introduces a ChangesSystemd auto-enable feature
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6914bc162
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if [[ "$unit_base" == *.timer ]] \ | ||
| && ! systemctl --user is-active "$unit_base" >/dev/null 2>&1; then |
There was a problem hiding this comment.
Check the triggered service, not just the timer
For a marked timer such as hapax-lane-supervisor.timer, systemctl --user is-active only verifies that the timer unit is loaded/waiting; the timer can stay active even while its triggered hapax-lane-supervisor.service fails on every elapse, for example if the new %h/.local/bin/hapax-lane-supervisor ExecStart symlink is missing or stale. The added --verify-auto-enable mode would then report success while FM-11 is not actually supervising lanes, so please also fail on the associated service's failed state or otherwise verify that the triggered service can run.
Useful? React with 👍 / 👎.
| # Already running — restart to pick up the new unit definition. | ||
| echo "restarting $base" | ||
| restart_user_unit "$base" | ||
| elif unit_content_auto_enable "$(git show "$SHA:$f" 2>/dev/null || true)"; then |
There was a problem hiding this comment.
Enable marked units even when already active
When a marked unit is already active because it was manually started but is still disabled, this elif is skipped and the deploy only restarts it; per systemctl --help, is-active checks active state while is-enabled checks whether the unit file is enabled. That leaves an active-but-disabled marked timer/service disabled after deploy, so it will not survive reboot and --verify-auto-enable fails immediately after the deploy processed the marker.
Useful? React with 👍 / 👎.
| if [[ "$unit_base" == *.timer ]]; then | ||
| echo "ok: $unit_base enabled + active" | ||
| else | ||
| echo "ok: $unit_base enabled" |
There was a problem hiding this comment.
Verify marked services actually started
For a marked long-running service, --verify-auto-enable reports success as soon as is-enabled succeeds because non-timers only reach this ok: ... enabled branch. If that service is enabled but failed or inactive after deploy (for example due to a bad ExecStart or a later crash), the new post-deploy assertion still exits 0 even though the marker's purpose is to prove marked services went live; it should check active state or successful oneshot completion for services too.
Useful? React with 👍 / 👎.
What
Close the deploy-activation gap (
CASE-SDLC-REFORM-001,reform-improve-deploy-activation-20260601).cp + daemon-reload + try-restartis a no-op for a never-enabled unit, so a freshly-mergedtimer/service installs but never starts — the systemic "merged but sleeping"
root behind the FM-11 lane supervisor being absent from the live user systemd
dir.
Changes
hapax-post-merge-deploy— auto-enable --nowany newly-installed unitcarrying
# Hapax-Auto-Enable: true(+ an[Install]section), coveringservices as well as timers. Unmarked new timers keep auto-enabling
(back-compat); unmarked services stay manual (conservative).
--verify-auto-enablemode — post-deploy assertion that every markedunit under
systemd/units/isenabled(and, for timers,active); exits 1on any sleeping marked unit. For operator / CI / smoke witness.
hapax-lane-supervisor.timer— carries the marker so the FM-11supervisor goes live on merge instead of installing-but-sleeping.
hapax-lane-supervisor.service— ExecStart/Documentation repointed fromthe canonical integrator worktree (which floats across feature branches and
often lacks this script) to the deploy-maintained
~/.local/binsymlink —the convention the supervisor script already uses for its launchers.
Tests (TDD)
tests/scripts/test_post_merge_deploy_auto_enable.py(new) — drives the realdeploy via a fake
systemctlover a throwaway git repo: marked serviceenabled; unmarked service not; marker-without-
[Install]skipped; marked +plain timers enabled; verify-mode pass/fail.
tests/systemd/test_lane_supervisor_units.py— pins the timer marker and thebranch-stable ExecStart.
Activated live
hapax-lane-supervisor.timeris installed + enabled + active; the service runs0/SUCCESSand exercises FM-11.--verify-auto-enablepasses against livesystemd state.
Acceptance criteria
enable --nows new marked timers (idempotent, marker-gated); a test asserts it.hapax-lane-supervisor.timeris installed + enabled + active (FM-11 live; dead lanes auto-restart).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests