Skip to content

fix(flows): honor selected Composio account - #5837

Open
simplenaive wants to merge 2 commits into
tinyhumansai:mainfrom
simplenaive:fix/5751-flow-connection-account
Open

fix(flows): honor selected Composio account#5837
simplenaive wants to merge 2 commits into
tinyhumansai:mainfrom
simplenaive:fix/5751-flow-connection-account

Conversation

@simplenaive

@simplenaive simplenaive commented Aug 28, 2026

Copy link
Copy Markdown

Summary

  • Honor a workflow node's selected Composio connection in backend mode.
  • Forward the exact account identifier as connectionId through the authenticated integration request.
  • Preserve ambient-account behavior when no connection is selected and pin both paths with regression coverage.

Problem

  • Workflow nodes parse connection_ref, but backend-mode dispatch discarded the resulting connection ID before calling the integration backend.
  • Multi-account workflows could therefore execute GitHub, Gmail, or Google Sheets actions against the ambient signed-in account instead of the configured account, creating privacy and data-integrity risk.

Solution

  • Add ComposioClient::execute_tool_with_connection while keeping execute_tool as the ambient-account compatibility wrapper.
  • Route both backend and direct flow execution through one account-aware helper.
  • Forward stale or foreign IDs unchanged so the provider rejects them instead of silently falling back.
  • Add a loopback backend regression test that asserts the final request contains the selected connectionId; update the ambient execution test to assert that the field remains absent.

Submission Checklist

If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
  • Diff coverage >= 80% - changed lines (Vitest + cargo-llvm-cov merged via diff-cover) meet the gate enforced by .github/workflows/ci-lite.yml. Focused local tests exercise selected-account and ambient-account wire behavior; CI will enforce the numeric gate.
  • Coverage matrix updated - N/A: behavior-only fix with no added, removed, or renamed feature row in docs/TEST-COVERAGE-MATRIX.md
  • All affected feature IDs from the matrix are listed in the PR description under ## Related - N/A: no coverage-matrix feature row applies
  • No new external network dependencies introduced (mock backend used per Testing Strategy)
  • Manual smoke checklist updated if this touches release-cut surfaces - N/A: no release-cut surface or manual smoke procedure changed
  • Linked issue closed via Closes #NNN in the ## Related section

Impact

  • Affects Rust-core workflow Composio dispatch in backend mode on every desktop platform.
  • Selected integration accounts are now honored; calls without a selection retain existing ambient behavior.
  • No schema migration, public RPC change, new dependency, or performance-sensitive path.
  • Security improves by removing silent cross-account execution.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Keep this section for AI-authored PRs. For human-only PRs, mark each field N/A.

Linear Issue

Commit & Branch

  • Branch: fix/5751-flow-connection-account
  • Commit SHA: 3254d7e3acd4315d256ab2ce0e6d4cd1b233d869

Validation Run

  • pnpm --filter openhuman-app format:check - N/A: frontend unchanged
  • pnpm typecheck - N/A: frontend unchanged
  • Focused tests: cargo test --manifest-path Cargo.toml --lib backend_dispatch_forwards_the_workflow_connection_id -- --nocapture; cargo test --manifest-path Cargo.toml --lib openhuman::integrations::composio::client::tests::execute_tool -- --nocapture
  • Rust fmt/check (if changed): cargo fmt --all -- --check; GGML_NATIVE=OFF cargo check --manifest-path Cargo.toml; git diff --check
  • Tauri fmt/check (if changed): N/A - Tauri shell unchanged

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: backend-mode workflow tool calls execute against the account named by connection_ref.
  • User-visible effect: multi-account workflows no longer silently operate as the ambient signed-in account.

Parity Contract

  • Legacy behavior preserved: calls without connection_ref omit connectionId and keep ambient-account dispatch.
  • Guard/fallback/dispatch parity checks: existing validation, egress policy, approval gate, argument preparation, OAuth retry, provider errors, and direct-mode dispatch remain intact.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): N/A - none found for this branch or issue
  • Canonical PR: this PR
  • Resolution (closed/superseded/updated): N/A

Summary by CodeRabbit

  • New Features
    • Tools can now run against an explicitly selected connection in both supported execution modes.
    • Connection details are forwarded consistently so actions target the intended account.
  • Bug Fixes
    • Prevented backend actions from unintentionally using an ambient or incorrect account.
    • Invalid or stale connection references are rejected instead of silently falling back.
  • Tests
    • Added coverage for connection targeting while preserving existing ambient-account behavior.

@simplenaive
simplenaive requested a review from a team August 28, 2026 22:32
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a7036a2f-0da5-408e-a495-67635e9a471e

📥 Commits

Reviewing files that changed from the base of the PR and between a394bfe and 3254d7e.

📒 Files selected for processing (2)
  • src/openhuman/flows/tinyflows/caps/tools/composio.rs
  • src/openhuman/integrations/composio/client_tests.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/openhuman/integrations/composio/client_tests.rs
  • src/openhuman/flows/tinyflows/caps/tools/composio.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Backend Composio tool calls now forward the workflow node’s exact connection_id. The client adds non-empty connectionId values to authenticated requests. Ambient calls omit this field. Direct mode continues to use direct_execute. Regression tests cover both request shapes.

Changes

Composio connection scoping

Layer / File(s) Summary
Client connection parameter
src/openhuman/integrations/composio/client.rs, src/openhuman/integrations/composio/client_tests.rs
ComposioClient adds optional connection ID support. Non-empty trimmed IDs become connectionId; ambient calls omit the field.
Backend dispatch wiring
src/openhuman/flows/tinyflows/caps/tools/composio.rs, src/openhuman/flows/tinyflows/caps/ops.rs
Backend execution forwards the exact connection ID. Direct execution remains unchanged. Tests verify the scoped backend request body.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 3254d

The change makes workflow actions use the selected Composio account while preserving ambient-account behavior when no account is selected; no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant WorkflowNode as Workflow node
  participant ComposioTool as Composio tool
  participant ComposioClient
  participant BackendAPI as Composio backend API
  WorkflowNode->>ComposioTool: Invoke with connection_ref
  ComposioTool->>ComposioClient: Execute with connection ID
  ComposioClient->>BackendAPI: POST tool, arguments, connectionId
  BackendAPI-->>ComposioClient: Return execution response
  ComposioClient-->>WorkflowNode: Return tool result
Loading

Poem

A rabbit checks the connection line
The named account now fits just right
Ambient calls stay plain and clear
Backend paths send IDs sincere
Tests guard each payload byte

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation addresses issue #5751 by forwarding the selected connection ID in backend execution, preserving ambient execution when no connection is selected, and testing the request behavior.
Out of Scope Changes check ✅ Passed All code, documentation, and test changes support the selected-account execution fix described in issue #5751. No unrelated changes are evident.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: backend workflow execution now honors the selected Composio account.

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

@tinysweeper

tinysweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown

How this change flows

2 changed behaviours across 9 relationships. 4 surrounding behaviours are shown (60 graph nodes walked). 42 further behaviours left out to keep the diagram readable.

flowchart LR
  n0["ComposioClient<br/>changed"]:::changed
  n1["...s_filters_pass_through_as_csv_query_param<br/>changed"]:::changed
  n2["build_client_for"]:::impacted
  n3["start_mock_backend"]:::impacted
  n4["format"]:::impacted
  n5["openhuman"]:::impacted
  n1 -->|calls| n2
  n1 -->|tests| n2
  n1 -->|calls| n3
  n1 -->|tests| n3
  n1 -->|calls| n4
  n1 -->|tests| n4
  n2 -->|uses| n0
  n2 -->|uses| n5
  n3 -->|calls| n4
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading

Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge.

tinysweeper 0.1.0

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Aug 28, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 28, 2026
@simplenaive

Copy link
Copy Markdown
Author

@tinyhumansai/maintainers This is ready for review; all required checks are green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow tool calls in backend mode execute against ambient signed-in session, not the named connection account

1 participant