fix(agent): reuse cached Composio toolkit actions - #4358
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughChangesScope-Aware Action Execution
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
A rabbit checks each tool with care, Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3887957068
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openhuman/agent/harness/test_support_tests.rs (1)
30-53: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
WorkspaceEnvGuardis duplicated here and insubagent_runner/ops_tests.rswith divergentunsafeusage.This copy wraps
set_var/remove_varinunsafe, while the copy insrc/openhuman/agent/harness/subagent_runner/ops_tests.rs(Lines 211-225) does not. Only one can be correct for the crate edition: under edition 2024 these calls areunsafe(the other copy won't compile), and under 2021 thisunsafeblock isunused_unsafe. Consider extracting a single shared guard intotest_supportto keep them in sync. See the companion comment on the other file for the compile-risk detail.🤖 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 `@src/openhuman/agent/harness/test_support_tests.rs` around lines 30 - 53, `WorkspaceEnvGuard` is duplicated with inconsistent `std::env::set_var`/`remove_var` handling, so unify the implementation to avoid edition-dependent compile issues. Move the guard into a single shared test-support location and have both `test_support_tests` and `subagent_runner::ops_tests` use that shared `WorkspaceEnvGuard` instead of maintaining separate copies; ensure the chosen implementation matches the crate edition’s safety requirements and removes the divergent `unsafe` usage.
🤖 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 `@src/openhuman/agent/harness/test_support_tests.rs`:
- Around line 30-53: `WorkspaceEnvGuard` is duplicated with inconsistent
`std::env::set_var`/`remove_var` handling, so unify the implementation to avoid
edition-dependent compile issues. Move the guard into a single shared
test-support location and have both `test_support_tests` and
`subagent_runner::ops_tests` use that shared `WorkspaceEnvGuard` instead of
maintaining separate copies; ensure the chosen implementation matches the crate
edition’s safety requirements and removes the divergent `unsafe` usage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5f02a027-3542-4329-b300-9afe4cf0ddee
📒 Files selected for processing (5)
src/openhuman/agent/harness/subagent_runner/ops_tests.rssrc/openhuman/agent/harness/test_support_tests.rssrc/openhuman/composio/action_tool.rssrc/openhuman/composio/mod.rssrc/openhuman/composio/ops_tests.rs
✅ Files skipped from review due to trivial changes (1)
- src/openhuman/composio/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- src/openhuman/composio/action_tool.rs
…4317-composio-cached-actions # Conflicts: # src/openhuman/agent/harness/test_support_tests.rs
Review — not an approvalThe core change is sound: reuse a non-empty I especially like that Two things to address before this is ready:
Minor: |
|
Maintainer review changes: merged current
No behavioral changes to the PR's own logic. Letting PR CI verify. |
|
Updated the PR description to cover both review items.
|
Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…runner.rs Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
…runner.rs Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
…runner.rs Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
|
You have reached your Codex usage limits for security reviews. Please try again later. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
There was a problem hiding this comment.
Requesting changes: 1 lane(s) blocking, worst finding is high.
Fix or reply to the findings below and push. The next review clears this automatically once they are gone — you should not need to dismiss anything by hand.
$0.0058 · 65,677 in / 1,032 out · 0 cached (0%) · openrouter/openai/text-embedding-3-small, deepseek/deepseek-v4-flash · 193 embedded
critique: $0.0020 · 23,586 in / 169 out · 0 cached (0%) · deepseek/deepseek-v4-flash
security: $0.0020 · 23,544 in / 155 out · 0 cached (0%) · deepseek/deepseek-v4-flash
tests: $0.0012 · 12,702 in / 632 out · 0 cached (0%) · deepseek/deepseek-v4-flash
description: $0.0005 · 5,845 in / 76 out · 0 cached (0%) · deepseek/deepseek-v4-flash
How this change flows1 changed behaviour across 11 relationships. 6 surrounding behaviours are shown (60 graph nodes walked). 27 further behaviours left out to keep the diagram readable. flowchart LR
n0["run_typed_mode<br/>changed"]:::changed
n1["run_subagent"]:::impacted
n2["openhuman"]:::impacted
n3["run_subagent_via_graph"]:::impacted
n4["try_deterministic_memory_retrieval"]:::impacted
n5["offload_outcome_artifacts"]:::impacted
n6["workspace_descriptor_for_subagent"]:::impacted
n0 -->|uses| n2
n0 -->|calls| n3
n0 -->|calls| n6
n1 -->|calls| n0
n1 -->|uses| n2
n1 -->|calls| n4
n1 -->|calls| n5
n1 -->|calls| n6
n3 -->|uses| n2
n4 -->|uses| n2
n5 -->|uses| n2
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
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd584ef19c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ate files Move the `filter_cached_toolkit_actions_with_current_scope` function from the subagent runner into a new `runner_part_01.rs` file, and relocate the `channel_permission_block` and `generated_context` methods from `middleware_part_02.rs` into a new `middleware_part_07.rs` file. This reduces file sizes and improves maintainability by keeping related logic together. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
A misplaced closing brace was removed from the ToolOutputMiddleware implementation, which was causing a syntax error that prevented the subsequent `wrap_tool` function from being parsed correctly. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Added a closing brace to terminate the `approval_tool_name` function, which was previously left unclosed and caused a syntax error in the module. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Removed an unnecessary trailing blank line at the end of the `ToolPolicyMiddleware` implementation block to keep the file clean and consistent with Rust formatting conventions. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Removed an extra closing brace that was causing a syntax error in the ToolPolicyMiddleware implementation. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a closing brace to the ToolPolicyMiddleware impl in part_02 and opens a matching impl block in part_07 so the split middleware files compile as separate chunks of the same type. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
|
You have reached your Codex usage limits for security reviews. Please try again later. |
# Conflicts: # src/core/jsonrpc_tests.rs # src/openhuman/agent/tinyagents/middleware_part_02.rs # src/openhuman/agent/tinyagents/middleware_part_07.rs
|
You have reached your Codex usage limits for security reviews. Please try again later. |
The `include!("middleware_part_07.rs")` line was removed from the middleware module because that part is no longer needed, cleaning up the module's composition.
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
|
You have reached your Codex usage limits for security reviews. Please try again later. |
Summary
ConnectedIntegration.toolscatalogue forintegrations_agenttoolkit delegation when action schemas are already cached.list_toolsonly when the cached toolkit catalogue is empty./toolsrequest.action_tool.rs, so stale cached actions cannot run after a scope is narrowed.Problem
list_toolscalls adding avoidable latency to integration delegation.run_typed_modealready finds the connected toolkit from the parent snapshot, but backend mode still refetched toolkit actions before using that cached catalogue.Solution
cached_integration.toolsas the primary action source for toolkit overrides.integrations_agent, and asserts the fake backend/toolscall count does not increase.Submission Checklist
Impact
Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
fix/GH-4317-composio-cached-actions388795706869c18872bb60fc2f2a736265ac59d7Validation Run
pnpm --filter openhuman-app format:check(no frontend changes)pnpm typecheck(no TypeScript changes)GGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib integrations_agent_reuses_cached_toolkit_actions_without_refetching_list_tools -- --nocaptureGGML_NATIVE=OFF cargo test --manifest-path Cargo.toml --lib agent::harness::subagent_runner::ops::tests::cargo fmt --manifest-path Cargo.toml --checkgit diff --checkGGML_NATIVE=OFF cargo check --manifest-path Cargo.tomlValidation Blocked
command:N/Aerror:N/Aimpact:N/ABehavior Changes
integrations_agentnow reuses cached Composio action schemas when available instead of refetchinglist_toolson every delegation.Parity Contract
list_tools; direct mode and unavailable-client fallbacks continue to use the cached catalogue./toolsrequest.Duplicate / Superseded PR Handling
Summary by CodeRabbit