Skip to content

fix(composio): gracefully handle unknown method for trigger settings RPC#1784

Merged
senamakel merged 4 commits into
tinyhumansai:mainfrom
graycyrus:fix/1597-composio-trigger-settings-rpc
May 16, 2026
Merged

fix(composio): gracefully handle unknown method for trigger settings RPC#1784
senamakel merged 4 commits into
tinyhumansai:mainfrom
graycyrus:fix/1597-composio-trigger-settings-rpc

Conversation

@graycyrus
Copy link
Copy Markdown
Contributor

@graycyrus graycyrus commented May 15, 2026

Summary

  • Wraps openhumanGetComposioTriggerSettings and openhumanUpdateComposioTriggerSettings in try/catch that detects "unknown method" errors from stale core sidecar binaries
  • Returns safe defaults (triage_disabled: false, empty toolkits array) instead of propagating the error to Sentry
  • Non-"unknown method" errors still propagate normally

Closes #1597

Test plan

  • Added 4 unit tests: graceful degradation for both get/update, and error re-throw for non-unknown-method errors
  • All 14 config tests pass
  • ESLint clean on changed files
  • Prettier clean on changed files
  • N/A: No Rust changes — dispatch chain already correct on main
  • N/A: No E2E changes — settings panel already handles defaults at UI level

Summary by CodeRabbit

  • Bug Fixes
    • Better compatibility with older core versions: unavailable Composio configuration calls are handled gracefully, returning sensible defaults and logging a graceful-degradation message instead of causing failures.
  • Tests
    • Added tests ensuring unknown-method errors yield no-op/default responses and that other error types continue to be propagated.

Review Change Stack

When users have a stale core sidecar that predates the composio trigger
settings controller, the frontend now returns safe defaults instead of
propagating "unknown method" errors to Sentry.

Closes tinyhumansai#1597
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

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: 4358bc45-0a35-4747-84ee-34aab798e8b9

📥 Commits

Reviewing files that changed from the base of the PR and between 9e92ff0 and 96b01ba.

📒 Files selected for processing (2)
  • app/src/utils/tauriCommands/config.test.ts
  • app/src/utils/tauriCommands/config.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/src/utils/tauriCommands/config.ts
  • app/src/utils/tauriCommands/config.test.ts

📝 Walkthrough

Walkthrough

Wrap Composio trigger RPCs in try/catch; on core "unknown method" errors return safe fallbacks (empty ConfigSnapshot for update; default trigger settings for get). Add Vitest tests verifying fallbacks and that other errors are rethrown.

Changes

Composio Trigger Settings Error Resilience

Layer / File(s) Summary
RPC error handling and fallbacks
app/src/utils/tauriCommands/config.ts
Import tauriErrorMessage and add try/catch around openhuman.config_update_composio_trigger_settings and openhuman.config_get_composio_trigger_settings; on unknown method return an empty ConfigSnapshot (update) or default trigger settings (triage_disabled: false, triage_disabled_toolkits: []) with logs: [], otherwise rethrow.
Vitest coverage for unknown-method handling
app/src/utils/tauriCommands/config.test.ts
Add tests that simulate unknown method rejections and assert the fallback results for update/get, and that non-unknown errors are rethrown.

Sequence Diagram

sequenceDiagram
  participant Frontend as Frontend/Tauri
  participant CoreRpc as callCoreRpc
  participant ErrorCheck as tauriErrorMessage

  Frontend->>CoreRpc: openhuman.config_get_composio_trigger_settings / update
  CoreRpc-->>Frontend: reject (error)
  Frontend->>ErrorCheck: tauriErrorMessage(error)
  alt message == "unknown method"
    Frontend-->>Frontend: return fallback (default settings or empty ConfigSnapshot + logs: [])
  else
    Frontend-->>Frontend: rethrow error
  end
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

working

Poem

🐰 A sidecar ages, methods hide from sight,
The rabbit catches errors, keeps the UI polite,
When "unknown" whispers, defaults softly bloom,
Logs stay tidy, and features hum in the room. 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: gracefully handling unknown method errors for Composio trigger settings RPC calls by returning safe defaults instead of propagating errors.
Linked Issues check ✅ Passed The PR fully addresses the coding requirements from #1597: wraps both RPC helper functions in try/catch to detect unknown method errors, returns safe defaults (triage_disabled: false, empty toolkits array) instead of surfacing to Sentry, and includes comprehensive unit tests validating graceful degradation and error re-throw behavior.
Out of Scope Changes check ✅ Passed All changes are scoped to gracefully handling unknown method errors for Composio trigger settings: modifications to config.ts handlers and addition of test coverage in config.test.ts remain within the PR's stated objectives.

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

@graycyrus graycyrus marked this pull request as ready for review May 15, 2026 08:28
@graycyrus graycyrus requested a review from a team May 15, 2026 08:28
Copy link
Copy Markdown
Contributor

@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 `@app/src/utils/tauriCommands/config.ts`:
- Around line 307-310: The stale-core fallback is returning an unsafe cast "{}
as ConfigSnapshot" which can break callers that expect required fields; replace
that cast with a real default ConfigSnapshot object containing all required
properties (at minimum provide safe defaults for config, workspace_dir, and
config_path) in the branch where tauriErrorMessage(err).includes('unknown
method') so consumers reading those fields won't crash (update the return inside
that if block that currently returns { result: {} as ConfigSnapshot, logs: []
}).
🪄 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

Run ID: 06a57d0d-56ee-4872-a065-b809004367e5

📥 Commits

Reviewing files that changed from the base of the PR and between 45cd01a and cfb0ee5.

📒 Files selected for processing (2)
  • app/src/utils/tauriCommands/config.test.ts
  • app/src/utils/tauriCommands/config.ts

Comment thread app/src/utils/tauriCommands/config.ts
Copy link
Copy Markdown
Contributor Author

@graycyrus graycyrus left a comment

Choose a reason for hiding this comment

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

Walkthrough

Clean, focused fix for #1597 — wraps the two composio trigger settings RPC calls in try/catch to gracefully degrade when users are running a stale core sidecar that doesn't have these methods registered. The get function returns safe defaults, the update returns a no-op response. Good test coverage with 4 new tests. One type-safety issue to address and a logging gap per project standards.

Change Summary

File Change type Description
app/src/utils/tauriCommands/config.ts Modified Added try/catch with "unknown method" detection around both composio RPC calls, returning fallback values
app/src/utils/tauriCommands/config.test.ts Modified Added 4 tests: graceful degradation + error re-throw for both get and update functions

Per-file analysis

config.ts

The openhumanGetComposioTriggerSettings fallback is well-constructed — { triage_disabled: false, triage_disabled_toolkits: [] } matches the ComposioTriggerSettings interface properly.

The openhumanUpdateComposioTriggerSettings fallback uses {} as ConfigSnapshot which is an unsafe cast — see inline comment.

Neither catch block logs the graceful degradation, which makes silent failures harder to diagnose in the field.

config.test.ts

Tests are solid — they cover both the graceful path and the re-throw path for each function. Issue reference (#1597) in test names is a nice touch for traceability. Structure matches existing test patterns in the file.

Comment thread app/src/utils/tauriCommands/config.ts Outdated
} catch (err) {
if (tauriErrorMessage(err).includes('unknown method')) {
// Stale core sidecar predates composio trigger settings (#1597).
return { result: {} as ConfigSnapshot, logs: [] };
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[major] {} as ConfigSnapshot is an unsafe type cast that hides missing required fields (config, workspace_dir, config_path). If any future caller reads these fields from the update response, they'll get undefined at runtime while TypeScript thinks they're populated.

The current caller (ComposioTriagePanel) doesn't inspect the result beyond awaiting it, so this won't break today — but it's a footgun.

Suggestion — provide a structurally valid default:

return { result: { config: {}, workspace_dir: '', config_path: '' } as ConfigSnapshot, logs: [] };

Or, if you'd rather be explicit that this is a degraded response, consider a Partial<ConfigSnapshot> return type for the fallback path (though that's a larger change).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9e92ff0 — replaced the unsafe cast with a structurally valid default: { config: {}, workspace_dir: '', config_path: '' }.

});
} catch (err) {
if (tauriErrorMessage(err).includes('unknown method')) {
// Stale core sidecar predates composio trigger settings (#1597).
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[minor] Per project standards (known issues watchlist), new/changed error flows should include debug logging with grep-friendly prefixes. These catch blocks silently degrade, which makes it harder to diagnose version-mismatch issues in the field.

Suggestion — add a debug log in both catch blocks:

import debug from 'debug';
const log = debug('composio:rpc');
// ...
log('graceful degradation: stale core lacks openhuman.config_update_composio_trigger_settings (#1597)');

This way DEBUG=composio:* surfaces these in dev, and they're zero-cost in production.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9e92ff0 — added debug('composio:rpc') logging in both catch blocks. Surfaces via DEBUG=composio:* in dev, zero-cost in production.

- Replace `{} as ConfigSnapshot` with structurally valid default
  `{ config: {}, workspace_dir: '', config_path: '' }`
- Add debug logging in both catch blocks for field diagnostics
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 15, 2026
@graycyrus
Copy link
Copy Markdown
Contributor Author

@graycyrus CI is failing on changes in this PR — please fix before review.

@senamakel senamakel self-assigned this May 16, 2026
senamakel added 2 commits May 15, 2026 19:43
Wrap long debug() log lines and inline the small toEqual object so
`pnpm format:check` passes in CI.
@coderabbitai coderabbitai Bot added the working A PR that is being worked on by the team. label May 16, 2026
@senamakel senamakel merged commit efab59b into tinyhumansai:main May 16, 2026
24 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

working A PR that is being worked on by the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RPC 'openhuman.get_composio_trigger_settings' unknown — frontend/core version mismatch

2 participants