Skip to content

fix(flows): an errored Composio tool_call fails the run instead of reporting Completed (B6)#4659

Merged
graycyrus merged 1 commit into
tinyhumansai:mainfrom
graycyrus:fix/flows-tool-error-honesty
Jul 7, 2026
Merged

fix(flows): an errored Composio tool_call fails the run instead of reporting Completed (B6)#4659
graycyrus merged 1 commit into
tinyhumansai:mainfrom
graycyrus:fix/flows-tool-error-honesty

Conversation

@graycyrus

@graycyrus graycyrus commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The bug (hit live)

A tool_call that fails at the provider — e.g. SLACK_SEND_MESSAGE returning 400 with successful:false — showed step [success] and the run reported green "Completed." OpenHumanTools::invoke did serde_json::to_value(response?) and never inspected response.successful, so a 200-with-successful:false sailed through as OkStepStatus::Success → nothing for degrade_completed_status to degrade.

Fix

  • reject_unsuccessful_composio_response(slug, resp): passes successful:true through; for successful:false returns Err(EngineError::Capability(...)) naming the slug + the provider error. Wired into invoke after client dispatch, before the audit block → the audit row now records Failure automatically.
  • Engine now assigns StepStatus::Errordegrade_completed_status (feat(flows): completed_with_warnings run status (run honesty) #4587) degrades the run to failed. No more false green. Native oh: tool_calls untouched.

Verification

cargo check/fmt clean · tinyflows:: 95 pass (+3 new: provider-failure→Err, empty-error fallback, success pass-through) · #4587 degrade tests still green (composes). 1 pre-existing unrelated failure (on_error=route, repro'd on base).

Summary by CodeRabbit

  • Bug Fixes
    • Capability calls now correctly surface provider-side failures even when the HTTP request succeeds.
    • Error messages are cleaned up before being shown, with a clear fallback message when no details are provided.
    • Successful capability responses continue to behave as before.

…porting Completed (B6)

A Composio 200-with-successful:false (e.g. Slack's 400 "Invalid request data" on
SLACK_SEND_MESSAGE) sailed through OpenHumanTools::invoke as Ok, so the engine recorded
StepStatus::Success and the run reported green "Completed" — even though the tool FAILED.
invoke did serde_json::to_value(response?) without ever inspecting response.successful.

- reject_unsuccessful_composio_response(slug, resp): passes through successful:true; for
  successful:false returns Err(EngineError::Capability) naming the slug + provider error.
  Wired into invoke after client dispatch, before the audit block — so the audit row now
  records Failure automatically (it already branched on response.is_ok()). Native oh:
  tool_calls untouched; genuinely-successful responses unaffected.
- Engine now assigns StepStatus::Error -> degrade_completed_status (tinyhumansai#4587) degrades the run
  to failed, so a failed tool no longer shows green "Completed".

cargo check/fmt clean; tinyflows:: 95 pass (+3 new); tinyhumansai#4587 degrade tests still green
(composes). 1 pre-existing unrelated failure (on_error=route, repro'd on base).
@graycyrus graycyrus requested a review from a team July 7, 2026 15:18
@coderabbitai

coderabbitai Bot commented Jul 7, 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

Run ID: c1bd5b1d-379a-4a40-80d4-d2b875e6fd24

📥 Commits

Reviewing files that changed from the base of the PR and between 77639d3 and a7efe0f.

📒 Files selected for processing (1)
  • src/openhuman/tinyflows/caps.rs

📝 Walkthrough

Walkthrough

Adds a helper function reject_unsuccessful_composio_response that converts Composio execute responses with successful == false into EngineError::Capability errors, wires it into the OpenHumanTools::invoke tool_call path, and adds unit tests covering error mapping, fallback messaging, and pass-through behavior.

Changes

Composio error mapping

Layer / File(s) Summary
Error mapping helper and invoke integration
src/openhuman/tinyflows/caps.rs
New reject_unsuccessful_composio_response helper converts successful == false responses into EngineError::Capability errors using a trimmed resp.error message or a default fallback; applied in OpenHumanTools::invoke before audit/JSON conversion.
Unit tests for error mapping
src/openhuman/tinyflows/caps.rs
Tests verify error mapping with provider error detail, fallback default message when error is empty, and unchanged pass-through when successful: true.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OpenHumanTools
  participant Composio
  participant reject_unsuccessful_composio_response
  participant Engine

  OpenHumanTools->>Composio: execute tool_call
  Composio-->>OpenHumanTools: ComposioExecuteResponse
  OpenHumanTools->>reject_unsuccessful_composio_response: check successful flag
  alt successful == false
    reject_unsuccessful_composio_response-->>OpenHumanTools: Err(EngineError::Capability)
    OpenHumanTools-->>Engine: propagate error
  else successful == true
    reject_unsuccessful_composio_response-->>OpenHumanTools: unchanged response
    OpenHumanTools-->>Engine: return JSON result
  end
Loading

Possibly related PRs

  • tinyhumansai/openhuman#4433: Builds on the same adapter logic in OpenHumanTools::invoke in src/openhuman/tinyflows/caps.rs that this PR extends with capability error mapping.

Suggested labels: bug

Poem

A hop, a check, a flag surveyed,
"successful: false" no longer betrayed.
With trimmed-up words the error's told,
No silent fails left in the cold. 🐇
Tests all pass, my whiskers twitch with glee!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main fix: Composio tool_call failures now fail the run instead of ending as Completed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

@graycyrus graycyrus merged commit 67a6558 into tinyhumansai:main Jul 7, 2026
19 of 23 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Team Openhuman Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant