Skip to content

Add invocation flag to disable the auto-updater per-run #182

@WiggidyW

Description

@WiggidyW

Today the only way to disable the auto-updater for a single binary invocation is to set the OBJECTIVEAI_SKIP_UPDATE env var. Add a native CLI flag so it's discoverable via --help and doesn't require shell-env wrapping.

Scope

All four binaries that link the shared updater carry the updater feature:

  • objectiveai-cli (objectiveai-cli/src/main.rs)
  • objectiveai-api (objectiveai-api/src/main.rs)
  • objectiveai-mcp (objectiveai-mcp-cli/src/main.rs)
  • objectiveai-viewer (objectiveai-viewer/src-tauri/src/main.rs)

Each calls objectiveai_sdk::updater::maybe_auto_update(...) from within a #[cfg(feature = "updater")] block. The check that gates execution today lives in objectiveai-sdk-rs/src/updater.rs::imp::run:

if std::env::var_os(SKIP_ENV_VAR).is_some() {
    emit_notification(
        config.handle.as_ref(),
        Updater::Skipped { reason: SkipReason::OptedOut },
    ).await;
    return Ok(());
}

Suggested approach

  1. Add a flag — --no-update (or --skip-update) — at the binary level. Recognized BEFORE the binary's own argument parsing (or as a global pre-parse step) so the updater check sees it before any per-binary handling kicks in.
  2. When set, short-circuit the call to maybe_auto_update entirely (skip the function call rather than going through the env-var check). Emits the same Skipped { reason: OptedOut } notification so consumers see consistent JSONL.
  3. Keep the env var as the secondary path; the flag is for discoverability + scripting ergonomics. (Same precedence rule as the parallel issue Promote all env vars to clap arguments across cli / api / mcp / viewer #181: CLI > env.)
  4. Pre-parse implementation: scan args for the flag before passing it through to clap. Strip it from argv so downstream parsers don't see it.

Why

  • --help discoverability — currently the only way to learn about the opt-out is by reading source.
  • Test ergonomics — every integration test wanting a stable update behavior currently sets OBJECTIVEAI_SKIP_UPDATE=1 in the environment.
  • Symmetric with the existing OBJECTIVEAI_SKIP_UPDATE env var which is set by the re-exec'd child to break update loops.

Cross-binary interaction

The CLI's update-check fires self-update for the CLI; api/mcp/viewer have their own. A --no-update flag passed to the CLI does not affect api/mcp/viewer if launched separately. Each binary owns its own flag. No cross-binary fan-out.

Out of scope

  • Removing the env var (stays as the secondary source).
  • Changing the updater's behavior in any other way.
  • Modifying the per-binary marker file scheme.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions