← Back to PRs

#19735: fix: inject CLAWD_URL/CLAWD_TOKEN env vars in Lobster plugin

by MisterGuy420 open 2026-02-18 04:08 View on GitHub →
extensions: lobster cli size: XS trusted-contributor
Fixes #19709 ## What changed - Added CLAWD_URL and CLAWD_TOKEN environment variables to the Lobster plugin subprocess execution - The gateway URL is resolved from config (default port 18789) or falls back to ws://127.0.0.1:18789 - The token is resolved from config gateway.auth.token or OPENCLAW_GATEWAY_TOKEN env var ## AI-assisted contribution This fix was generated by an AI agent (OpenClaw cron: gh-issues-fix) Testing depth: validated with pnpm build && pnpm tsgo && pnpm vitest run extensions/lobster The fix addresses the root cause described in the issue by injecting the required CLAWD_URL and CLAWD_TOKEN environment variables into the lobster subprocess, which are needed by local tools like clawd.invoke to communicate with the gateway. <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR makes two changes to fix issue #19709: 1. **Lobster plugin env injection** (`extensions/lobster/src/lobster-tool.ts`): Injects `CLAWD_URL` and `CLAWD_TOKEN` environment variables into the lobster subprocess so that local tools like `clawd.invoke` can communicate with the gateway. The gateway URL is constructed from the configured port (defaulting to 18789) and the token is resolved from config or the `OPENCLAW_GATEWAY_TOKEN` env var. 2. **Plugin registry loading** (`src/cli/channels-cli.ts`): Ensures the plugin registry is loaded before running channel commands by calling `ensurePluginRegistryLoaded()` in both `runChannelsCommand` and `runChannelsCommandWithDanger`. - Both changes are straightforward and follow existing patterns in the codebase. - Minor style note: the lobster tool uses `||` for fallbacks where the rest of the codebase consistently uses `??` for the same gateway config patterns. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge — both changes are low-risk and follow established patterns. - The changes are straightforward: env var injection into a subprocess and an idempotent plugin registry load call. The only issues are style-level inconsistencies (|| vs ??) that don't affect correctness in practice. No security concerns — the token is passed to a validated trusted binary. - extensions/lobster/src/lobster-tool.ts has minor style inconsistencies with || vs ?? fallback operators. <sub>Last reviewed commit: 3b91eec</sub> <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) <!-- /greptile_comment -->

Most Similar PRs