mirror of
https://github.com/ComposioHQ/composio.git
synced 2026-09-22 11:46:35 +08:00
a0c3bcc2c8
## Problem `composio upgrade` from `0.3.4-beta.351` to `0.4.0-beta.359` looked hung for several minutes: ``` ◐ New version available: @composio/cli@0.4.0-beta.359 (current: @composio/cli@0.3.4-beta.351). Downloading. ``` Two independent defects behind that. **No feedback.** `upgrade-binary.ts` printed that message once and then said nothing until the download finished. The only byte-level signal was a `logDebug`, invisible in a normal run, because the body was read with a single buffered `response.arrayBuffer`. **Mostly wasted payload.** The archive is 338 MB, and ~651 MB of what it unpacks is `codex-acp` binaries for the three platforms the host cannot execute. Measured on a darwin-arm64 install: ``` ~/.composio 967 MB total codex/darwin-arm64 180 MB ← the only one this Mac can run codex/darwin-x64 190 MB ┐ codex/linux-arm64 208 MB ├─ 620 MB of dead weight codex/linux-x64 222 MB ┘ ``` ## Changes **Progress reporting.** The response is streamed and reported on a 250 ms interval: `Downloading... 42% (142.0 MB / 338.0 MB)`. The total comes from the release asset's `size` (newly decoded — the field was being dropped), falling back to `content-length`, and falling back again to a plain byte count so an unknown size degrades instead of failing. **Half the payload.** Each archive now carries real bytes only for the `codex-acp` binary its own platform can execute. The other three paths cannot simply be dropped — that is exactly the break #4186 just repaired. A CLI released before 2026-08-18 verifies a downloaded package against all four codex-acp paths and refuses one missing any of them. So they ship as **empty placeholders**: the existence check passes at zero bytes, and since no host ever executes a foreign codex-acp, the placeholder is never read. Once no supported client performs that check, placeholders become plain omissions — `archiveCompanionEntries` is where that switch lives. As a guard, codex adapter resolution now requires a non-empty file, so a zero-byte binary resolves as absent and falls through to the existing bundled → PATH → npx chain rather than trying to exec it. Expected effect: download 338 MB → ~165 MB, install footprint 967 MB → ~347 MB. ## Verification - Full CLI suite: **122 files, 1262 passed, 1 skipped** - `pnpm --filter @composio/cli typecheck` — clean - The existing `upgrade-binary` download tests run against a real HTTP server and pass unchanged, covering the buffered → streamed rewrite - New tests: progress formatting (known total, unknown total, zero total, overshoot) and `archiveCompanionEntries` (all four paths named, exactly one copied, three placeholdered, portable assets copied) - `pnpm validate:changesets` — passes; note lands in `ts/packages/cli/CHANGELOG.md` Not verifiable locally: actual archive sizes and a real upgrade against a pre-2026-08-18 client. Both need a beta build — worth confirming on the beta cut from this branch before it goes near a stable promotion. Independent of the `0.4.0` release in flight; `0.4.0-beta.359` is unaffected. https://claude.ai/code/session_01JkwtxPHfobZxzvAqe53x62
64 lines
2.6 KiB
Bash
Executable File
64 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Loud failure gate: assert one release archive carries the codex-acp layout the CLI
|
|
# actually ships — every platform's path present, but real bytes only for the platform
|
|
# this archive runs on.
|
|
#
|
|
# Both halves matter, and each guards a shipped regression:
|
|
#
|
|
# - A missing path breaks `composio upgrade` for every CLI released before 2026-08-18.
|
|
# Those clients verify a downloaded package against all four codex-acp paths and
|
|
# refuse one that lacks any of them.
|
|
# - A populated foreign binary is ~200MB nobody unpacking this archive can execute,
|
|
# which is what made the upgrade download several minutes of mostly dead weight.
|
|
#
|
|
# The unit tests cover the packaging rules on synthetic inputs; only this gate looks at a
|
|
# real archive, so a change to the packaging pipeline cannot quietly reintroduce either
|
|
# state.
|
|
#
|
|
# Inputs (env): ARCHIVE (path to the .zip), ARTIFACT (its top-level directory),
|
|
# HOST_CODEX_TARGET (the one target that must carry real bytes)
|
|
set -euo pipefail
|
|
|
|
: "${ARCHIVE:?ARCHIVE is required}"
|
|
: "${ARTIFACT:?ARTIFACT is required}"
|
|
: "${HOST_CODEX_TARGET:?HOST_CODEX_TARGET is required}"
|
|
|
|
# Keep in lock-step with RUN_CODEX_ACP_BINARY_TARGETS in
|
|
# ts/packages/cli/src/services/run-companion-modules.ts. Adding a codex target there must
|
|
# extend this list, or the gate stops covering it.
|
|
codex_targets=(darwin-arm64 darwin-x64 linux-arm64 linux-x64)
|
|
|
|
fail() {
|
|
echo "::error::$1"
|
|
exit 1
|
|
}
|
|
|
|
printf '%s\n' "${codex_targets[@]}" | grep -Fxq "$HOST_CODEX_TARGET" ||
|
|
fail "HOST_CODEX_TARGET '$HOST_CODEX_TARGET' is not a known codex target (${codex_targets[*]})"
|
|
|
|
test -f "$ARCHIVE" || fail "archive not found: $ARCHIVE"
|
|
entries="$(unzip -Z1 "$ARCHIVE")"
|
|
|
|
for target in "${codex_targets[@]}"; do
|
|
entry="${ARTIFACT}/acp-adapters/codex/${target}/codex-acp"
|
|
|
|
grep -Fxq "$entry" <<<"$entries" ||
|
|
fail "missing codex-acp entry '$entry'; pre-2026-08-18 clients refuse an archive without it"
|
|
|
|
# Byte count of the entry as stored, read without extracting to disk.
|
|
size="$(unzip -p "$ARCHIVE" "$entry" | wc -c | tr -d '[:space:]')"
|
|
|
|
if [ "$target" = "$HOST_CODEX_TARGET" ]; then
|
|
[ "$size" -gt 0 ] ||
|
|
fail "'$entry' is this archive's own platform but is empty; the CLI cannot run an ACP sub-agent"
|
|
echo "ok: $target carries $size bytes (this archive's platform)"
|
|
else
|
|
[ "$size" -eq 0 ] ||
|
|
fail "'$entry' is a foreign platform but carries $size bytes; it can never execute here"
|
|
echo "ok: $target is an empty placeholder"
|
|
fi
|
|
done
|
|
|
|
echo "Archive companion layout verified for $ARTIFACT (host target: $HOST_CODEX_TARGET)."
|