Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript
6.9 KB
Raw Blame

v0.50.0.0: coordinate authorization and worker upgrades

This release preserves existing OAuth sessions and changes how background jobs are authorized. Read the upgrade guide before upgrading a host with queued work. Perform these steps on the brain host; a thin client cannot authorize historical jobs.

  1. Prepare a stopped-service cutover. Identify every process sharing the database: HTTP ingress, scheduled producers, autopilot, supervisors, workers, and automatic upgraders. Pause schedules and ingress, stop new submissions, and let active work drain. Then stop all remaining processes. Back up the database, source repositories, and service configuration while they are stopped. Preserve the compatible application version with the backup.

    Do not run an unattended upgrade across this cutover. Do not run old workers, reapers, or supervisors against the upgraded database. If an automatic upgrade already installed this version, stop old processes before continuing.

  2. Install one matching version everywhere without starting setup phases. Source installations need Bun 1.3.11 or newer; published binaries contain their runtime. For a published binary installation, use gbrain upgrade --swap-only. For a Bun package installation, use the following version-pinned command:

    bun remove --global gbrain
    bun install --global --ignore-scripts github:garrytan/gbrain#v0.50.0.0
    

    Remove first: installing a different tag over an existing global install fails with DependencyLoop on Bun 1.3 and silently leaves the old code while corrupting the global lock on Bun 1.4 (#5034).

    For a linked source checkout, update that checkout to the chosen release through its normal Git workflow, then run bun install --ignore-scripts. A source/package gbrain upgrade --swap-only still runs Bun's installation scripts; do not use it for this cutover. Plain upgrade, post-upgrade, and apply-migrations can run pending setup phases that start autopilot or other maintenance. Keep them deferred until review is complete.

    With all services still stopped, verify the installed binary and apply only schema migrations:

    gbrain --version
    gbrain apply-migrations --force-schema --yes
    

    --force-schema returns before setup orchestrators; it does not approve queued work or bypass migration checks. Migration 149 refuses active work and leaves historical jobs without new authority. Never backfill that authority with SQL or authorize the whole queue automatically. If migration reports active jobs, keep services stopped. If the new CLI cannot inspect or cancel them because migration runs first, restore the compatible pre-upgrade application and database, resolve that work locally, and repeat the cutover. Do not restore an older worker to drain an upgraded queue.

  3. Inspect the outstanding queue locally. Review all nonterminal states: waiting, active, delayed, waiting-children, and paused. For example:

    gbrain jobs list --status waiting --limit 1000 --json
    gbrain jobs list --status delayed --limit 1000 --json
    gbrain jobs list --status waiting-children --limit 1000 --json
    gbrain jobs list --status paused --limit 1000 --json
    gbrain jobs list --status active --limit 1000 --json
    

    Increase the limit if a listing reaches it. Keep these results private: payloads and dependency previews can contain user data.

  4. Preview only selected historical jobs. Replace the example IDs with jobs the operator intends to retain:

    gbrain jobs authorize-legacy --ids 101,102 --json
    

    This is read-only. Review the original payloads, schedules, attempts, dependencies, and cancellation/failure effects with the operator. Only submission_authority IS NULL rows are eligible. Future, malformed, or JSON-null authority requires matching application/database versions or an explicit local cancellation; it cannot be converted through this command.

  5. Apply the exact reviewed selection. After the operator approves the concrete preview, replace the example IDs and digest with that preview:

    gbrain jobs authorize-legacy --ids 101,102 --expect REVIEWED_SNAPSHOT_DIGEST --yes --json
    

    Changed snapshots refuse approval. Preview and review again rather than retrying with a newly calculated digest without review. Dependencies are displayed for context and never implicitly authorized; review each needed dependency explicitly. To discard selected work instead, use the existing gbrain jobs cancel JOB_ID command after reviewing its dependency effects.

  6. Resolve every nonterminal historical job before restarting. Keep terminal history unchanged. A later local replay of an unreviewed terminal row needs the same explicit review; remote replay cannot approve it. Start only matching application and worker versions after review/cancellation is complete. If startup reports unresolved authority, stop and inspect the named class of work rather than editing the authority column.

  7. Preserve connections and update callers. Existing active-client tokens, refresh tokens, and unexpired codes remain valid. Do not purge or re-register them as part of this migration. New authorization-code connections use the admin approval page; after expiry, restart, or a changed client policy, restart the connection from the client. Review unwanted connections in Admin → Agents.

    Generic remote jobs accept only sync, import, lint, and lint-fix under the source-bound schemas in the upgrade guide. Use dedicated operations for connector work and the local host's maintenance workflow for autopilot. Update delegated-tool bindings that reference removed attachment tools; remote bindings must contain at least one permitted tool.

  8. Check runtime and import recovery. Guarded URL operations use direct connections. If they report PROXY_NOT_SUPPORTED, remove the listed proxy variables from that service environment and restart it; a NO_PROXY exception is insufficient. Do not change provider connection configuration merely to address this error.

    Frontmatter remains ordinary YAML or JSON. Fix individual malformed files reported by imports, then retry using the preserved checkpoint. Do not bulk rewrite content, reindex, or re-embed for this release.

  9. Verify before restoring schedules. Run gbrain doctor and gbrain jobs stats --json, inspect authorization/job diagnostics, and verify an existing connection still works. Restore the reviewed service schedules and automatic-upgrade policy only after every process uses the matching version and the queue is ready.

Rollback requires stopping every service and restoring compatible database and application state together. Never downgrade only the binary while leaving old workers attached to the upgraded queue.