Skip to content

umbrella: OpenClaw/Codex auth support for GBrain providers #544

@100yenadmin

Description

@100yenadmin

TL;DR

GBrain should support host-provided credential sources for providers without making any one host a hard dependency. The active path should build on the current recipe/auth architecture and #698 rather than the stale resolver PR: core provider recipes stay provider-neutral; host adapters translate OpenClaw/Codex/Hermes/etc. auth state into an explicit credential source without leaking tokens into tool payloads, logs, or generated context.

flowchart LR
  Host["agent host\nOpenClaw / Codex / Hermes / Claude Code"] --> Auth["host-owned auth/profile/OAuth"]
  Auth --> Adapter["GBrain host adapter"]
  Adapter --> Resolver["credential-source resolver"]
  Resolver --> Recipe["Recipe.resolveAuth / provider recipe"]
  Recipe --> Provider["OpenAI / Voyage / Gemini / local provider"]
Loading

Why This Matters

Users often already authenticated inside their agent host. Requiring every GBrain install to also collect and store provider API keys creates friction, duplicate billing/config work, and a worse default for managed user fleets.

The product goal is not "hide API keys with another API-key wrapper." The goal is a clean boundary:

  • host owns login/session/profile state
  • GBrain core owns provider calls, capability detection, and readiness checks
  • adapter/resolver passes only minimum credential-source metadata
  • secrets never appear in model-visible payloads, CLI output, route responses, or logs

Concrete Examples

  • OpenClaw can expose an OAuth-backed model runtime to a GBrain adapter without requiring the user to paste OPENAI_API_KEY into GBrain.
  • Codex Desktop can launch local gbrain serve while the host plugin contributes credential-source metadata through a narrow adapter contract.
  • Claude Code or Hermes can implement the same contract later without core GBrain importing host-specific SDKs.
  • CI and headless servers can keep using plain env vars, with process env remaining the highest-precedence escape hatch.

Current State

  • The old provider-auth resolver PR was closed as stale because upstream now has the v0.32 recipe/auth architecture.
  • feat: add OpenAI Codex OAuth provider #698 is the active Codex OAuth provider direction and should inform this work.
  • Recipe.resolveAuth is the right upstream seam to plug into; new work should not bypass it.

Acceptance Criteria

  • Define a provider-neutral credential-source shape that recipes can consume.
  • Integrate with Recipe.resolveAuth / existing provider recipes instead of creating a parallel auth path.
  • Keep process env as the highest-priority override for regular CLI/server installs.
  • Expose redacted readiness metadata for commands such as gbrain providers explain, list, or test.
  • Include fake-token tests proving secrets are never printed, logged, serialized into route payloads, or included in agent-visible context.
  • Include at least one host-adapter fixture proving the core seam works without importing a real host runtime.

Non-Goals

  • Do not make OpenClaw, Codex Desktop, Hermes, or Claude Code required for GBrain.
  • Do not print OAuth access tokens or refresh tokens.
  • Do not claim subscription-backed embeddings unless the provider/runtime actually supports embeddings.
  • Do not merge stale PR feat: provider auth resolver seam #642 as-is.

Agent Implementation Notes

Start from the current recipe/auth files on master. Build the smallest seam that lets a host adapter resolve credentials before the provider recipe creates its client. Keep host code outside core. Use fake credentials in tests and assert redaction at every public boundary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions