The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
update
Self-update domain for the openhuman-core binary. Checks GitHub Releases (tinyhumansai/openhuman, "latest" endpoint) for a newer build of the platform-appropriate core binary, downloads + atomically stages it next to the running executable, and (depending on the configured restart strategy) publishes a self-restart so the Tauri shell/supervisor can swap it in. Also exposes a cheap no-network version probe and a periodic background checker. Network failures are classified so transient transport/HTTP problems don't spam Sentry.
Responsibilities
- Query the GitHub Releases "latest" API and compare semver-ish tags against the compiled
CARGO_PKG_VERSION(is_newer). - Select the release asset matching this platform's target triple (
openhuman-core-{triple},.exeon Windows). Releases publish core archives for Linux only, so a newer release with no asset for this triple is reported as available with nodownload_url(logged at warn, not an error). - Download the asset to a temp file, set
0o755on Unix, and atomically rename it into the staging dir (current-exe dir by default). - Orchestrate the full
check → apply → restartflow (update_run), publishing a service restart for theSelfReplacestrategy or staging-only forSupervisor. - Run a periodic background checker (default 1h, floor 10 min) that logs availability and emits health events.
- Enforce a fail-closed mutation policy (
config.update.rpc_mutations_enabled) and validate download URLs / asset names at the RPC boundary. - Filter transient network/HTTP failures away from Sentry while keeping local
warndiagnostics.
Key files
| File | Role |
|---|---|
crates/openhuman-core/src/platform/update/mod.rs |
Export-focused. pub use core::*, pub use ops as rpc, pub use types::*, and the all_update_controller_schemas / all_update_registered_controllers re-exports. |
crates/openhuman-core/src/platform/update/core.rs |
Core logic: current_version, platform_triple, check_available (GitHub fetch + parse), download_and_stage[_with_version] (atomic staging), asset selection, semver compare, transport-failure classifier. |
crates/openhuman-core/src/platform/update/ops.rs |
RPC handlers (update_version/update_check/update_apply/update_run), mutation-policy enforcement, URL/asset-name validation, and UpdateRunResult builders per restart strategy. Aliased as update::rpc. |
crates/openhuman-core/src/platform/update/scheduler.rs |
run(UpdateConfig) periodic checker loop + tick(); publishes startup/health events. Floor MIN_INTERVAL_MINUTES = 10. |
crates/openhuman-core/src/platform/update/schemas.rs |
Controller registry: all_controller_schemas, all_registered_controllers, schemas(fn), and handle_* thunks delegating to ops. |
crates/openhuman-core/src/platform/update/types.rs |
Serde types: UpdateInfo, VersionInfo, UpdateRunResult, UpdateApplyResult, GitHubRelease, GitHubAsset. |
crates/openhuman-core/src/platform/update/tools.rs |
Agent tools for checking and applying updates, registered by tools/ops.rs. |
crates/openhuman-core/src/platform/update/*_tests.rs |
Sibling test suites (core_tests, ops_tests, ops_tests_2_tests, scheduler_tests, schemas_tests, tools_tests), included via #[path]. |
Public surface
- Types (
types.rs):UpdateInfo,VersionInfo,UpdateRunResult,UpdateApplyResult,GitHubRelease,GitHubAsset. - Core fns (
core.rs, re-exported viacore::*):current_version() -> &'static str,platform_triple() -> &'static str,check_available() -> Result<UpdateInfo, String>,download_and_stage(...),download_and_stage_with_version(...). update::rpc(alias ofops):update_version,update_check,update_apply,update_run: all returningOutcome<Value>.update::scheduler::run(UpdateConfig): background loop entry point.all_update_controller_schemas()/all_update_registered_controllers().
RPC / controllers
All under namespace update (i.e. openhuman.update_*):
| Method | Inputs | Output |
|---|---|---|
update.version |
none | version_info (VersionInfo): cheap, no network. |
update.check |
none | update_info (UpdateInfo). |
update.apply |
download_url (req), asset_name (req), staging_dir (optional, ignored: always default dir) |
apply_result (UpdateApplyResult). |
update.run |
none | run_result (UpdateRunResult): orchestrated check→stage→restart. |
apply and run are gated by enforce_update_mutation_policy (fail-closed if config can't load) and re-validate the URL (must be HTTPS GitHub host) and asset name (must start openhuman-core-, no path separators / ..).
Agent tools
The domain owns two agent tools in tools.rs: update_check (read-only, calls update::rpc::update_check) and update_apply (calls update::rpc::update_run). Their model-facing names and behavior remain stable.
Events
No bus.rs. The scheduler publishes (via crate::core::bus::BUS.publish):
DomainEvent::SystemStartup { component: "update_checker" }at startup.DomainEvent::HealthChanged { component: "update_checker", healthy, message }after each tick.
It also calls crate::core::bus::init() (idempotent against an already-initialised bus) and health::bus::register_health_subscriber() on start.
Persistence
None. No store.rs: staged binaries are written to the filesystem (current-exe dir by default), but the domain holds no persisted state of its own. Configuration is read from config.update.
Dependencies
crate::config: readsUpdateConfig(enabled,interval_minutes,rpc_mutations_enabled,restart_strategy) andUpdateRestartStrategy;opsloads it viaconfig::rpc::load_config_with_timeout.crate::platform::service:service::rpc::service_restartto publish the self-restart forSelfReplace.crate::platform::health:health::bus::register_health_subscriberin the scheduler.crate::util:utf8_safe_prefix_at_byte_boundaryfor safe error-body truncation.crate::core::bus:BUS.publish,crate::core::events::DomainEvent, andbus::init()to bring up the in-process broker.crate::core::observability: Sentry reporting + transient-failure classifiers (report_error,is_updater_transient_message,is_updater_transient_http_status).crate::core::all:ControllerFuture,RegisteredController(schemas wiring);crate::core::{ControllerSchema, FieldSchema, TypeSchema}.crate::core::Outcome: RPC return contract.- External crates:
reqwest(HTTP),url(URL validation),serde/serde_json,tokio.
Used by
crates/openhuman-core/src/core/all.rs: registersall_update_registered_controllers()/all_update_controller_schemas()into the controller registry.crates/openhuman-core/src/core/runtime/services.rs: spawnsupdate::scheduler::run(config.update)as a background service at core start whenServiceSet::update_scheduleris set (the desktop shell turns it off inhost::desktop_builderbecause it updates through the Tauri updater;ServiceSet::desktop()itself leaves it on).crates/openhuman-core/src/platform/update/tools.rs: agent tools wrapping the RPC layer.
Notes / gotchas
staging_diris intentionally ignored byupdate_apply: it always uses the safe default (current-exe parent dir) regardless of caller input, for security.- Fail-closed policy: if
config.update.rpc_mutations_enabledis false (or config fails to load)apply/runare rejected;check/versionremain available. - Restart strategies (
UpdateRestartStrategy):SelfReplacepublishes aservice_restart(process exits shortly after the RPC returns;restart_requestedreflects whether the publish succeeded);Supervisorstages only and expects an external supervisor to restart. - Scheduler interval floor: requested
interval_minutesis clamped up toMIN_INTERVAL_MINUTES = 10to avoid GitHub unauthenticated rate-limits; the first check runs immediately. - Version compare (
is_newer) is dot-split numeric withv-prefix stripping: not full semver (no pre-release/build metadata handling). - Sentry hygiene: transport-level reqwest failures (
is_connect/is_timeout/is_request) and transient HTTP statuses are logged atwarnand skipped fromreport_error; a regression guard test hits an unroutable TEST-NET-1 host to lock the classifier. - Test env locking: tests touching
update_applytakeconfig::TEST_ENV_LOCKbecause the mutation policy is resolved through the process-globalOPENHUMAN_WORKSPACEenv var and would otherwise race. - Network-hitting paths (
update_checksuccess,update_applysuccess, schedulertick) are deferred to integration tests, not unit-tested.