Skip to content

feat(daemon): update service descriptors for systemd and launchctl#130

Merged
AnnatarHe merged 1 commit intomainfrom
update-service-descriptors
Oct 5, 2025
Merged

feat(daemon): update service descriptors for systemd and launchctl#130
AnnatarHe merged 1 commit intomainfrom
update-service-descriptors

Conversation

@AnnatarHe
Copy link
Copy Markdown
Contributor

Summary

  • Updated systemd service file configuration
  • Updated macOS launchctl plist configuration

Changes

  • model/sys-desc/shelltime.service - systemd service descriptor
  • model/sys-desc/xyz.shelltime.daemon.plist - macOS launchctl daemon plist

Test plan

  • Verify systemd service starts correctly on Linux
  • Verify launchctl daemon starts correctly on macOS
  • Ensure daemon runs with correct permissions and paths

🤖 Generated with Claude Code

- Update systemd service file (shelltime.service)
- Update macOS launchctl plist (xyz.shelltime.daemon.plist)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the service descriptors for the shelltime-daemon across different operating systems. The primary goal is to ensure the daemon starts with the appropriate shell environment and resource settings, improving its stability and logging capabilities on both Linux (via systemd) and macOS (via launchctl).

Highlights

  • Systemd Service Configuration: The systemd service file for shelltime-daemon has been updated to execute the daemon via a shell, include resource limits for open files, and direct standard output/error to the systemd journal.
  • macOS Launchctl Configuration: The macOS launchctl plist configuration for xyz.shelltime.daemon has been modified to ensure the daemon is launched through a login shell, which helps in setting up the correct environment.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@AnnatarHe AnnatarHe merged commit 356f6d1 into main Oct 5, 2025
2 checks passed
@AnnatarHe AnnatarHe deleted the update-service-descriptors branch October 5, 2025 08:50
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 23.28% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the systemd and launchctl service descriptors to run the daemon process within a login shell, which helps in sourcing the correct user environment. The changes for the macOS launchctl plist appear correct and follow good practices. However, the systemd service file introduces a critical issue by hardcoding the username, and it also retains a hardcoded path to the executable, which is likely incorrect. My review includes a suggestion to fix these issues by using template variables, which will require a small corresponding change in the Go installer code.

[Service]
Type=simple
ExecStart=/usr/local/bin/shelltime-daemon
ExecStart=/bin/sh -c 'exec $(getent passwd username | cut -d: -f7) -l -c "/usr/local/bin/shelltime-daemon"'
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.

critical

The ExecStart command has two issues that will prevent the service from running correctly:

  1. Hardcoded username: The username is hardcoded as username. This will cause getent passwd username to fail for any user whose login is not 'username'. This should be replaced with the template variable {{.UserName}}.

  2. Hardcoded executable path: The path to shelltime-daemon is hardcoded to /usr/local/bin/shelltime-daemon. The installer logic places the binary at a path constructed from BaseFolder. This path should also be templated, e.g., {{.BaseFolder}}/bin/shelltime-daemon, just like in the macOS .plist file.

Fixing this will also require updating model/daemon-installer.linux.go to pass the BaseFolder variable to the template.

ExecStart=/bin/sh -c 'exec $(getent passwd {{.UserName}} | cut -d: -f7) -l -c "{{.BaseFolder}}/bin/shelltime-daemon"'

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant