Skip to content

fix(cli): default update policy to notify - #3

Open
Dextheking1 wants to merge 1 commit into
localhost8083:mars-desktopfrom
Dextheking1:updater-notify-default
Open

Dextheking1 wants to merge 1 commit into
localhost8083:mars-desktopfrom
Dextheking1:updater-notify-default

Conversation

@Dextheking1

@Dextheking1 Dextheking1 commented Oct 23, 2026 •

Copy link
Copy Markdown

Issue for this PR

No linked issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

updater readPolicy falls back to "auto" when no config file sets a policy. run() treats anything except "notify" as install now, so a fresh install downloads and installs the newest @mars_ai/marscli in the background, no prompt.

Upstream defaulted to "notify" here. This restores that. An explicit policy in config is still respected, only the fallback changes.

The CLI holds the user's API key. With the auto fallback, one bad publish replaces the binary on every default install before anyone sees it.

How did you verify your code works?

Verified: one word change. "notify" is already a valid policy value in this file (decodePolicy accepts it, run() handles it). Patched updater.ts transpiles clean with bun build.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Summary by Sourcery

Bug Fixes:

  • Default the CLI updater policy to notify users instead of automatically installing updates when no policy is configured.

readPolicy fell back to auto when no config set a policy, so a
fresh install silently installed new builds. Upstream defaulted
to notify. An explicit policy in config is still respected.
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Changes the updater’s no-config fallback from automatic installation to notification, preventing fresh CLI installs from silently replacing the binary while leaving explicit update policies unchanged.

Flow diagram for the updater default policy

flowchart TD
    A["Updater reads configured policy"] --> B{Policy configured?}
    B -->|Yes| C["Use explicit policy"]
    B -->|No| D["Fallback to notify"]
    C --> E{Policy is notify?}
    D --> E
    E -->|Yes| F["Notify about update"]
    E -->|No| G["Follow selected installation policy"]
Loading

File-Level Changes

Change Details Files
Restore the updater’s default policy to notify-only behavior when no configured policy is present.
  • Change the fallback policy from "auto" to "notify" while preserving explicit configuration values.
  • Rely on the existing policy decoder and runtime handling for notification behavior.
packages/cli/src/services/updater.ts

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

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No issue referenced. Please add Closes #<number> linking to the relevant issue.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="packages/cli/src/services/updater.ts" line_range="179" />
<code_context>
       ),
     )
-    return values.findLast((value) => value !== undefined) ?? "auto"
+    return values.findLast((value) => value !== undefined) ?? "notify"
   })

</code_context>
<issue_to_address>
**Unset updates are not installed**

When no config file sets an update policy, `readPolicy` defaults to `notify`, so `run()` reports an available update without installing it, contradicting the guide’s promise that updates download automatically at startup.

Restore `auto` as the unset-policy default so startup updates are installed as the guide promises.
</issue_to_address>

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

),
)
return values.findLast((value) => value !== undefined) ?? "auto"
return values.findLast((value) => value !== undefined) ?? "notify"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ Low · Unset updates are not installed

When no config file sets an update policy, readPolicy defaults to notify, so run() reports an available update without installing it, contradicting the guide’s promise that updates download automatically at startup.

Restore auto as the unset-policy default so startup updates are installed as the guide promises.

Prompt for AI agents
In `packages/cli/src/services/updater.ts` at line 179:

**Unset updates are not installed**

When no config file sets an update policy, `readPolicy` defaults to `notify`, so `run()` reports an available update without installing it, contradicting the guide’s promise that updates download automatically at startup.

Restore `auto` as the unset-policy default so startup updates are installed as the guide promises.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant