Fix cross-agent reply cascade, route Hermes through LiteLLM #12

Open
claude-bot wants to merge 1 commits from fix/agent-cascade-and-hermes-litellm into main
Collaborator

Details in the commit message.

Details in the commit message.
claude-bot added 1 commit 2026-08-23 16:02:21 +00:00
Critical bug: claude-bot only ignored its OWN messages and text explicitly
addressed to @hermes — it did not ignore Hermes's own replies appearing in
the room. A single @hermes mention cascaded into claude-bot replying to
Hermes's thread messages ('Hermes says: ...'), which could itself cascade
further. Fixed with an OTHER_AGENT_USER_IDS allowlist of sender IDs to
always ignore, not just a text-prefix check.

Also point Hermes's model provider at the local litellm gateway
(OPENAI_BASE_URL/OPENAI_API_KEY) instead of OpenRouter directly, matching
claude-agent's own chat path — one place to hold the OpenRouter credential.
This does NOT grant Hermes access to the Claude subscription; that's an
Anthropic-side restriction unrelated to which proxy sits in front of it,
already proven earlier in this session.

Separately (not a code fix): the 'Billing or credits exhausted: HTTP 402'
error Hermes hit is real — the OpenRouter account currently has 0 credits.
Author
Collaborator

Code Review: Fix cross-agent reply cascade, route Hermes through LiteLLM

Correctness bugs:

  1. docker-compose.yml:64hermes now points OPENAI_BASE_URL at http://litellm:4000/v1 but has no depends_on: litellm, unlike claude-agent which does. On a full stack restart (e.g. GitOps redeploy), Hermes could start before LiteLLM is listening and fail its first API call.

  2. agent/src/matrixBot.js:65OTHER_AGENT_USER_IDS was introduced as a generic mechanism to ignore other agents' own messages, but the separate "don't reply if message is addressed to another agent" guard is still hardcoded to the literal "@hermes". If another agent gets added later via OTHER_AGENT_USER_IDS, claude-bot will correctly ignore that agent's messages but will still incorrectly answer human messages addressed to it (e.g. "@assistant2 ...").

Minor:

  1. agent/src/matrixBot.js:80 — leftover debug console.log on every successful chat reply; not a bug but noisy in production logs.

Want me to fix these (add the depends_on, generalize the @hermes check, drop the stray log)?

## Code Review: Fix cross-agent reply cascade, route Hermes through LiteLLM **Correctness bugs:** 1. **`docker-compose.yml:64`** — `hermes` now points `OPENAI_BASE_URL` at `http://litellm:4000/v1` but has no `depends_on: litellm`, unlike `claude-agent` which does. On a full stack restart (e.g. GitOps redeploy), Hermes could start before LiteLLM is listening and fail its first API call. 2. **`agent/src/matrixBot.js:65`** — `OTHER_AGENT_USER_IDS` was introduced as a generic mechanism to ignore other agents' own messages, but the separate "don't reply if message is addressed to another agent" guard is still hardcoded to the literal `"@hermes"`. If another agent gets added later via `OTHER_AGENT_USER_IDS`, claude-bot will correctly ignore that agent's messages but will still incorrectly answer human messages addressed *to* it (e.g. `"@assistant2 ..."`). **Minor:** 3. **`agent/src/matrixBot.js:80`** — leftover debug `console.log` on every successful chat reply; not a bug but noisy in production logs. Want me to fix these (add the `depends_on`, generalize the `@hermes` check, drop the stray log)?
This pull request has changes conflicting with the target branch.
  • .env.example
  • agent/src/matrixBot.js
  • docker-compose.yml
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/agent-cascade-and-hermes-litellm:fix/agent-cascade-and-hermes-litellm
git checkout fix/agent-cascade-and-hermes-litellm
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: william/gitops-automation#12