Skip to content

Commit 1aca3cd

Browse files
authored
test(kimaki): refresh systemd bridge snapshot (#105)
1 parent 0ecfe6a commit 1aca3cd

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/__snapshots__/bridges/kimaki-systemd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ WorkingDirectory=/var/www/site
99
Environment=HOME=/home/chubes
1010
Environment=PATH=/usr/bin:/usr/local/bin:/bin
1111
Environment=KIMAKI_DATA_DIR=/home/chubes/.kimaki
12+
# Reap stray opencode-serve children left behind by the previous kimaki
13+
# process before starting a fresh one. Each kimaki session spawns its own
14+
# opencode-serve worker; if kimaki exits uncleanly (crash, OOM, manual
15+
# kill) those workers are reparented to PID 1 and keep running. They all
16+
# share $HOME/.local/share/opencode/auth.json, so concurrent OAuth
17+
# refreshes race each other — Anthropic rotates the refresh token on every
18+
# use, and the loser of the race gets HTTP 400 invalid_grant on its next
19+
# request. `pkill -u chubes` scopes the kill to this service's
20+
# user so multi-tenant hosts aren't sniped. The `-` prefix makes systemd
21+
# tolerate exit code 1 (no matches found, the happy path on a clean box).
22+
ExecStartPre=-/usr/bin/pkill -TERM -u chubes -f "opencode-ai/bin/.*serve"
1223
ExecStartPre=/opt/kimaki-config/post-upgrade.sh
1324
ExecStart=/usr/bin/kimaki --data-dir /home/chubes/.kimaki --auto-restart --no-critique
1425
Restart=always

0 commit comments

Comments
 (0)