Skip to content

fix(cli): t3 service restart no longer says another home's service is not installed - #29848

Open
saphid wants to merge 2 commits into
pingdotgg:mainfrom
saphid:fix/service-restart-other-home
Open

saphid wants to merge 2 commits into
pingdotgg:mainfrom
saphid:fix/service-restart-other-home

Conversation

@saphid

@saphid saphid commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Problem

The background service unit is per user, but each unit serves one T3 home. When t3 service restart runs with a different home than the one the service was installed for (another --base-dir, or a different T3CODE_HOME), BootService.restart correctly skips the restart. The command then prints "T3 Code service is not installed." That's wrong: a service is installed, it just belongs to another home.

The message also points the user the wrong way. Someone told "not installed" will usually run t3 service install next, and on current main that rewrites the per-user unit onto the wrong home (the empty-home problem in #23858).

Change

When restart returns "skipped" and the status read just before it says a unit is installed, t3 service restart now prints the message t3 up already uses for the same outcome: "The installed service runs another T3 home, so it was not restarted. Pass its --base-dir." It still prints "not installed" when no unit exists. The exit code is unchanged, the same as the t3 up sibling.

Scope and approval

Very small, focused fix for an obvious bug, so no prior issue: one command printed a false state for an outcome its sibling (t3 up) already reports correctly. The fix changes 3 lines in service.ts and adds one table test.

Overlap search: the local PR index plus REST searches for "service restart", "runs another T3 home", and "service is not installed". The closest match is open #23878, which handles another home's service in t3 service status and t3 service install. It doesn't touch t3 service restart (I checked its service.ts patch). #14361, #25924, #28565, and #25237 change how restart works, not this message.

Verification

  • Red on main: vp test run src/cli/service.test.ts → restart explains why it skipped another home's service: Expected: "runs another T3 home", Received: "T3 Code service is not installed."
  • Green: vp test run src/cli/service.test.ts → 10 passed (10), rerun after rebasing onto the latest main.
  • CI=true vp run check:changed: format, lint, knip, typecheck, and tests all pass.
  • Not checked: a real systemd or launchd unit installed for a second home. The test stubs BootService the same way the existing service command tests do.

Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

… not installed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 3, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at df4b27c

Macroscope's review found this PR approvable — The restart command now explains when an installed service belongs to another T3 home instead of reporting it as absent. This changes diagnostic text only; restart behavior and home isolation remain unchanged.

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

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The service restart command now distinguishes three unsuccessful restart cases. It gives next steps when an installed service has an unknown T3 home or uses another T3 home. Tests check the output for all three cases.

Changes: Restart messaging

Layer / File(s) Summary
Handle skipped restart outcomes
apps/server/src/cli/service.ts, apps/server/src/cli/service.test.ts
The command reports separate messages when an installed service has an unknown T3 home, uses another T3 home, or is not installed. Tests cover the messages, and the test helper accepts the skipped outcome.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • Issue 23858 describes the foreign---base-dir restart condition. This change clarifies the restart refusal; the issue’s separate service install problem is not addressed.

Suggested reviewers: rookmate, juliusmarminge

Merge Risk: Minimal · up to a9c8e

Skipped restarts now report their reason. No merge-blocking issue is established.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly identifies the CLI command and the incorrect message it fixes.
Description check Passed The description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the bug, fix, scope rationale, tests, observed results, and unverified scenarios.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.1)

ast-grep could not parse rule config: /ast-grep-rules/ast-grep-essentials/rules/java/security/ignore-saml-comment.yml

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between df4b27c and a9c8ec8.

Files selected for processing: 2
  • apps/server/src/cli/service.test.ts
  • apps/server/src/cli/service.ts

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

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread apps/server/src/cli/service.ts Resolved
@maria-rcks

maria-rcks commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

reproduced on github/main 61c3794c32 in a separate installed worktree. installed a real Linux systemd user service through t3 service install --base-dir /home/user/service-home. restarting from another home printed "T3 Code service is not installed." while the unit remained active.

on the original pr head, both --base-dir and T3CODE_HOME correctly reported another home. the unit hash, pid, and start timestamp stayed unchanged. a neighboring case exposed the existing review finding: a unit without readable T3CODE_HOME incorrectly recommended passing --base-dir. fixed in a9c8ec835f, with a failing-then-passing row in the existing test table.

re-verified the repaired cli against the real unit:

  • foreign home: correct message, exit 0, no service restart or unit rewrite.
  • unknown installed home: identifies the unreadable home and unit path, exit 0, no restart.
  • correct home: restart succeeds; systemd pid changes from 21223 to 30451.
  • no installed unit: still reports "not installed", exit 0.

started one dev server at a time, using isolated data. used repo Playwright with system Chrome to add a real git project and create threads through the web client. real Codex gpt-6.1-sol turns completed on main and the repaired head. on the repaired head, the provider ran the actual restart cli, read README.md, and returned the expected output. reloading the client retained the conversation.

vp run check:changed e0f69e9ea4cb550cb8a395ccc8096d387783b577 passed through blacksmith: formatting, lint, knip, graphql, affected typechecks, and 12 tests. new-head GitHub CI was pending when this evidence was recorded.

command transcript

real Codex turn returns the foreign-home restart message

real web client and Codex execute the restart command

Not verified

macOS launchd, Windows, native desktop and iOS/Android clients, relay/tunnel connections, and a restart queued from inside the installed service were not exercised on this Linux VM. the installed service runtime is the released t3@0.1.6; the restart commands and dev web/server came from the checked-out source. other providers were not exercised because this change is in the provider-independent cli message.

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

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants