Skip to content

fix: avoid error messages when service condition checks fail#189

Merged
yixinshark merged 1 commit intolinuxdeepin:masterfrom
yixinshark:fix-avoidreporterror
Feb 4, 2026
Merged

fix: avoid error messages when service condition checks fail#189
yixinshark merged 1 commit intolinuxdeepin:masterfrom
yixinshark:fix-avoidreporterror

Conversation

@yixinshark
Copy link
Contributor

@yixinshark yixinshark commented Feb 4, 2026

Use ConditionEnvironment instead of ExecCondition for environment variable checks. This prevents the service from being marked as failed when the condition is not met.

Changes:

  • Add ConditionEnvironment=DDE_QUICKLOGIN=true to [Unit] section
  • Add ConditionEnvironment=XDG_SESSION_TYPE=%I to [Unit] section
  • Remove ExecCondition shell script checks
  • Apply the same fix to dde-version-checker@quick-login.service

This resolves the issue where systemd would report 'Failed to start' error messages when the quick login conditions were not satisfied, which could also trigger unwanted restart loops.

Log: avoid error messages when service condition checks fail
Pms: BUG-349919

Summary by Sourcery

Bug Fixes:

  • Avoid erroneous 'Failed to start' statuses and potential restart loops when quick login conditions for dde-quick-login@x11 and dde-version-checker@quick-login services are not met.

Use ConditionEnvironment instead of ExecCondition for environment
variable checks. This prevents the service from being marked as failed
when the condition is not met.

Changes:
- Add ConditionEnvironment=DDE_QUICKLOGIN=true to [Unit] section
- Add ConditionEnvironment=XDG_SESSION_TYPE=%I to [Unit] section
- Remove ExecCondition shell script checks
- Apply the same fix to dde-version-checker@quick-login.service

This resolves the issue where systemd would report 'Failed to start'
error messages when the quick login conditions were not satisfied,
which could also trigger unwanted restart loops.

Log: avoid error messages when service condition checks fail
Pms: BUG-349919
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 4, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Replaces ExecCondition-based shell checks with systemd ConditionEnvironment expressions in dde quick-login related services so that unmet conditions skip starting without marking the service as failed or causing restart loops.

File-Level Changes

Change Details Files
Switch quick-login service environment checks from ExecCondition shell scripts to ConditionEnvironment so unmet conditions no longer mark the service as failed.
  • Add ConditionEnvironment=DDE_QUICKLOGIN=true to the [Unit] section to gate service start on the quick-login flag.
  • Add ConditionEnvironment=XDG_SESSION_TYPE=%I to the [Unit] section to match the session type to the instantiated unit argument (e.g., x11).
  • Remove ExecCondition shell script environment checks that previously exited non-zero when conditions were not satisfied, which caused systemd to treat the unit as failed.
systemd/dde-session-pre.target.wants/dde-quick-login@x11.service
Apply the same ConditionEnvironment-based gating logic to the version checker quick-login service to avoid spurious failure and restart loops.
  • Add ConditionEnvironment=DDE_QUICKLOGIN=true to require the quick-login flag before starting the version checker quick-login service.
  • Add ConditionEnvironment=XDG_SESSION_TYPE=%I to align start conditions with the session type instance name.
  • Remove ExecCondition shell script checks and rely solely on systemd native conditions for environment-based gating.
tools/dde-version-checker/dde-version-checker@quick-login.service

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Using ConditionEnvironment= means systemd will check the manager environment, not the service’s runtime environment, so please double-check that DDE_QUICKLOGIN and XDG_SESSION_TYPE are actually exported into PID 1’s environment (or provided via an EnvironmentFile=/systemd-environment-d-generator) rather than only being set in user shells.
  • Since you’ve duplicated similar ConditionEnvironment logic across multiple units, consider factoring the common conditions into a shared drop-in or template pattern to keep the configuration consistent and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using `ConditionEnvironment=` means systemd will check the manager environment, not the service’s runtime environment, so please double-check that `DDE_QUICKLOGIN` and `XDG_SESSION_TYPE` are actually exported into PID 1’s environment (or provided via an `EnvironmentFile=`/`systemd-environment-d-generator`) rather than only being set in user shells.
- Since you’ve duplicated similar `ConditionEnvironment` logic across multiple units, consider factoring the common conditions into a shared drop-in or template pattern to keep the configuration consistent and easier to maintain.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fly602, yixinshark

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yixinshark yixinshark merged commit 6a97618 into linuxdeepin:master Feb 4, 2026
13 of 14 checks passed
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.

3 participants