@devries-cameron20 / composio Mirror · read-only / commits / 603b8e493
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, 02:00 UTC

[codex] fix CLI binary release workflow (#3041)

## What changed - make `build:binary:cross` emit the `run-subagent-*.mjs` companion modules alongside the compiled CLI binary - update the `Build CLI Binaries` workflow to include those companion modules in the published release archives - make `install.sh` copy companion modules when they are present, while remaining backward compatible with older archives that only contain `composio` - fix the CLI installation workflow assertions to match the actual installer behavior and paths ## Why `composio run` launches a separate Bun runtime that imports the `run-subagent-*` helpers from disk. The main binary alone is not sufficient. The previous release workflow zipped only the `composio` binary, so prerelease assets installed successfully but failed at runtime with missing-module errors. The installation test workflow also had stale expectations for `~/.composio/bin/composio` and `COMPOSIO_INSTALL`, which caused false negatives even when installation itself succeeded. ## Impact - newly built CLI release assets will contain the files required for `composio run` - `install.sh` will install sidecars for new releases and ignore them for older releases - the installation workflow will validate the real install layout instead of the stale `bin/` path ## Validation - `pnpm --filter @composio/cli run build:binary:cross --target bun-darwin-arm64` from the existing checkout emitted: - `dist/binaries/composio-darwin-aarch64` - `dist/binaries/companions/run-subagent-shared.mjs` - `dist/binaries/companions/run-subagent-acp.mjs` - `dist/binaries/companions/run-subagent-legacy.mjs` - simulated the GitHub Actions archive step and verified the zip contains `composio` plus all three companion modules - earlier local binary/package validation on the main fix branch confirmed the extracted binary runs `composio run 'console.log("hello")'` successfully once those files are packaged

Rahul Tarak committed Mar 27, 2026 at 02:56 UTC 603b8e49303a39d190f76851a9b48f98e72d5ed7
4 files changed +85 -18
.github/workflows/build-cli-binaries.yml
+1
@@ -80,6 +80,7 @@ jobs:
80 rm -rf "$temp_dir"
81 mkdir -p "$temp_dir/${{ matrix.artifact }}"
82 cp "${{ matrix.artifact }}" "$temp_dir/${{ matrix.artifact }}/composio"
83 + cp companions/run-subagent-*.mjs "$temp_dir/${{ matrix.artifact }}/"
84 cd "$temp_dir" && zip -r "../${{ matrix.artifact }}.zip" "${{ matrix.artifact }}"
85 cd .. && rm -r "$temp_dir"
86
.github/workflows/cli.test-installation.yml
+18 -18
@@ -148,19 +148,19 @@ jobs:
148
149 # Verify installation
150 source ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null || true
151 - export PATH="$HOME/.composio/bin:$PATH"
151 + export PATH="$HOME/.composio:$PATH"
152
153 # Check if binary exists
154 - if [[ -f "$HOME/.composio/bin/composio" ]]; then
154 + if [[ -f "$HOME/.composio/composio" ]]; then
155 echo "✅ Binary installed successfully"
156 - ls -la "$HOME/.composio/bin/composio"
156 + ls -la "$HOME/.composio/composio"
157 else
158 echo "❌ Binary not found"
159 exit 1
160 fi
161
162 # Test binary execution
163 - if "$HOME/.composio/bin/composio" --version; then
163 + if "$HOME/.composio/composio" --version; then
164 echo "✅ Binary executes successfully"
165 else
166 echo "❌ Binary execution failed"
@@ -179,19 +179,19 @@ jobs:
179
180 # Verify installation
181 source ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null || true
182 - export PATH="$HOME/.composio/bin:$PATH"
182 + export PATH="$HOME/.composio:$PATH"
183
184 # Check if binary exists
185 - if [[ -f "$HOME/.composio/bin/composio" ]]; then
185 + if [[ -f "$HOME/.composio/composio" ]]; then
186 echo "✅ Binary installed successfully"
187 - ls -la "$HOME/.composio/bin/composio"
187 + ls -la "$HOME/.composio/composio"
188 else
189 echo "❌ Binary not found"
190 exit 1
191 fi
192
193 # Test binary execution
194 - if "$HOME/.composio/bin/composio" --version; then
194 + if "$HOME/.composio/composio" --version; then
195 echo "✅ Binary executes successfully"
196 else
197 echo "❌ Binary execution failed"
@@ -219,7 +219,7 @@ jobs:
219 fi
220
221 echo "=== Installation directory ==="
222 - ls -la ~/.composio/bin/ || echo "~/.composio/bin/ not found"
222 + ls -la ~/.composio/ || echo "~/.composio/ not found"
223
224 echo "=== Current PATH before sourcing ==="
225 echo "$PATH"
@@ -262,28 +262,28 @@ jobs:
262 echo "Checking shell configuration updates..."
263
264 if [[ "${{ matrix.shell }}" == "zsh" ]]; then
265 - if grep -q "COMPOSIO_INSTALL" ~/.zshrc; then
265 + if grep -q "COMPOSIO_INSTALL_DIR" ~/.zshrc; then
266 echo "✅ .zshrc updated with COMPOSIO_INSTALL"
267 else
268 echo "❌ .zshrc not updated"
269 exit 1
270 fi
271
272 - if grep -q "COMPOSIO_INSTALL/bin" ~/.zshrc; then
272 + if grep -q 'PATH="\\$COMPOSIO_INSTALL_DIR:\\$PATH"' ~/.zshrc; then
273 echo "✅ .zshrc updated with PATH"
274 else
275 echo "❌ .zshrc PATH not updated"
276 exit 1
277 fi
278 else
279 - if grep -q "COMPOSIO_INSTALL" ~/.bashrc; then
279 + if grep -q "COMPOSIO_INSTALL_DIR" ~/.bashrc; then
280 echo "✅ .bashrc updated with COMPOSIO_INSTALL"
281 else
282 echo "❌ .bashrc not updated"
283 exit 1
284 fi
285
286 - if grep -q "COMPOSIO_INSTALL/bin" ~/.bashrc; then
286 + if grep -q 'PATH="\\$COMPOSIO_INSTALL_DIR:\\$PATH"' ~/.bashrc; then
287 echo "✅ .bashrc updated with PATH"
288 else
289 echo "❌ .bashrc PATH not updated"
@@ -300,7 +300,7 @@ jobs:
300 rm -rf ~/.composio
301
302 # Test with custom directory using the same version as the workflow
303 - export COMPOSIO_INSTALL="/tmp/custom-composio"
303 + export COMPOSIO_INSTALL_DIR="/tmp/custom-composio"
304 if [[ "${{ steps.release_target.outputs.use_latest }}" == "true" ]]; then
305 bash install.sh
306 else
@@ -309,16 +309,16 @@ jobs:
309 fi
310
311 # Verify custom installation
312 - if [[ -f "/tmp/custom-composio/bin/composio" ]]; then
312 + if [[ -f "/tmp/custom-composio/composio" ]]; then
313 echo "✅ Custom directory installation successful"
314 - ls -la "/tmp/custom-composio/bin/composio"
314 + ls -la "/tmp/custom-composio/composio"
315 else
316 echo "❌ Custom directory installation failed"
317 exit 1
318 fi
319
320 # Test execution
321 - if "/tmp/custom-composio/bin/composio" --version; then
321 + if "/tmp/custom-composio/composio" --version; then
322 echo "✅ Custom installation executes successfully"
323 else
324 echo "❌ Custom installation execution failed"
@@ -333,7 +333,7 @@ jobs:
333 rm -rf ~/.composio /tmp/custom-composio
334
335 # Check if binary is gone
336 - if [[ ! -f "$HOME/.composio/bin/composio" ]]; then
336 + if [[ ! -f "$HOME/.composio/composio" ]]; then
337 echo "✅ Binary removed successfully"
338 else
339 echo "❌ Binary removal failed"
install.sh
+15
@@ -164,12 +164,27 @@ mkdir -p "$COMPOSIO_INSTALL_DIR" ||
164 error "Failed to create install directory \"$COMPOSIO_INSTALL_DIR\""
165
166 exe="$COMPOSIO_INSTALL_DIR/composio"
167 +companion_modules=(
168 + "run-subagent-shared.mjs"
169 + "run-subagent-acp.mjs"
170 + "run-subagent-legacy.mjs"
171 +)
172
173 # Handle nested directory structure (composio-<target>/composio)
174 if [[ -f "$tmpdir/composio-$target/composio" ]]; then
175 mv "$tmpdir/composio-$target/composio" "$exe"
176 + for module in "${companion_modules[@]}"; do
177 + if [[ -f "$tmpdir/composio-$target/$module" ]]; then
178 + mv "$tmpdir/composio-$target/$module" "$COMPOSIO_INSTALL_DIR/$module"
179 + fi
180 + done
181 elif [[ -f "$tmpdir/composio" ]]; then
182 mv "$tmpdir/composio" "$exe"
183 + for module in "${companion_modules[@]}"; do
184 + if [[ -f "$tmpdir/$module" ]]; then
185 + mv "$tmpdir/$module" "$COMPOSIO_INSTALL_DIR/$module"
186 + fi
187 + done
188 else
189 error 'Binary not found in extracted archive'
190 fi
ts/packages/cli/scripts/build-binary-cross.ts
+51
@@ -14,6 +14,7 @@
14 * Output: `dist/binaries/<artifact-name>`
15 */
16
17 +import { mkdir } from 'node:fs/promises';
18 import process from 'node:process';
19 import { Config, ConfigProvider, Console, Effect, Stream, Logger, Layer, LogLevel } from 'effect';
20 import { Command } from '@effect/platform';
@@ -32,6 +33,12 @@ const TARGET_MAP: Record<string, string> = {
33
34 const VALID_TARGETS = Object.keys(TARGET_MAP);
35
36 +const RUN_COMPANION_MODULE_BASENAMES = [
37 + 'run-subagent-shared',
38 + 'run-subagent-acp',
39 + 'run-subagent-legacy',
40 +] as const;
41 +
42 function parseTarget(): { target: string; artifact: string } {
43 const targetIdx = process.argv.indexOf('--target');
44 if (targetIdx === -1 || !process.argv[targetIdx + 1]) {
@@ -106,6 +113,50 @@ export function buildBinaryCross() {
113 return yield* Effect.fail(new Error(`Failed to cross-compile binary for ${target}`));
114 }
115
116 + const companionOutputDir = './dist/binaries/companions';
117 + yield* Effect.tryPromise(() => mkdir(companionOutputDir, { recursive: true }));
118 +
119 + for (const name of RUN_COMPANION_MODULE_BASENAMES) {
120 + const companionArgs = [
121 + 'bun',
122 + 'build',
123 + `./src/services/${name}.ts`,
124 + '--outfile',
125 + `${companionOutputDir}/${name}.mjs`,
126 + '--format',
127 + 'esm',
128 + '--target',
129 + 'bun',
130 + ] as const satisfies ReadonlyArray<string>;
131 +
132 + const companionCmd = Command.make(...companionArgs);
133 + const { exitCode: companionExitCode } = yield* companionCmd.pipe(
134 + Command.start,
135 + Effect.flatMap(process =>
136 + Effect.all(
137 + {
138 + exitCode: process.exitCode,
139 + output: Stream.merge(
140 + Stream.decodeText(process.stdout, 'utf-8'),
141 + Stream.decodeText(process.stderr, 'utf-8'),
142 + { haltStrategy: 'left' }
143 + ).pipe(
144 + Stream.tap(chunk => Console.log(chunk)),
145 + Stream.runDrain
146 + ),
147 + },
148 + {
149 + concurrency: 'unbounded',
150 + }
151 + )
152 + )
153 + );
154 +
155 + if (companionExitCode !== 0) {
156 + return yield* Effect.fail(new Error(`Failed to build companion module: ${name}`));
157 + }
158 + }
159 +
160 yield* Console.log(`Binary cross-compiled: ${outfile}`);
161 });
162 }