Files
PaperClipAI/packages
Dana63301 6a62ccdba5 fix(hermes): allow keyless local inference endpoints (#17477)
## Thinking Path

> - Paperclip is an open-source application for managing AI agents.
> - Paperclip uses adapters to connect to agent runtimes.
> - The Hermes adapter checks the local Hermes configuration.
> - Hermes can use Ollama on a local HTTP endpoint without a cloud API
key.
> - The adapter reports `hermes_no_api_keys` even when this local
configuration is valid.
> - This warning can mislead users during environment validation.
> - This pull request recognizes configured loopback inference
endpoints.
> - The change reduces false warnings and keeps warnings for remote
endpoints.

## Linked Issues or Issue Description
### Related pull requests

No existing public issue has been identified for this specific bug.

The following pull requests cover related Paperclip capabilities:

- #4654 — Related Hermes local-script functionality.
- #10260 — Native Ollama adapter support.
- #15565 — Model gateway documentation.
- #14154 — Hermes home-directory resolution.

These pull requests provide related context. None is a confirmed
duplicate of this fix.

This PR addresses the Hermes adapter's API-key validation for local
inference endpoints.

I reviewed `ROADMAP.md`. The roadmap lists Hermes as a supported
adapter, but it does not identify planned work for local inference
API-key validation.

**What happened?**

The Hermes adapter reports `hermes_no_api_keys` when Hermes uses a local
Ollama inference endpoint without cloud API credentials.

The warning appears during Paperclip's Hermes environment validation.

**Expected behavior**

Paperclip should not report missing cloud API keys when the requested
model uses a configured loopback inference endpoint.

Paperclip should continue to warn when the endpoint is remote or the
requested model does not match the detected model.

**Steps to reproduce**

1. Configure Hermes to use Ollama at `http://127.0.0.1:11434/v1`.
2. Configure Hermes to use a locally available model.
3. Do not configure cloud LLM API keys.
4. Run the Hermes adapter environment validation in Paperclip.
5. Observe the `hermes_no_api_keys` warning.

**Paperclip version or commit**

The bug was identified in the upstream Hermes adapter.

The fix is based on the upstream `master` branch and is available in
commit `cc34b2119`.

The exact upstream base commit has not been recorded in this
description.

**Deployment mode**

Local development.

**Agent adapter(s) involved**

Hermes.

**Database mode**

Not database-related.

**Relevant logs or output**

Before the fix: `hermes_no_api_keys`.

After the fix: `hermes_local_endpoint_no_api_key`.

**Relevant config (if applicable)**

The affected configuration uses:

- Inference provider: Ollama
- Inference endpoint: `http://127.0.0.1:11434/v1`
- Model: A locally available Ollama model
- Cloud LLM API keys: Not configured

The endpoint is a loopback address. Ollama serves the model locally.
This configuration does not require a cloud inference API key.

## What Changed

- Added exact loopback hostname checks for `localhost`, `127.0.0.1`, and
`[::1]`.
- Limited accepted endpoint schemes to HTTP and HTTPS.
- Added an informational validation result for matching local model
configurations.
- Preserved existing cloud API-key checks.
- Preserved warnings for remote endpoints and model mismatches.
- Added eight regression tests for valid and invalid endpoint
configurations.

## Verification

- Hermes adapter targeted tests: 15/15 passed.
- Hermes adapter TypeScript typecheck: passed.
- Repository-wide typecheck (`pnpm typecheck`): passed across all 35
participating workspace projects.
- Rust runner compilation: passed with non-blocking compiler warnings.
- Database migration safety checks: passed.
- `git diff --check`: passed.
- Repository-wide tests: server test failures occurred outside the
changed Hermes files. Their causes are not yet confirmed.

The targeted Hermes adapter tests and repository-wide typecheck passed.
The repository-wide test suite did not fully pass.

## Risks

Low risk. The change affects only Hermes environment validation.

The adapter accepts a configured loopback endpoint without requiring a
cloud API key. It does not verify that the endpoint is reachable or that
the inference server accepts requests without authentication.

The change does not modify model execution, credentials, or database
state.

## Model Used

Local inference using Tiel-Coder-35B-A3B-GGUF-MTP through LM Studio,
integrated with Cline in VS Code. The model assisted with code changes
and regression tests.

ChatGPT (GPT-6) assisted with review, test planning, and pull request
preparation.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues or (b) described the
issue in-PR following the relevant issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links
- [x] My branch name describes the change and contains no internal
Paperclip ticket id
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge
2026-12-05 02:06:50 -08:00
..