@devries-cameron20 / composio Mirror · read-only / commits / 8a0ce7d96
Fork 0

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 22, 00:45 UTC

Harden `run subAgent` output handling and skip zsh completions on install (#3050)

## Summary - Hardened `composio run` subagent execution to preserve structured output and recover more reliably when the primary prompt result is malformed. - Added a dedicated MCP helper for structured output so helper runs can write results through a file-backed path instead of relying only on stderr/stdout parsing. - Propagated run log and artifact paths through helper context so subagent logs land in the run log file consistently. - Skipped zsh completion installation in `install.sh` and the CLI installer to avoid broken completion wiring for zsh users. - Refreshed the CLI lockfile and bundled the new MCP runtime dependency into the CLI package. ## Testing - `Not run`

Rahul Tarak committed Mar 27, 2026 at 06:04 UTC 8a0ce7d96b47b3756e3cb501904acbaaedfce6d6
3 files changed +12 -10
install.sh
+1 -1
@@ -273,7 +273,7 @@ else
273 else
274 info "PATH already configured in \"$(tildify "$zsh_config")\""
275 fi
276 - refresh_command="exec $SHELL"
276 + refresh_command="source $(tildify "$zsh_config")"
277 else
278 echo "Manually add the directory to $(tildify "$zsh_config") (or similar):"
279 for cmd in "${commands[@]}"; do info_bold " $cmd"; done
ts/packages/cli/src/commands/install.cmd.ts
+5 -3
@@ -162,7 +162,7 @@ export const installShellIntegration = (params: {
162 // Lazy-import the root command to avoid a circular dependency
163 // (index.ts → install.cmd.ts → index.ts).
164 let completionScript: string | undefined;
165 - if (!params.noCompletions) {
165 + if (!params.noCompletions && shell !== 'zsh') {
166 const mod = yield* Effect.promise(() => import('src/commands'));
167 const lines = yield* getCompletionScript(mod.rootCommand, shell);
168 completionScript = lines.length > 0 ? Arr.join(lines, '\n') : undefined;
@@ -191,7 +191,9 @@ export const installShellIntegration = (params: {
191 yield* ui.log.step('PATH: already configured');
192 }
193
194 - if (config.completionBlock && !fileContains(existing, COMPLETIONS_MARKER)) {
194 + if (shell === 'zsh') {
195 + yield* ui.log.step('Completions: skipped for zsh');
196 + } else if (config.completionBlock && !fileContains(existing, COMPLETIONS_MARKER)) {
197 blocks.push(config.completionBlock);
198 yield* ui.log.step('Completions: will install shell completions');
199 } else if (params.noCompletions) {
@@ -222,7 +224,7 @@ export const installShellIntegration = (params: {
224
225 yield* ui.log.success(`Updated ${tildify(rcPath, os.homedir)}`);
226 yield* ui.note(
225 - shell === 'fish' ? `source ${tildify(rcPath, os.homedir)}` : 'exec $SHELL',
227 + shell === 'fish' || shell === 'zsh' ? `source ${tildify(rcPath, os.homedir)}` : 'exec $SHELL',
228 'Restart your shell to apply changes'
229 );
230 } else {
ts/packages/cli/test/src/commands/install.cmd.test.ts
+6 -6
@@ -31,7 +31,7 @@ describe('CLI: composio install', () => {
31
32 describe('[When] shell is zsh', () => {
33 layer(TestLive())(it => {
34 - it.scoped('[Then] creates .zshrc with PATH and completions', () =>
34 + it.scoped('[Then] creates .zshrc with PATH only', () =>
35 Effect.gen(function* () {
36 const os = yield* NodeOs;
37 process.env.SHELL = '/bin/zsh';
@@ -46,14 +46,15 @@ describe('CLI: composio install', () => {
46 expect(contents).toContain('# Composio CLI');
47 expect(contents).toContain('export COMPOSIO_INSTALL_DIR=');
48 expect(contents).toContain('export PATH="$COMPOSIO_INSTALL_DIR:$PATH"');
49 - expect(contents).toContain('# Composio CLI completions');
49 + expect(contents).not.toContain('# Composio CLI completions');
50
51 const lines = yield* MockConsole.getLines();
52 const output = lines.join('\n');
53 expect(output).toContain('Detected shell: zsh');
54 expect(output).toContain('PATH: will add');
55 - expect(output).toContain('Completions: will install shell completions');
55 + expect(output).toContain('Completions: skipped for zsh');
56 expect(output).toContain('Updated');
57 + expect(output).toContain('source ~/.zshrc');
58 })
59 );
60 });
@@ -153,7 +154,7 @@ describe('CLI: composio install', () => {
154 expect(pathMarkerCount).toBe(1);
155
156 const completionsCount = contents.match(/^# Composio CLI completions$/gm)?.length ?? 0;
156 - expect(completionsCount).toBe(1);
157 + expect(completionsCount).toBe(0);
158 })
159 );
160 });
@@ -180,13 +181,12 @@ describe('CLI: composio install', () => {
181 const lines = yield* MockConsole.getLines();
182 const output = lines.join('\n');
183 expect(output).toContain('PATH: already configured');
183 - expect(output).toContain('Completions: already configured');
184 + expect(output).toContain('Completions: skipped for zsh');
185 expect(output).toContain('Shell integration already configured');
186
187 // File should not have grown
188 const contents = yield* fs.readFileString(rcPath);
189 const markerCount = contents.split('# Composio CLI').length - 1;
189 - // "# Composio CLI" appears in both the PATH block marker and the completions marker
190 expect(markerCount).toBe(2);
191 })
192 );