Repository navigation
Link direct-mode Composio connections with the v3 body - #102
Conversation
On the direct route (the user's own Composio key), every authorize
failed with "HTTP 400: Validation error while processing request".
DirectRoute::authorize posted the proxy-route body, {toolkit, extra
params, scopes} plus entity_id, to v3 /connected_accounts/link. v3
requires auth_config_id and user_id there.
The direct route now:
- resolves the toolkit to an auth config with GET /auth_configs
?toolkit_slug=, reusing an enabled config and preferring a
Composio-managed one;
- creates a Composio-managed config with POST /auth_configs when the
toolkit has none;
- posts only {auth_config_id, user_id} to /connected_accounts/link;
- turns a Composio 400/422 into Error::Authorize carrying Composio's
detail, so a host can show why the connection could not start.
The proxy route is unchanged. On the direct route, extra params and
toolkit-required OAuth scopes are no longer sent with the link; they
are logged at debug.
The test transport now rejects a link body without auth_config_id and
user_id, or with toolkit, the way v3 does, so the tests prove the body
rather than a permissive mock.
Closes tinyhumansai#101
Tiny Sweeper reviewReviewed head: FindingsNo active actionable findings. Advisory notes
Verdict: Ready for maintainer review · Priority: medium Diagnostics and supporting detailsFull summaryPull request purpose (title): Link direct-mode Composio connections with the v3 body. Title: Link direct-mode Composio connections with the v3 body. The pull request fixes direct-mode Composio connections, which failed with `HTTP 400: Validation error while processing request` because `DirectRoute::authorize` sent a proxy-shaped body to v3 `/connected_accounts/link`. The direct route now resolves the toolkit to an auth config (reusing an enabled one, preferring a Composio-managed config, or creating one), posts only `{auth_config_id, user_id}`, and maps Composio 400/422 to `Error::Authorize` with Composio's detail. No push delta is available: the review state has the prior reviewed head but no trusted base-to-head comparison. Review snapshot
Completeness: Complete Features
Tests
Before mergeNone. How this fits togetherflowchart LR
n0["FakeTransport<br/>changed"]:::changed
n1["drops_only_a_row_with_no_id_at_all<br/>changed"]:::changed
n2["falls_back_to_the_default_entity<br/>changed"]:::changed
n3["...lt_with_an_error_and_no_verdict_as_failed<br/>changed"]:::changed
n4["route"]:::impacted
n5["replying"]:::impacted
n6["linking"]:::impacted
n7["auth_config_for"]:::impacted
n1 -->|calls| n4
n1 -->|tests| n4
n1 -->|calls| n5
n1 -->|tests| n5
n2 -->|calls| n6
n2 -->|tests| n6
n3 -->|calls| n4
n3 -->|tests| n4
n3 -->|calls| n5
n3 -->|tests| n5
n4 -->|uses| n0
n6 -->|calls| n5
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
Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Summary
In direct mode, where the user brings their own Composio API key, connecting any integration fails with
HTTP 400: Validation error while processing request.DirectRoute::authorizeposted the proxy-route body to v3/connected_accounts/link:{toolkit, extra params, scopes}, plus an insertedentity_id. Composio's v3 reference requiresauth_config_idanduser_idthere (v3 API reference, migration guide).The direct route now:
GET /auth_configs?toolkit_slug=…, reusing an enabled config for that toolkit and preferring a Composio-managed one;POST /auth_configs({toolkit: {slug}, auth_config: {type: "use_composio_managed_auth"}}) when the toolkit has none;{auth_config_id, user_id}to/connected_accounts/link;Error::Authorizewith Composio's detail, so a host can show why the connection could not start.Related issue
Closes #101
API or behavior changes
No public API change. Direct-route behaviour changes:
Error::Authorizeinstead ofError::Transport.Not verified against a live Composio account: the fields used are the ones Composio's v3 reference documents for
GET/POST /auth_configsand/connected_accounts/link. One real direct-mode connect with an own key would confirm the flow end to end before release. It would also show whether toolkits that need extra scopes (Gmail read) need them set on the auth config.Validation
Run on our Linux CI runner, on this exact tree, checked out from
maind424749:cargo fmt --all(applied; the commit is formatted)cargo clippy --locked --all-targets --all-features -- -D warnings: passcargo build --locked --all-targets --all-features: passcargo test --locked --all-features: 738 passed, 0 failedTests
auth_config_id/user_id, or withtoolkit, using Composio's 400. A dedicated test proves the old{toolkit, entity_id}body is rejected, so the other tests prove the new body rather than a permissive mock.{auth_config_id, user_id}and reuses an existing config;Error::Authorizewith the detail.GET /auth_configsbeyond one page. It reuses the existinglist_pageshelper, which has its own tests.Documentation
Not needed. The behaviour is documented on
DirectRoute::authorizeand the new helper.Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description