Skip to content

feat(cli): request Composio backend for integration connect#130

Merged
khaliqgant merged 2 commits intomainfrom
codex/composio-relayfile-cli
May 11, 2026
Merged

feat(cli): request Composio backend for integration connect#130
khaliqgant merged 2 commits intomainfrom
codex/composio-relayfile-cli

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

  • add --backend to relayfile setup and relayfile integration connect
  • send requestedBackend to Cloud connect-session requests
  • avoid reusing an existing default connection when a specific backend is requested

Test

  • go test ./cmd/relayfile-cli

Companion Cloud PR follows to implement the Composio backend session path.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a validated --backend flag to setup and integration connect flows, sends it as RequestedBackend in cloud connect-session requests, persists the resolved backend in saved connection state, and updates ensure/connect logic and tests to honor and record the backend.

Changes

Backend Selection Feature

Layer / File(s) Summary
Request / Response Structs
cmd/relayfile-cli/main.go
Adds RequestedBackend to connect-session requests and Backend to connect-session responses.
Saved Connection State
cmd/relayfile-cli/main.go
integrationConnectionState now includes an optional Backend field persisted on disk.
CLI Help & Parsing
cmd/relayfile-cli/main.go
Documents and accepts --backend for runSetup and runIntegrationConnect; updates usage/error text.
Normalize & Wire
cmd/relayfile-cli/main.go
Adds normalizeIntegrationBackend, normalizes --backend into requestedBackend, and forwards it from runSetup into connection flows.
Ensure / Connect Logic
cmd/relayfile-cli/main.go
ensureCloudIntegration now takes requestedBackend and only reuses saved ready connections when backends match; connectCloudIntegration sends RequestedBackend, reads backend from the response, and persists it. runIntegrationConnect passes the normalized backend through.
Saved Connection Loader
cmd/relayfile-cli/main.go
Introduces loadSavedConnection to read persisted integration connection state (replacing prior loader).
Tests & Mocks
cmd/relayfile-cli/main_test.go, cmd/relayfile-cli/catalog_test.go, cmd/relayfile-cli/setup_e2e_test.go
Mocks assert RequestedBackend and return backend; CLI tests pass --backend composio; tests updated for new signatures and a new test verifies reuse when saved backend matches.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through flags and clouds today,
A backend choice to show the way,
With nango or composio we send,
A tiny field, a rabbit's friend,
Saved on disk, the hops now stay.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a --backend flag to request the Composio backend for the integration connect feature.
Description check ✅ Passed The description is directly related to the changeset, outlining the key features added (--backend flag, requestedBackend in requests, avoiding reuse of default connections) and testing approach.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/composio-relayfile-cli

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

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 `@cmd/relayfile-cli/main.go`:
- Around line 1039-1047: ensureCloudIntegration currently skips the ready
fast-path whenever requestedBackend is non-empty because only ConnectionID is
stored; fix by persisting and checking the stored backend too. Change
loadSavedConnectionID to return both savedConnectionID and savedBackend (or add
a new loadSavedConnection function), update ensureCloudIntegration to only use
the fast-path when savedConnectionID != "" AND (requestedBackend == "" OR
requestedBackend == savedBackend), and ensure connectCloudIntegration writes the
chosen backend alongside the ConnectionID when the connection succeeds so
subsequent runs can compare backends.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ba76c235-d499-42f8-95a8-38be3db5adb2

📥 Commits

Reviewing files that changed from the base of the PR and between 780c768 and f169af3.

📒 Files selected for processing (4)
  • cmd/relayfile-cli/catalog_test.go
  • cmd/relayfile-cli/main.go
  • cmd/relayfile-cli/main_test.go
  • cmd/relayfile-cli/setup_e2e_test.go

Comment thread cmd/relayfile-cli/main.go
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
cmd/relayfile-cli/main.go (1)

4410-4413: ⚡ Quick win

Remove unused loadSavedConnectionID function.

The static analysis correctly identifies this function as unused. After refactoring to use loadSavedConnection directly (which returns the full state including Backend), this wrapper is no longer called anywhere in the codebase.

♻️ Suggested fix
-func loadSavedConnectionID(localDir, provider string) string {
-	state := loadSavedConnection(localDir, provider)
-	return strings.TrimSpace(state.ConnectionID)
-}
🤖 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 `@cmd/relayfile-cli/main.go` around lines 4410 - 4413, Delete the unused helper
function loadSavedConnectionID: remove its definition (the function that calls
loadSavedConnection and returns strings.TrimSpace(state.ConnectionID)) since
callers now use loadSavedConnection directly; ensure no remaining references to
loadSavedConnectionID exist and run tests/static analysis to confirm removal is
safe.
🤖 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.

Nitpick comments:
In `@cmd/relayfile-cli/main.go`:
- Around line 4410-4413: Delete the unused helper function
loadSavedConnectionID: remove its definition (the function that calls
loadSavedConnection and returns strings.TrimSpace(state.ConnectionID)) since
callers now use loadSavedConnection directly; ensure no remaining references to
loadSavedConnectionID exist and run tests/static analysis to confirm removal is
safe.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2660ab59-2ad1-46c4-b45b-1d4330dca76a

📥 Commits

Reviewing files that changed from the base of the PR and between f169af3 and c909593.

📒 Files selected for processing (3)
  • cmd/relayfile-cli/main.go
  • cmd/relayfile-cli/main_test.go
  • cmd/relayfile-cli/setup_e2e_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/relayfile-cli/main_test.go

@khaliqgant khaliqgant merged commit 1cc977a into main May 11, 2026
7 checks passed
@khaliqgant khaliqgant deleted the codex/composio-relayfile-cli branch May 11, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant