fix(server): keep macOS service logs in Library#25013

closed4
main
GitHub fork: fix/macos-service-log-path
opened17d agobyZZheruel
View on GitHubTwo-way sync enabledPR last imported 12d ago

Problem

Updating or repairing the macOS service rewrites its stdout/stderr paths into T3CODE_HOME. When that directory is on an external drive, launchd can fail to open the logs and exit with 78: EX_CONFIG before T3 starts.

Change

Use ~/Library/Logs/T3Code/boot-service.log, create the directory before loading the service, and use the same path in t3 triage. Existing plists migrate on repair or update. Missing HOME no longer produces a relative diagnostic path.

Scope and approval

Focused startup bug fix for #24910 under the obvious-bug exception in CONTRIBUTING.md.

Verification

Regression tests cover log placement, legacy-plist repair, and missing HOME. All 39 focused tests and vp run check:changed pass. Native launchd checks covered install, repair, update/restart, and failure recovery with a symlinked T3 home.

Native launchd reproduction
text
1Old log path: bootstrap=0, program did not run, job exited 78
2New log path: bootstrap=0, program ran, job exited 0

Important

Reinstalling replaces custom launchd log paths with the standard macOS path.

Closes #24910

Model: gpt-6.1-sol. Harness: Codex in T3 Code.

Checks

7 successful · 7 skipped
All checks passed
0c547ba

Added 4 commits

  • fix(server): keep macOS service logs in Library1f20ea4
  • fix(server): keep triage log paths absolute without HOME255b7c2
  • test(server): trim redundant service log assertionsa4f6d89
  • Merge branch 'main' into fix/macos-service-log-path0c547ba
Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between e3592efe7f5dbd3a869e46e608d8f6815e1bb7f6 and 0c547bae59c6a8f172784ee41a0a80315d57b78b.

External image Files selected for processing: 4
  • apps/server/src/cli/triage.test.ts
  • apps/server/src/cli/triage.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

The boot service now resolves its log path by platform. On macOS, it uses the account’s Library/Logs/T3Code directory when a home directory is available, and otherwise falls back to the configured logs directory. Installation creates the resolved path’s parent directory, and triage uses the same resolver.

Changes: Boot-service log paths

Layer / File(s)Summary
Resolve and install the log path
apps/server/src/cloud/bootService.ts, apps/server/src/cloud/bootService.test.ts
resolveBootServiceLogPath selects the log path. Installation creates the resolved path’s parent directory. Tests cover Linux paths, macOS paths, and repair of a legacy plist path.
Use the resolved path in triage
apps/server/src/cli/triage.ts, apps/server/src/cli/triage.test.ts
Triage now uses the boot-service log path resolver. Tests cover missing and empty HOME values, with and without an account home directory.

Priority: External image Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: juliusmarminge, t3dotgg, macroscopeapp

Merge Risk: External image Minimal · up to 0c547

The service and triage log-path changes are consistent, and no issue remains that warrants delaying merge beyond normal checks.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main change: keeping macOS service logs in the Library directory.
Description checkPassedThe description includes the problem, implementation, scope and approval rationale, verification results, reproduction evidence, and the migration behavior for existing plists. It satisfies the requir…
Linked Issues checkPassedThe changes implement the coding requirements in #24910. On macOS, resolveBootServiceLogPath selects ~/Library/Logs/T3Code/boot-service.log instead of a path below T3CODE_HOME. Installation crea…
Out of Scope Changes checkPassedThe changes stay within #24910. The Linux log-path assertion protects unchanged platform behavior. The triage change keeps diagnostics aligned with the repaired macOS service path. The added tests ver…
Full details: Description check

Explanation

The description includes the problem, implementation, scope and approval rationale, verification results, reproduction evidence, and the migration behavior for existing plists. It satisfies the required template sections.

Full details: Linked Issues check

Explanation

The changes implement the coding requirements in #24910. On macOS, resolveBootServiceLogPath selects ~/Library/Logs/T3Code/boot-service.log instead of a path below T3CODE_HOME. Installation creates the resolved log directory before launchctl bootstrap. The generated plist uses the resolved path for both standard streams. Existing legacy plists become out of date and are repaired during installation, as covered by bootService.test.ts. triageCommand uses the same resolved path, with an absolute fallback when HOME is missing. The focused tests cover external T3 homes, legacy repair, log placement, and missing HOME.

Full details: Out of Scope Changes check

Explanation

The changes stay within #24910. The Linux log-path assertion protects unchanged platform behavior. The triage change keeps diagnostics aligned with the repaired macOS service path. The added tests verify the startup fix and its fallback behavior. No unrelated product behavior is changed.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Note

Written by gpt-6.1-sol on behalf of Maria

thanks @Zheruel. your shared log-path resolver, directory creation before launchd loads, legacy-plist repair, and matching triage path address the startup failure directly.

opened https://git.cafe/pingdotgg/t3code/pulls/25406 from current main because this fork has maintainerCanModify: false. it preserves your implementation and release credit. i compared your complete four-file diff against the replacement: no implementation or test pieces were dropped or moved.

four regression cases failed before the fix; all 39 focused tests and vp run check:changed passed afterward on blacksmith. native macOS launchd and restricted external-volume verification remain unverified on this linux vm. the replacement states that limit explicitly. this pr stays open.