Skip to content

feat: auto-update check via built-in scheduler task #588

@bug-ops

Description

@bug-ops

Summary

Add automatic periodic update checking as a built-in scheduler task. Zeph queries GitHub Releases API for the latest version and notifies the user when a newer version is available.

Motivation

Users running long-lived Zeph instances (daemon mode, TUI) have no way to know a new release is available without manually checking. An opt-out periodic check solves this with minimal overhead.

Design

New TaskKind variant

Add TaskKind::UpdateCheck to zeph-scheduler alongside existing MemoryCleanup, SkillRefresh, HealthCheck.

Config

New section in config.toml under [agent] or as a dedicated table:

[agent]
auto_update_check = true  # default: true, set false to disable

[scheduler.tasks.update_check]
enabled = true
cron = "0 0 */6 * * *"  # every 6 hours, configurable

Environment override: ZEPH_AUTO_UPDATE_CHECK=false.

Implementation

  1. Version check logic (in zeph-core):

    • GET https://api.github.com/repos/bug-ops/zeph/releases/latest via reqwest
    • Parse tag_name field, strip v prefix, compare with env!("CARGO_PKG_VERSION") using semver crate
    • Return Option<NewRelease { current, latest, url }> if newer version found
  2. UpdateCheckHandler implementing TaskHandler trait:

    • Calls version check logic
    • On new version: logs info! message + sends notification to active channel (if available)
    • On same/older version or network error: logs debug!, does not notify user
    • Respects rate limiting (GitHub API: 60 req/h unauthenticated)
  3. Registration in bootstrap:

    • When scheduler feature is enabled, register UpdateCheckHandler as a built-in task
    • Skip registration if auto_update_check = false
  4. Notification format (channel message):

    New Zeph release available: v0.12.0 (current: v0.11.0)
    https://github.com/bug-ops/zeph/releases/tag/v0.12.0
    

What this does NOT do

Dependencies

  • semver crate (workspace dependency, add if not present)
  • Existing: reqwest, serde, tracing
  • Feature: scheduler (already optional)

Acceptance Criteria

  • TaskKind::UpdateCheck variant added
  • UpdateCheckHandler implements TaskHandler
  • Config field auto_update_check (default true) + env override
  • Scheduler task registered on bootstrap when enabled
  • Notification sent to active channel on new release
  • Graceful handling: network errors logged at debug, no user-facing noise
  • Unit tests for version comparison logic
  • --init wizard updated with auto-update option

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions