Skip to content

Add external AI assistant with Pipelock security proxy#1069

Draft
luckyPipewrench wants to merge 10 commits intowe-promise:mainfrom
luckyPipewrench:feat/external-assistant
Draft

Add external AI assistant with Pipelock security proxy#1069
luckyPipewrench wants to merge 10 commits intowe-promise:mainfrom
luckyPipewrench:feat/external-assistant

Conversation

@luckyPipewrench
Copy link
Collaborator

@luckyPipewrench luckyPipewrench commented Feb 25, 2026

Summary

Adds an external AI assistant mode where chat is delegated to a remote agent endpoint, with all traffic routed through a Pipelock security proxy sidecar for request scanning and access control.

External assistant:

  • New assistant mode that streams responses from a remote AI agent via OpenAI-compatible SSE
  • Settings UI to configure endpoint URL, token, and agent ID (auto-submit with token masking)
  • Family-level assistant type toggle (builtin vs external) with ENV override support
  • Per-user email allowlist to restrict access
  • Disconnect button with confirmation modal to clear credentials and revert to builtin
  • Retry with backoff for transient errors (skips retry once streaming starts)
  • Conversation history truncated to last 20 messages per request
  • Proxy-aware HTTP client with HTTPS_PROXY / NO_PROXY support

Pipelock integration:

  • Helm chart adds Pipelock as a forward proxy sidecar deployment
  • ConfigMap for Pipelock scanning policy and route configuration
  • Compose example for local development with Pipelock
  • HTTPS_PROXY routing so all external assistant traffic passes through Pipelock

Depends on

Test plan

  • Configure external assistant, verify streaming chat through Pipelock proxy
  • Disconnect and verify fallback to builtin
  • All checks pass (tests, rubocop, brakeman)
image image

…compose

- Add ConfigMap template rendering DLP, response scanning, MCP input/tool
  scanning, and forward proxy settings from values
- Mount ConfigMap as /etc/pipelock/pipelock.yaml volume in deployment
- Add checksum/config annotation for automatic pod restart on config change
- Gate HTTPS_PROXY/HTTP_PROXY env injection on forwardProxy.enabled (skip
  in MCP-only mode)
- Use hasKey for all boolean values to prevent Helm default swallowing false
- Single source of truth for ports (forwardProxy.port/mcpProxy.port)
- Pipelock-specific imagePullSecrets with fallback to app secrets
- Merge standalone compose.example.pipelock.yml into compose.example.ai.yml
- Add pipelock.example.yaml for Docker Compose users
- Add exclude-paths to CI workflow for locale file false positives
Allow self-hosted instances to delegate chat to an external AI agent
via an OpenAI-compatible streaming endpoint. Configurable per-family
through Settings UI or ASSISTANT_TYPE env override.

- Assistant::External::Client: SSE streaming HTTP client (no new gems)
- Settings UI with type selector, env lock indicator, config status
- Helm chart and Docker Compose env var support
- 45 tests covering client, config, routing, controller, integration
Route to the actual OpenClaw session via x-openclaw-session-key header
instead of creating isolated sessions. Gate external assistant access
behind an email allowlist (EXTERNAL_ASSISTANT_ALLOWED_EMAILS env var).
Plumb session_key and allowedEmails through Helm chart, compose, and
env template.
Net::HTTP does not auto-read HTTPS_PROXY/HTTP_PROXY env vars (unlike
Faraday). Explicitly resolve proxy from environment in build_http so
outbound traffic to the external assistant routes through Pipelock's
forward proxy when enabled. Respects NO_PROXY for internal hosts.
…fallback)

Follow the same pattern as OpenAI settings: database-backed Setting
fields with env var defaults. Self-hosters can now configure the
external assistant URL, token, and agent ID from the browser
(Settings > Self-Hosting > AI Assistant) instead of requiring env vars.
Fields disable when the corresponding env var is set.
Change placeholder to generic OpenAI-compatible URL pattern. Add help
text under each field explaining where the values come from: URL from
agent provider, token for authentication, agent ID for multi-agent
routing.
Add External AI Assistant section to docs/hosting/ai.md covering setup
(UI and env vars), how it works, Pipelock security scanning, access
control, and Docker Compose example. Drop "chat completions" jargon
from URL help text.
…, and test coverage

- Add retry with backoff for transient network errors (no retry after streaming starts)
- Add disconnect button with confirmation modal in self-hosting settings
- Narrow rescue scope with fallback logging for unexpected errors
- Safe cleanup of partial responses on stream interruption
- Gate ai_available? on family assistant_type instead of OR-ing all providers
- Truncate conversation history to last 20 messages
- Proxy-aware HTTP client with NO_PROXY support
- Sanitize protocol to use generic headers (X-Agent-Id, X-Session-Key)
- Full test coverage for streaming, retries, proxy routing, config, and disconnect
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

False positive: `@token` instance variable flagged as "Credential in URL".
Temporary workaround until Pipelock supports inline suppression.
@luckyPipewrench luckyPipewrench self-assigned this Feb 25, 2026
@luckyPipewrench luckyPipewrench added the enhancement New feature or request label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant