Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 08:30 UTC
docs: use session result status in harness execution examples (#5004)
## Summary Align the harness integration example with the current `session.execute()` result contract. Session results have no top-level `successful` field, and `data.successful` is tool-specific rather than a general success signal. The canonical session guide already documents this correctly, but the harness example still checked only `error`, which misses failed executions with null or empty error text. ## Changes - Check `result.resultType === 'failed'` in TypeScript and `result.result_type == "failed"` in Python. - Preserve upstream error text and include the execution log ID when error text is absent. - Explain the result envelope and link to the canonical result-handling guidance. - Correct the nearby exception guidance to include requests for user input. - Remove unnecessary global toolkit and meta-tool data mocks from the OpenAPI markdown tests. Bun carries module mocks across files; the empty toolkit mock contaminated the knowledge browse catalog when CI loaded this suite first. Docs and test-isolation changes only: no SDK or site runtime changes, generated reference edits, or changeset. ## Verification - `cd docs && bun run build` passed, including TypeScript/Twoslash checks. - `cd docs && bun run lint:links` passed: no link errors. - `cd docs && bun run test` passed: 732 tests, 0 failures. - Forced the OpenAPI suite to load before the knowledge browse and toolkit schema suites in a throwaway runner: 45 passed, 0 failed. The existing browse ordering test covers the regression. - `cd docs && bun run lint` passed with warnings outside the changed test file. - Executed the exact updated Python and TypeScript example bodies with controlled session responses: completed/no error, failed/upstream error, failed/null error, and failed/empty error (8 scenarios total). Both languages reject every failed result and preserve the fallback log ID. - Opened the local docs preview in Chromium, switched to the TypeScript tab, and visually verified the updated failure check. No live external tool action was invoked; execution handling was exercised with controlled responses. No new permanent test was needed: the existing knowledge browse ordering test detected the global mock leak. The ordered smoke runner was removed after verification. The build and link checks above cover the original docs commit; the static suite and lint were run again after the test-isolation fix. ## Context Gauge action `cmtw6ww2z00460itkggry6bsy` identified real result-shape confusion against `@composio/core@0.18.1`. Its suggested blanket `data.successful` check is obsolete; this PR follows the current `resultType` / `result_type` contract instead. Reviewer: @jkomyno.