Skip to content

fix(doctor): use gateway health status for memory search key check#22327

Merged
gumadeiras merged 3 commits intoopenclaw:mainfrom
therk:fix/issue-18062-doctor-gemini-key-check
Feb 23, 2026
Merged

fix(doctor): use gateway health status for memory search key check#22327
gumadeiras merged 3 commits intoopenclaw:mainfrom
therk:fix/issue-18062-doctor-gemini-key-check

Conversation

@therk
Copy link
Contributor

@therk therk commented Feb 21, 2026

Fixes #18062

Problem

openclaw doctor falsely warned about a missing Gemini API key even when memory search was fully functional. The key is loaded into the gateway process env via sops at startup, but noteMemorySearchHealth ran a static check against the CLI process env — which never has those secrets.

Additionally, the suggested fix (openclaw auth add --provider gemini) referenced a command that does not exist.

Changes

src/commands/doctor-memory-search.ts

  • Added opts?: { gatewayHealthOk?: boolean } parameter
  • When gatewayHealthOk: true and static key check fails, shows a softer informational note instead of an error: "The key may be loaded by the running gateway (e.g. via secrets.env). Verify: openclaw memory status --deep"
  • Replaced all instances of openclaw auth add --provider <X> with openclaw configure (the correct command)

src/commands/doctor.ts

  • Moved noteMemorySearchHealth call to run after checkGatewayHealth so gateway status is known
  • Passes { gatewayHealthOk: healthOk } to the health check

src/commands/doctor-memory-search.test.ts

  • Updated existing call signatures to match new optional parameter
  • Added test: gateway healthy + no CLI key → soft note with "may be loaded by the running gateway"
  • Added test: gateway down + no CLI key → full warning with openclaw configure (not auth add)
  • Preserved upstream mistral auth test; switched mockClearmockReset with default rejection for test isolation

AI-assisted disclosure 🤖

  • Built with Claude (Sonnet 4.6) via OpenClaw
  • Lightly tested — ran doctor-memory-search.test.ts (8/8 pass) and pnpm build locally; full pnpm test not run
  • Author understands what the code does and reviewed all changes

@openclaw-barnacle openclaw-barnacle bot added commands Command implementations size: S labels Feb 21, 2026
@therk therk force-pushed the fix/issue-18062-doctor-gemini-key-check branch from cbd97fb to 90e83a5 Compare February 21, 2026 01:59
@therk
Copy link
Contributor Author

therk commented Feb 21, 2026

The initial CI failure was not caused by this PR. Our 3 changed files (doctor-memory-search.ts, doctor-memory-search.test.ts, doctor.ts) all passed — 7/7 tests green in both bun and node runners.

The failing tests (web/media, discord/send.components, media-understanding, msteams) were already broken on the upstream commit this branch was based on (105a630), and were subsequently fixed in main. Rebased onto latest main — CI should be clean now.

@therk
Copy link
Contributor Author

therk commented Feb 21, 2026

Re-checked CI: the 3 failing test jobs (checks (node, test), checks (bun, test), checks-windows (node, test)) are pre-existing failures unrelated to this PR. They all fail on src/web/media.test.ts with a Windows temp path issue (LocalMediaAccessError: Local media path is not under an allowed directory: C:\Users\RUNNER~1\...) — a short-path resolution bug in assertLocalMediaAllowed that exists on main independently of these changes.

@therk therk force-pushed the fix/issue-18062-doctor-gemini-key-check branch from 90e83a5 to 99d09af Compare February 23, 2026 16:13
@therk
Copy link
Contributor Author

therk commented Feb 23, 2026

Rebased on current main.

Conflict resolution: upstream added voyage/mistral to the provider list in the auto-mode fallback message and a mistral auth test — both preserved. Our changes (openclaw configure fix, mockReset with default rejection, gateway health tests) merged cleanly on top.

All 8 doctor-memory-search tests passing locally. CI running.

@therk
Copy link
Contributor Author

therk commented Feb 23, 2026

Hi @gumadeiras — friendly ping! Just rebased on current main (conflict resolution: preserved upstream's voyage/mistral additions + mistral auth test). CI re-running. Small focused fix for a false-positive openclaw doctor warning when keys are loaded via gateway sops. Happy to address any feedback.

@therk
Copy link
Contributor Author

therk commented Feb 23, 2026

Heads up on overlapping PRs: Found a few open PRs that touch the same file for the same auth add issue (#24220): #24470 (openclaw configure) and #24266 (openclaw onboard), plus #24485 which also modifies doctor-memory-search.ts.

To clarify scope: the auth add → configure replacement in this PR is a secondary fix bundled with the main change. The core of this PR (fixing #18062) is the gateway health status check — making noteMemorySearchHealth aware of whether the gateway is healthy before deciding to warn or not. That logic is not present in any of the overlapping PRs.

Happy to drop the auth add fixup from this PR if the maintainers prefer it land via one of those dedicated PRs — the gateway health logic stands on its own either way.

@gumadeiras
Copy link
Member

@therk yea please keep one issue per PR; can you drop anything unrelated to the gateway health please; then i'll take a look
if you could also share a screenshot of the error that would be great

@therk
Copy link
Contributor Author

therk commented Feb 23, 2026

✅ CI fully green — all checks passing after rebase.

@gumadeiras gumadeiras self-assigned this Feb 23, 2026
@gumadeiras gumadeiras force-pushed the fix/issue-18062-doctor-gemini-key-check branch from 99d09af to b962e64 Compare February 23, 2026 18:43
@openclaw-barnacle openclaw-barnacle bot added gateway Gateway runtime size: M and removed size: S labels Feb 23, 2026
@gumadeiras gumadeiras force-pushed the fix/issue-18062-doctor-gemini-key-check branch from b962e64 to e0204fb Compare February 23, 2026 18:44
@gumadeiras gumadeiras force-pushed the fix/issue-18062-doctor-gemini-key-check branch from e0204fb to 2f02ec9 Compare February 23, 2026 19:06
@gumadeiras gumadeiras merged commit 8d69251 into openclaw:main Feb 23, 2026
7 checks passed
@gumadeiras
Copy link
Member

Merged via squash.

Thanks @therk!

iamjulio pushed a commit to NeuroGym-Dev/openclaw that referenced this pull request Feb 23, 2026
* upstream/main: (1467 commits)
  fix(doctor): use gateway health status for memory search key check (openclaw#22327)
  refactor: harden reset notice + cron delivery target flow
  refactor(exec): simplify env-prefixed wrapper modifier check
  fix(skills): support multiline frontmatter fallback without PyYAML
  fix(skills): make quick_validate work without PyYAML
  fix(exec): bind env-prefixed shell wrappers to full approval text
  fix(browser): derive relay auth token from gateway token in Chrome extension
  Browser relay: accept raw gateway token in extension auth
  fix(gateway): include platform and reason in node command rejection error
  CLI: fix gateway restart health ownership for child listener pids (openclaw#24696)
  docs: detail per-agent prompt caching configuration
  fix(config): tighten bedrock cache-retention type narrowing
  feat(agents): add per-agent stream params overrides for cache tuning (openclaw#17470) (thanks @rrenamed)
  fix(providers): support Bedrock Anthropic cacheRetention defaults/pass-through (openclaw#22303) (thanks @snese)
  fix(providers): disable Bedrock prompt caching for non-Anthropic models (openclaw#20866) (thanks @pierreeurope)
  docs(changelog): note /new and /reset auth-label removal (openclaw#24409)
  fix(reply): omit auth labels in /new and /reset
  docs(changelog): correct kimi issue references
  test(tools): fix kimi web_search mock typing
  feat(media): add moonshot video provider and wiring
  ...

# Conflicts:
#	ui/src/ui/app-render.ts
#	ui/src/ui/controllers/agents.ts
carlosrivera pushed a commit to myascendai/meshiclaw that referenced this pull request Feb 23, 2026
…penclaw#22327)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 2f02ec9
Co-authored-by: therk <901920+therk@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
…penclaw#22327)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 2f02ec9
Co-authored-by: therk <901920+therk@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
plgs2005 pushed a commit to plgs2005/openclaw that referenced this pull request Feb 24, 2026
…penclaw#22327)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 2f02ec9
Co-authored-by: therk <901920+therk@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
plgs2005 pushed a commit to plgs2005/openclaw that referenced this pull request Feb 24, 2026
…penclaw#22327)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 2f02ec9
Co-authored-by: therk <901920+therk@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
margulans pushed a commit to margulans/Neiron-AI-assistant that referenced this pull request Feb 25, 2026
…penclaw#22327)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 2f02ec9
Co-authored-by: therk <901920+therk@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
brianleach pushed a commit to brianleach/openclaw that referenced this pull request Feb 26, 2026
…penclaw#22327)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 2f02ec9
Co-authored-by: therk <901920+therk@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 26, 2026
…penclaw#22327)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 2f02ec9
Co-authored-by: therk <901920+therk@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
…penclaw#22327)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 2f02ec9
Co-authored-by: therk <901920+therk@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…penclaw#22327)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 2f02ec9
Co-authored-by: therk <901920+therk@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations gateway Gateway runtime size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doctor: Gemini API key check should use gateway memory-status instead of direct env lookup

2 participants