Skip to content

fix: use environment for Kimaki lock port - #334

Merged
chubes4 merged 1 commit into
mainfrom
fix-332-kimaki-lock-port
Aug 5, 2026
Merged

fix: use environment for Kimaki lock port#334
chubes4 merged 1 commit into
mainfrom
fix-332-kimaki-lock-port

Conversation

@chubes4

@chubes4 chubes4 commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

  • stop rendering Kimaki's removed --lock-port CLI argument in managed systemd units
  • preserve per-instance lock ports through KIMAKI_LOCK_PORT
  • verify upgrades migrate legacy units without losing their configured port

Tests

  • bash tests/kimaki-multi-instance.sh
  • bash tests/bridge-render.sh

Production Context

This fixes the chubes.net outage where Kimaki 0.23.1 rejected --lock-port 29988, leaving the auto-restart parent active while every Discord bot child failed before initialization.

AI Assistance

OpenCode investigated the renderer, implemented the focused change, updated migration assertions, and reviewed the deterministic test results. Homeboy run: agent-task-850d8b5d-b8be-4e24-898f-d7cf37dbb784.

Fixes #332

@chubes4
chubes4 merged commit 29ca939 into main Aug 5, 2026
20 checks passed
chubes4 added a commit that referenced this pull request Aug 5, 2026
…ng (#335)

19 of 42 test files were present in the repo and referenced nowhere in
.github/workflows/shell.yml — nearly half the suite, run only when someone
remembered to run it by hand.

That is not theoretical. #334 changed how the Kimaki lock port reaches a
systemd unit, updated tests/kimaki-multi-instance.sh to match, merged with
20/20 checks green, and left that test failing on main, because it was one
of the 19. CI reported green over red. The only reason it surfaced was an
unrelated full-suite run afterwards.

The break itself: #334 removed the `--lock-port` argument that
bridge_render_systemd used to append to ExecStart, in favour of an
Environment= line. But the renderer only interpolates the env block its
caller hands it, so the guarantee moved from something the RENDERER
enforced unconditionally to something every CALLER has to remember. A
caller that renders with an env block lacking the line silently drops the
port, and the instance falls back to the default — two Kimaki instances
then contend for one lock, which is the exact failure multi-instance
support exists to prevent. The renderer now re-asserts the line when
KIMAKI_LOCK_PORT is set and the block does not already carry it, at the
same layer that always owned it.

The suites are wired in as a matrix rather than 21 more hand-written jobs,
so adding a test is a one-line change. They run through `bash` because
several of these files do not carry the executable bit — invoking them as
./tests/x.sh reports a Permission denied that reads exactly like a test
failure.

tests/ci-coverage.sh is the part that matters. A workflow that lists jobs
by hand fails silently and permanently: the person adding a test is the
same person who must remember to wire it, and nothing complains when they
do not. The guard fails loudly instead, and has an EXCLUDED list so that
deliberately skipping a test is a visible decision rather than an
omission. It checks for the test name anywhere in the workflow rather than
one exact invocation, so a matrix, a composite job, or a future
restructure all still satisfy it — the claim is "CI knows about this
file", not "CI runs it this particular way".

Local suite is green apart from three environment-only failures that also
fail on origin/main: this host has a real /usr/bin/kimaki, which two tests
resolve instead of their fixtures, and no studio CLI for a third.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: stop passing removed Kimaki --lock-port option

1 participant