Skip to content

fix: harden doctor gemini and wal checks - #24033

Open
Inchesdeep wants to merge 1 commit into
NousResearch:mainfrom
Inchesdeep:fix/doctor-gemini-wal-hardening
Open

fix: harden doctor gemini and wal checks#24033
Inchesdeep wants to merge 1 commit into
NousResearch:mainfrom
Inchesdeep:fix/doctor-gemini-wal-hardening

Conversation

@Inchesdeep

Copy link
Copy Markdown

Summary

  • fix the doctor Gemini native API probe to use x-goog-api-key instead of generic Bearer auth
  • switch hermes doctor --fix WAL cleanup from wal_checkpoint(PASSIVE) to wal_checkpoint(TRUNCATE)
  • report incomplete WAL cleanup honestly when the WAL remains large after checkpoint
  • add regression tests covering both the Gemini probe and WAL checkpoint behavior

Why

hermes doctor was producing a false negative for valid Gemini API keys because the native Gemini /v1beta/models endpoint does not use Bearer auth. Separately, doctor could claim it fixed a large SQLite WAL file even when the file size did not materially shrink.

Evidence

  • direct Gemini API probe to https://generativelanguage.googleapis.com/v1beta/models returned HTTP 200 with the configured key
  • local doctor output now shows ✓ gemini
  • targeted test suite passes: scripts/run_tests.sh tests/hermes_cli/test_doctor.py -q

Verification

  • hermes doctor
  • scripts/run_tests.sh tests/hermes_cli/test_doctor.py -q
  • git diff --check

Notes

This PR comes from a fork because direct push permission to NousResearch/hermes-agent was not available from this machine.

- use x-goog-api-key for Gemini native /models probing
- use wal_checkpoint(TRUNCATE) for doctor --fix
- report incomplete WAL cleanup honestly
- add regression coverage for Gemini probe and WAL checkpoint behavior
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard provider/gemini Google Gemini (AI Studio, Cloud Code) duplicate This issue or pull request already exists labels May 11, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #24030 (same fix, already closed/merged). This PR has the identical title and addresses the same zoneinfo.ZoneInfo.utcoffset(None) regression from #23981.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the WAL diagnosis and regression coverage.

Problems

  • The Gemini hunk is already superseded: current main commit 364a1dd290245093f76837c6074bb7d4fdc798c6 implements the probe at hermes_cli/doctor.py:1928-1937, using the resolved generativelanguage.googleapis.com host. The proposed provider-name-only branch at hermes_cli/doctor.py:1371 is less precise than that current behavior.
  • The WAL premise remains live: current hermes_cli/doctor.py:1332-1339 still runs wal_checkpoint(PASSIVE) and reports success unconditionally.

Suggested changes

  • Salvage the WAL TRUNCATE and incomplete-cleanup reporting against the current doctor implementation.
  • Adapt the Gemini regression test to the current URL-host-based behavior; do not restore the stale provider-name branch.

Automated hermes-sweeper review.

Comment thread hermes_cli/doctor.py
@@ -1359,10 +1370,14 @@ def _probe_apikey_provider(pname, env_vars, default_url, base_env,
if base_url_host_matches(base, "api.kimi.com") and base.rstrip("/").endswith("/coding"):
base = base.rstrip("/") + "/v1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please do not key this solely on pname. Current main already implements the Gemini fix by matching the resolved URL host (hermes_cli/doctor.py:1934-1936), which is more precise; retain that approach when salvaging the WAL portion.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users area/install-update Installer, updater, packaging, wheels, doctor labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have provider/gemini Google Gemini (AI Studio, Cloud Code) sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants