Files
stack/docs/reports/code-review/756-code-review.md
Hermes Agent 365c2130de
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
feat(#756): add official Discord channel adapter
2026-07-14 15:16:44 -05:00

2.5 KiB

Independent Code Review — #756 Official Discord Channel Plugin

Verdict: APPROVE

Scope reviewed

Complete current uncommitted #756 delta: multi-binding trusted agent selection, privileged ingress-route validation, attachment validation/persistence/resume, egress route lifecycle and idempotency, concurrent gateway stream state, Discord lifecycle/thread/rate behavior, compatibility ingress, and tests.

Review result

No blocking or change-request finding remains.

  • Trusted multi-agent routing: each binding requires a provisioned agentConfigId; the gateway resolves that config server-side, verifies its logical-agent name, and never accepts a Discord-controlled agent selection or applies generic routing to Discord ingress.
  • Auth and route integrity: allowlist, pairing, role, and canonical logical-agent/channel-or-thread conversation-route validation occur before gateway processing. Privileged approval/stop paths use the same binding and route validation.
  • Attachments: ingress rejects malformed, over-bounded, credential-bearing, fragment-bearing, or query-bearing URLs. Valid attachment metadata, including sizeBytes, persists and is reconstructed into resume history as explicitly untrusted context.
  • Discord reliability: the adapter supports degraded Socket.IO reconnect, parent/thread routing semantics, bounded pre-side-effect ingress rates, and terminal response-route cleanup. Egress validates route/message alignment, sends deterministic nonces, distinguishes permanent from transient errors, and uses bounded retries.
  • Concurrent state: per-client/conversation keys isolate listener, redaction, tool, and stream state for simultaneous threads sharing a Discord socket; disconnect cleanup covers all associated conversations.
  • Harness neutrality: contracts retain logical-agent/channel data only; no harness/provider identity leaks into adapter routes or message boundaries.

Verification performed

  • git diff --check — passed.
  • pnpm --filter @mosaicstack/discord-plugin typecheck — passed.
  • pnpm --filter @mosaicstack/discord-plugin lint — passed.
  • pnpm --filter @mosaicstack/discord-plugin test — passed: 44 tests; coverage 92.18% statements/lines, 86.55% branches, 100% functions (all ≥85% threshold).
  • pnpm --filter @mosaicstack/gateway typecheck — passed.
  • cd apps/gateway && pnpm exec vitest run src/plugin/discord-ingress.security.spec.ts src/chat/chat.gateway-redaction.spec.ts src/__tests__/integration/tess-cross-surface.integration.test.ts — passed: 32 tests.