fix(cli): connector run uses agent API origin, not memory MCP URL#730
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRefactored ChangesConnector-run context and auth resolution
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/cli/src/commands/_lib/connector-run-cmd.ts (1)
183-201:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winWhen
--urloverrides the backend, require--orgor skip context-based org fallback.Line 201 still resolves
orgSlugfromresolvedContextName, and whenLOBU_API_TOKENis set alongside--url, that context name comes from the selected context (line 183). This means feed and profile lookups at lines 217 and 243 construct URLs like${override-url}/api/${context-org}/..., hitting the override host with the wrong organization prefix. Without--org, this produces 404/403 errors.Either require
--orgwhen--urlis provided, or skip the context-based org fallback in this override path.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli/src/commands/_lib/connector-run-cmd.ts` around lines 183 - 201, When an explicitUrl override is used (explicitUrl true / user passed --url) and credentials come from LOBU_API_TOKEN or a selected context, avoid resolving org from the stored context; instead either require the user to pass --org or skip context-based fallback by calling resolveOrg with undefined contextName. Concretely: in the branch where explicitUrl is set (and you may have obtained token from getUsableToken or LOBU_API_TOKEN), ensure you do not pass resolvedContextName into resolveOrg — if args.org is empty, throw an error requiring --org when explicitUrl is present, or call resolveOrg(args.org, undefined, undefined) so the override host is not combined with the context org; use variables explicitUrl, args.org, getUsableToken, resolvedContextName and resolveOrg to implement this conditional behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/web`:
- Line 1: The packages/web submodule is pinned to a commit not reachable from
owletto-web/main; repin the submodule at packages/web to a SHA that is an
ancestor of the submodule's origin/main: fetch the submodule remote, identify a
commit on origin/main that is an ancestor (or use the latest origin/main tip),
check out that commit inside the packages/web working tree, update the
superproject's submodule reference (stage the packages/web change) and commit
the update so the submodule SHA in the superproject points to a reachable
ancestor of origin/main.
---
Outside diff comments:
In `@packages/cli/src/commands/_lib/connector-run-cmd.ts`:
- Around line 183-201: When an explicitUrl override is used (explicitUrl true /
user passed --url) and credentials come from LOBU_API_TOKEN or a selected
context, avoid resolving org from the stored context; instead either require the
user to pass --org or skip context-based fallback by calling resolveOrg with
undefined contextName. Concretely: in the branch where explicitUrl is set (and
you may have obtained token from getUsableToken or LOBU_API_TOKEN), ensure you
do not pass resolvedContextName into resolveOrg — if args.org is empty, throw an
error requiring --org when explicitUrl is present, or call resolveOrg(args.org,
undefined, undefined) so the override host is not combined with the context org;
use variables explicitUrl, args.org, getUsableToken, resolvedContextName and
resolveOrg to implement this conditional behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: af5f5fe6-0acb-4510-a835-5fbcd495ddae
📒 Files selected for processing (3)
packages/cli/src/commands/_lib/connector-run-cmd.tspackages/server/src/utils/__tests__/mcp-install-targets.test.tspackages/web
connector-run REST routes (/api/:orgSlug/connector-run/*) live on the main app (mounted at /), which is the same origin as the agent API URL configured per context. Before this fix, the CLI resolved the base URL via getMemoryUrl() — which defaults to https://lobu.ai/mcp — so the origin collapsed to https://lobu.ai (the marketing site), and every hosted-prod user got 404 HTML back. Switch to resolveContext().apiUrl so the origin is correct on every configured context (community.lobu.ai, app.lobu.ai, local dev). --url remains an explicit override but now requires LOBU_API_TOKEN — refuse to forward stored credentials to a URL the user typed on the command line.
1400eb6 to
7be89db
Compare
Summary
lobu connector runwas building its REST URL fromgetMemoryUrl(), which defaults tohttps://lobu.ai/mcp. The origin collapsed tohttps://lobu.ai— the marketing site — so every hosted-prod user ran into:The connector-run REST routes live on the main app (
/api/:orgSlug/connector-run/*), same origin as the agent API URL configured per context. Switch toresolveContext().apiUrland everything resolves correctly on every configured context (community.lobu.ai,app.lobu.ai, local dev).--urlremains an explicit override but now requiresLOBU_API_TOKEN— we refuse to forward the context's stored credentials to a URL the user typed on the command line.Repro before the fix
After:
Test plan
community.lobu.aiorigin) with stored credentials —--checkresolves, profile returns--url https://app.lobu.ai+LOBU_API_TOKEN— works--urlwithoutLOBU_API_TOKEN— explicit error, no silent credential forwardingbun test packages/cli— 114 tests pass🤖 Generated with Claude Code
Summary by CodeRabbit
--urlflag, you must now provide an explicit API token instead of relying on stored credentials.