Skip to content

fix(box): login agents on a Mac run as interactive work, not background - #177

Merged
sean-brydon merged 2 commits into
mainfrom
fix/interactive-login-agents
Oct 21, 2026
Merged

sean-brydon merged 2 commits into
mainfrom
fix/interactive-login-agents

Conversation

@sean-brydon

Copy link
Copy Markdown
Collaborator

What changes

Every launchd plist Shipyard writes (service.Render) said ProcessType Background. macOS throttles the CPU and disk of a Background job, and of everything it starts: the laptop agent, berthd on a Mac box, and the agents and builds berthd runs in tmux. They now say ProcessType Interactive. Linux's systemd units are unchanged; they had nothing like it.

Plists that are already installed

Login agent How it gets the new plist
Laptop agent (dev.berth.agent) Right away when the app updates: berth agent restart --if-stale reinstalls it.
This Mac's own box (dev.berth.berthd, app-managed) Right away when the app updates: the agent runs berthd install --keep-listen again.
A Mac box updated with Update all / berth upgrade berthd only swaps its binary, so on start the new berthd rewrites the line in its own plist (new service.Migrate). launchd reads it at the next load (restart or login). Running the install command again applies it at once.
Managed units / helpers on a Mac box Reinstalled the next time something ensures them, because their rendered bytes changed.

Migrate changes only the file and never reloads a running service. It only touches a plist written for this same program and BERTH_HOME, so another install's plist, or a test's, is left alone. It matters beyond speed too: doctor's "starts at boot" and ensureAgent compare the plist byte for byte, so without it an older plist would read as "not installed".

Proof

A real berthd in an isolated HOME (a temporary ~/Library/LaunchAgents, never the real one), with a plist as v0.3.29 writes it:

before: <key>ProcessType</key><string>Background</string>
$ HOME=$S/home BERTH_HOME=$S/berth ./berthd serve --listen 127.0.0.1:17991
after:  <key>ProcessType</key><string>Interactive</string>

(berthd then stopped binding its unix socket because the scratch path was over macOS's 104-byte limit. That happens after the migration and doesn't affect it.)

On this Mac, before the change, launchd reports the laptop agent as spawn type = background (5).

=== RUN   TestUnitsRestartOnlyAfterFailure                       (now also checks Interactive)
--- PASS: TestUnitsRestartOnlyAfterFailure (0.00s)
=== RUN   TestMigrateBringsAnOlderPlistUpToDateWithoutReloading  (other program untouched, Installed after, idempotent, no launchctl)
--- PASS: TestMigrateBringsAnOlderPlistUpToDateWithoutReloading (0.00s)
=== RUN   TestMigrateWithoutAPlist
--- PASS: TestMigrateWithoutAPlist (0.00s)
ok  	github.com/cosscom/shipyard/internal/service

go vet ./... and go test -race ./... pass, except internal/box's TestAttachPassesShiftEnter, which fails the same way on main with this Mac's tmux 3.7c. The docs build passes.

🤖 Generated with Claude Code

launchd throttled the CPU and disk of a Background job and of everything it
started, so agents and their builds on a Mac ran slow. The plist now says
Interactive. berthd and the laptop agent update an older plist of their own
in place when they start (the file only; launchd reads it at the next load),
so a berthd upgraded from the app catches up and the byte-for-byte checks
(doctor's "starts at boot", ensureAgent) keep passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sean-brydon sean-brydon added the run-ci Run CI on this pull request label Oct 21, 2026
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
berth Ready Ready Preview Oct 21, 2026 12:23pm UTC
berth-docs Ready Ready Preview Oct 21, 2026 12:23pm UTC

Request Review

@sean-brydon
sean-brydon merged commit 55598f1 into main Oct 21, 2026
1 of 3 checks passed
@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

ENG-6585

@sean-brydon sean-brydon mentioned this pull request Oct 21, 2026

This branch was successfully deployed

2 active deployments
Preview – berth-docs — a7783a7a Deployed Oct 21, 2026 by vercel[bot]
Preview – berth — a7783a7a Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci Run CI on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant