GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): macOS service install and restart from inside T3 hand off to launchd by juliusmarminge · Pull Request #28565 · pingdotgg/t3code

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 1, 2026

Copy link
Copy Markdown
Member

Problem

On macOS, t3 service install, t3 service restart and a restarting t3 update run from inside T3 (a T3 terminal or an agent shell, so a descendant of the com.t3tools.t3code.service launchd job) run launchctl bootout --wait on their own job. The bootout kills the caller before launchctl bootstrap, and a booted-out job is not restarted by KeepAlive, so the service stays down. systemd already hands this work to the service manager; launchd had no handoff, and the inside-service check never matched on macOS because the plist sets T3_BOOT_SERVICE_UNIT=com.t3tools.t3code.service.plist while the check compared against t3code.service.

Reproduced on main (ce9e016) as two failing tests in the darwin harness of apps/server/src/cloud/bootService.test.ts, with the marker the launch agent really sets: an in-service install() and restart each issue launchctl bootout --wait gui/501/com.t3tools.t3code.service from the caller.

Change

  • The inside-service check compares T3_BOOT_SERVICE_UNIT with the detected manager's own unit file name, so the existing macOS marker matches (the plist is unchanged, so installed services stay current).
  • BootServiceManager.handoff now has install and restart entries for both managers; install() and restart() no longer branch on kind. The systemd handoff (transient unit for install, restart --no-block) is moved there unchanged.
  • On launchd, a handoff writes a one-shot job plist (its own unique label com.t3tools.t3code.service.handoff.<id>, RunAtLoad, no KeepAlive, PATH and HOME only, no service marker, output appended to boot-service.log) under <baseDir>/runtime, bootstraps it into gui/<uid>, and removes the file. The job runs outside the service's job, so stopping the service does not kill it. Unique labels mean a second in-service call never unloads a handoff that is still running.
    • install: the job runs the target runtime's service install --base-dir <baseDir> [--allow-downgrade], which takes the normal stop-first path; the caller returns handedOff.
    • restart: the job runs launchd's own stop and start steps through /bin/sh (not kickstart -k, which neither reloads a rewritten plist nor spares the caller, and not the installed plist's program, which may be node on old npm installs); the caller returns queued.
  • t3 update's handed-off message says "from outside the service" instead of "from a separate systemd unit".

Scope and approval

Fixes #28552

Triaged via the automated issue flow.

Verification

  • vp test run apps/server/src/cloud/bootService.test.ts apps/server/src/cli/update.test.ts apps/server/src/cli/service.test.ts on the branch: 59 passed.
  • The same bootService.test.ts against main's bootService.ts (ce9e016): 2 failed, 35 passed:
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯
 FAIL  |t3| src/cloud/bootService.test.ts > boot service install > hands an in-service install to launchd without booting out the running agent
AssertionError: expected [ Array(1) ] to deeply equal []
- Expected
+ Received
- []
+ [
+   "launchctl bootout --wait gui/501/com.t3tools.t3code.service",
+ ]
 FAIL  |t3| src/cloud/bootService.test.ts > boot service install > queues an in-service restart on macOS without booting out the running agent
AssertionError: expected [ …(2) ] to deeply equal []
- Expected
+ Received
- []
+ [
+   "launchctl bootout --wait gui/501/com.t3tools.t3code.service",
  • New and extended tests: in-service install on macOS hands off without booting out the service, leaves state and plist untouched, and the job runs <entry> service install --base-dir <baseDir> without the marker; in-service restart is queued, two restarts load two distinct jobs with no bootout, the job script stops and bootstraps the launch agent, carries no marker or KeepAlive, and leaves no plist behind. Existing systemd handoff tests pass unchanged.
  • vp run check:changed: format, lint, knip, typecheck (3 packages) and tests pass.
  • No visible surface, so no captures.
  • cannot-verify macos: nothing here ran on a Mac. Not checked natively: launchd bootstrap of the handoff plist, the job's environment and survival across the service bootout, and whether macOS 13+ Background Task Management shows a notice per handoff job. On macOS 15, where bootout --wait is a usage error (launchctl bootout --wait is a usage error on macOS 15, so boot-service install/update/restart fails #11995), the handed-off install or restart still fails inside the job as it does from a terminal, leaving the old service running; that is fixed separately.

Model and harness: Claude Opus 5.5 (Claude Code) as lead, implementer and test writer, with GPT-6.1 Sol (Codex) and Claude Opus 5.5 reviewers, run through T3 Code.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
juliusmarminge and others added 7 commits November 1, 2026 07:36
@juliusmarminge @claude
test(server): reproduce #28552 in-service install and restart on macOS
bc171f1
The darwin harness now sets the marker the launch agent plist renders
(com.t3tools.t3code.service.plist) instead of the systemd unit name. With
it, an install or restart run from inside the launch agent boots out its
own job instead of handing the work to launchd, so these tests fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge @claude
fix(server): in-service install and restart on macOS hand off to launchd
f36015c
Run from inside the launch agent (an agent shell or T3 terminal), `t3
service install`, `t3 service restart` and a restarting `t3 update` booted
out their own job before bootstrapping it again, so the service stayed down.
The marker check only knew the systemd unit name, and the launchd path had
no handoff.

The service is now detected by the marker the detected manager's own unit
renders. Each manager owns a handoff for install and restart: systemd keeps
its transient unit and `restart --no-block`; launchd bootstraps a one-shot
job from `<T3 home>/runtime` that runs the same CLI command from outside the
service, without the service marker or KeepAlive. A restart runs the
installed launcher's `service restart`, so a plist rewritten by `t3 update`
is reloaded.

`writeDurably` now chmods its temp file to 0600: the write mode never
applied to the already-created file, and launchd refuses group-writable
plists.

Fixes #28552

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge @claude
fix(server): keep the handoff bootout macOS 15-safe and leave file mo…
7e2df59
…des alone

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge @claude
fix(server): leave a running launchd handoff to finish instead of boo…
cea2edf
…ting it out

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge @claude
fix(server): give each launchd handoff its own job and restart with l…
d3c4582
…aunchctl

Concurrent in-service calls no longer unload each other's running handoff,
and a restart no longer depends on the CLI the installed plist names.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge @claude
test(server): pin the command the macOS install handoff job runs
08ad2bc
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge
Merge origin/main into fix/issue-28552
b5bb533
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Nov 1, 2026
macroscopeapp[bot]
macroscopeapp Bot approved these changes Nov 1, 2026
View reviewed changes
@macroscopeapp

macroscopeapp Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at b5bb533

Macroscope's review found this PR approvable — macOS service install and restart now run through a one-shot launchd job so stopping the service does not kill the operation. The change is limited to requested per-user service operations, with existing install safeguards and terminal-based recovery preserved.

You can add or adjust custom eligibility rules. Learn more.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB +29 B (+0.6%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB +29 B (+2.3%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.6 KiB +41 B (+0.2%) 24.4 KiB ✅
Codex Live turn messages 1 2 +1 (+100.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.3 KiB 1.3 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 2 2 0 (0.0%) 8 ✅

Baseline: 37d7615 · PR result: b5bb533 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: fix/issue-28552
  • File: .coderabbit.config.ts
  • Commit: b5bb533
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 6d8b3819-a1cb-4562-b9d5-77a40b7f285b
Commits

Reviewing files that changed from the base of the PR and between 37d7615 and b5bb533.

Files selected for processing: 3
  • apps/server/src/cli/update.ts
  • apps/server/src/cloud/bootService.test.ts
  • apps/server/src/cloud/bootService.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

In-service installation and restart now use manager-specific handoffs. On macOS, launchd handoffs use uniquely labeled one-shot jobs. Service detection compares the configured marker with the detected manager’s unit basename.

Changes: Service manager handoffs

Layer / File(s) Summary
Manager handoff contracts and implementations
apps/server/src/cloud/bootService.ts
BootServiceManager.handoff now defines install and restart callbacks. Systemd and launchd provide manager-specific handoff behavior. Launchd handoffs use one-shot plist jobs with command arguments, environment values, and log paths.
In-service routing and handoff execution
apps/server/src/cloud/bootService.ts, apps/server/src/cloud/bootService.test.ts, apps/server/src/cli/update.ts
In-service detection compares the marker with the detected manager’s unit basename. Installation and restart use the manager’s handoff callbacks. The tests check macOS handoff behavior, and the update status message now says the switch runs “from outside the service.”

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • pingdotgg/t3code issue 11995: The launchd stop sequence still uses launchctl bootout --wait, which the issue reports can fail on macOS 15.
  • pingdotgg/t3code issue 12627: Installation uses the target runtime CLI, intersecting with the issue’s concern about the CLI protocol used to write service state.
  • pingdotgg/t3code issue 24755: Launchd handoff output is sent to the service log path discussed in the issue.
  • pingdotgg/t3code issue 24910: The handoff plist uses the service log path under the T3 base directory, the path policy discussed in the issue.

Suggested reviewers: rookmate, macroscopeapp, maria-rcks

Merge Risk: Minimal · up to b5bb5

No actionable regression is established for this change. Native macOS handoff behavior has not been verified, but that uncertainty alone does not block merging.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: macOS service installs and restarts invoked inside T3 now hand off to launchd.
Description check Passed The description includes complete Problem, Change, Scope and approval, and Verification sections. It explains the failure, implementation, linked issue, test results, unverified native macOS behavior,…
Linked Issues check Passed Issue #28552 has coding requirements. The change detects the launchd marker from the detected unit filename. It adds install and restart handoffs for launchd. Each launchd handoff uses a unique one-sh…
Out of Scope Changes check Passed The changes stay within issue #28552. The production changes implement manager-owned install and restart handoffs, marker detection, launchd job creation and cleanup, and the related update message. T…
Full details: Description check

Explanation

The description includes complete Problem, Change, Scope and approval, and Verification sections. It explains the failure, implementation, linked issue, test results, unverified native macOS behavior, and the separate macOS 15 limitation.

Full details: Linked Issues check

Explanation

Issue #28552 has coding requirements. The change detects the launchd marker from the detected unit filename. It adds install and restart handoffs for launchd. Each launchd handoff uses a unique one-shot job with no KeepAlive, no service marker, and output appended to boot-service.log. Install runs the target CLI's service install; restart runs launchd stop and start steps outside the service job. The caller returns handedOff or queued. The existing update restart path uses the updated service restart handoff, and its message no longer claims a systemd-only handoff. The added tests cover marker detection, install and restart handoffs, unique jobs, preserved service files, job contents, and cleanup. The reported verification also passes the relevant tests and checks.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #28552. The production changes implement manager-owned install and restart handoffs, marker detection, launchd job creation and cleanup, and the related update message. The test harness and regression tests support these requirements. The systemd code preserves the existing handoff behavior while moving it into the shared handoff interface. No unrelated product behavior or unrelated files are introduced.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added bugfix Fix PR opened by an issue lead; enters the PR loop pr:gate-failed A land gate failed labels Nov 1, 2026
This was referenced Nov 3, 2026
fix(cli): t3 service restart no longer says another home's service is not installed #29848
Closed
fix(cli): t3 update no longer says a service awaiting restart runs the new version #29901
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Nov 6, 2026
fix(server): keep macOS service logs in Library #25407
Open
Wladefant

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@t3dotgg
t3dotgg dismissed Wladefant’s stale review November 8, 2026 23:28

Dismissed: unsolicited automated review from a blocked account.

@pingdotgg pingdotgg deleted a comment from Wladefant Nov 8, 2026
@pingdotgg pingdotgg deleted a comment from Wladefant Nov 8, 2026
This was referenced Nov 11, 2026
fix(server): macOS service starts even when launchd leaves it pending after bootstrap #29528
Open
fix(server): macOS boot service stops the launch agent without bootout --wait #26088
Open
@wixlit

wixlit commented Nov 11, 2026

Copy link
Copy Markdown

Confirming this on a released build: on macOS, t3 service restart run by Codex inside T3 stopped the service and it never came back; the launchd system log shows the stop chain launchctl <- t3 CLI <- codex <- T3 server.

We carry the same fix (handoff to a one-shot launchd job) in a fork, and added a macOS-only test against the real launchd: an isolated label and HOME, a process of the service runs the real t3 service restart, and the test waits on a FIFO until the restarted service writes its new pid, with the caller dead. It passes in ~2.4s on macOS 15.1 and cleans up after itself. Happy to share it if useful for this PR.

asdasd-dev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request Nov 11, 2026
fix(server): macOS service keeps its privacy grants across updates #34450
Closed
@PhucHoangHo PhucHoangHo mentioned this pull request Nov 20, 2026
[Bug]: macOS: t3 service install, t3 service restart and a restarting t3 update run inside T3 have no launchd handoff, so bootout can kill the caller before bootstrap #28552
Open
2 tasks done

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] approved these changes
+1 more reviewer
@Wladefant Wladefant Wladefant requested changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bugfix Fix PR opened by an issue lead; enters the PR loop pr:gate-failed A land gate failed size:L 100-499 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: macOS: t3 service install, t3 service restart and a restarting t3 update run inside T3 have no launchd handoff, so bootout can kill the caller before bootstrap

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@juliusmarminge @wixlit @Wladefant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.