From 45e2e1f36fa4baf417f60d8c346c5c287a68197a Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Mon, 23 Nov 2026 10:36:10 -0800 Subject: [PATCH 1/6] fix(box): Pin box to the public strands-agents/box v0.3.0 release AppSec H1 (V2414030352): box shipped to customer runtimes from a personal GitHub account. Pin the box-cli archives of strands-agents/box v0.3.0, the first public release with the Boxy CLI, and its SHA-256s. - bump-box-release.ts pins the box-cli-v- archive, which holds box, its helpers, its packs and release.json. The release's box-v-* archives hold no packs. - BOX_MINIMUM_VERSION is 0.3.0, the first public box that reads the profiles the CLI writes; the old minimum has no public release page. - @box/base in 0.3.0 has no uname tool and refuses a [tool.uname] table with no command, so the CodeZip profile no longer writes one. - README and docs/box-local-testing.md download from strands-agents/box, and use aws configure sso instead of ada and Isengard. --- README.md | 13 ++-- docs/box-local-testing.md | 75 ++++++++++--------- scripts/bump-box-release.ts | 4 +- .../box-network-build-stopped.golden.txt | 6 +- src/core/project/backends/boxCodeZip.test.ts | 2 +- src/core/project/backends/boxRelease.json | 12 +-- src/core/project/backends/boxRelease.test.ts | 16 ++-- src/core/project/backends/boxRelease.ts | 7 +- src/core/project/boxProfileResolver.test.ts | 8 +- src/core/project/boxProfileResolver.ts | 4 +- src/core/project/manager.test.ts | 2 +- .../runtimeProfile/rules/additions.test.ts | 14 +--- src/core/project/templates/boxProfile.test.ts | 4 +- src/core/project/templates/boxProfile.ts | 7 +- 14 files changed, 87 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 49895bf70..090484ffe 100644 --- a/README.md +++ b/README.md @@ -208,11 +208,10 @@ to a Box project, and refuses a TypeScript runtime and a Bedrock Agent import th `agentcore export harness` refuses a Box project. Each box runtime needs its `"box": { "version": ... }` in `agentcore.json`, which create and add runtime write, and its local box profile; build and deploy stop without them. Build derives the AgentCore Runtime profile of -each runtime from its local profile. box comes from the public GitHub release `v0.1.11-preview.10` of -[mquang-amazon/box-releases](https://github.com/mquang-amazon/box-releases). No token or account -is needed to download it. When that release has no build for your machine, use the build of -`v0.1.11-linux-preview.7`, or of a later release that has one, for `agentcore dev` and the profile -checks of `build`. +each runtime from its local profile. box comes from the `box-cli` archives of the public GitHub release `v0.3.0` of +[strands-agents/box](https://github.com/strands-agents/box/releases). No token or account is +needed to download it. When that release has no build for your machine, use the build of `v0.3.0` +or a later release that has one, for `agentcore dev` and the profile checks of `build`. `src/core/project/backends/boxRelease.json` pins the Linux build of box that ships to AgentCore Runtime, with its repository, version and SHA-256. It also pins the macOS arm64 build, which the e2e @@ -255,7 +254,7 @@ agentcore invoke --runtime agent --session-id my-box-session-0000000000000000000 agentcore logs runtime --name agent --since 15m --query '"running profile"' ``` -The CodeBuild log of the deploy shows `/tmp/box.tar.gz: OK` and `box 0.1.11-preview.10`. The +The CodeBuild log of the deploy shows `/tmp/box.tar.gz: OK` and `box 0.3.0`. The second answer should say teal, and the runtime log shows `running profile ...` with no `ERROR`, `blocked by egress control` or `AccessDenied` line. For a CodeZip agent, use `--template agent-python-strands-box` and skip the container settings. @@ -278,7 +277,7 @@ private VPC with no internet path. It writes `"containment": "PRIVATE_VPC"` on t - `ExpiredTokenException` from `aws` or `deploy`: your AWS credentials expired. Refresh them and run the command again. - `curl: (22) The requested URL returned error: 404` in the CodeBuild log, or a deploy error that - names the release URL: the pinned version is not published in `mquang-amazon/box-releases`. + names the release URL: the pinned version is not published in `strands-agents/box`. - `SHA-256 ... not the pinned` or `sha256sum: WARNING: 1 computed checksum did NOT match`: the release asset changed after it was pinned. Nothing was installed. - `box run` exits with an error in the runtime log: box refused its profile, and the agent does diff --git a/docs/box-local-testing.md b/docs/box-local-testing.md index 5b147d5fb..5dc987ba4 100644 --- a/docs/box-local-testing.md +++ b/docs/box-local-testing.md @@ -16,7 +16,7 @@ A Box project ships box inside its deploy artifact, so the agent runs in a box o Runtime. Each box runtime names its box release in `agentcore.json` with `"box": { "version": "" }`, which `agentcore create` writes. `agentcore build` and `agentcore deploy` download that release's Linux build from -[mquang-amazon/box-releases](https://github.com/mquang-amazon/box-releases) once into +[strands-agents/box](https://github.com/strands-agents/box/releases) once into `~/.agentcore/box/`, check its SHA-256s, and stage it into the zip, for a CodeZip runtime. For a container they write the release and its checksum into `.box-dist/box-release.env` instead. A container image downloads the Linux build while it builds, under `agentcore dev` too. For a @@ -41,10 +41,9 @@ to it. [aws/agentcore-l3-cdk-constructs#470](https://github.com/aws/agentcore-l3-cdk-constructs/pull/470), as its `box-integration` branch does. The Box gateway that `create` writes has `enableApplicationLogs`, and an older L3 refuses it at synth with a `ConfigValidationError`. -- `box` `0.1.11-preview.10` on your `PATH`, the release the CLI pins. The oldest box that - works is `0.1.11-linux-preview.7`, the first release with - [strands-agents/staging-boxy#625](https://github.com/strands-agents/staging-boxy/pull/625), which - the default telemetry target of the AgentCore Runtime profile needs. Build, deploy and dev run it +- `box` `0.3.0` on your `PATH`, the release the CLI pins and the oldest box that works: the + first public release whose telemetry target can read its settings from the host, which the + default telemetry target of the AgentCore Runtime profile needs. Build, deploy and dev run it to read the box profile with `box profile show --format json --full`, and CodeZip dev runs the agent with it. See [Install box](#install-box). - AWS credentials for a **dev or test** account. Build writes the Box gateway's Bedrock and @@ -55,9 +54,11 @@ to it. ## Install box box ships as a release archive per machine on -[mquang-amazon/box-releases](https://github.com/mquang-amazon/box-releases). There are builds for -macOS on an Apple chip (`aarch64-apple-darwin`) and Linux arm64 (`aarch64-unknown-linux-gnu`); there -is no x86 build yet. Each archive unpacks flat: `box`, its two helpers, `release.json`, and +[strands-agents/box](https://github.com/strands-agents/box/releases). The CLI uses the +`box-cli-v-*` archives, with builds for macOS on an Apple chip (`aarch64-apple-darwin`), +Linux arm64 (`aarch64-unknown-linux-gnu`) and Linux x86_64 (`x86_64-unknown-linux-gnu`). The +release's `box-v-*` archives hold box without its packs; do not use them. Each `box-cli` +archive unpacks flat: `box`, its two helpers, `release.json`, and `resources/` (box's packs, which it finds beside itself). Download the archive for your machine, check it, and unpack it into a versioned folder. @@ -65,21 +66,21 @@ Download the archive for your machine, check it, and unpack it into a versioned macOS on an Apple chip: ``` -mkdir -p ~/.local/share/box/0.1.11-preview.10 && cd ~/.local/share/box/0.1.11-preview.10 -curl -fSLO https://github.com/mquang-amazon/box-releases/releases/download/v0.1.11-preview.10/box-v0.1.11-preview.10-aarch64-apple-darwin.tar.gz -curl -fSLO https://github.com/mquang-amazon/box-releases/releases/download/v0.1.11-preview.10/SHA256SUMS.txt -grep aarch64-apple-darwin SHA256SUMS.txt | shasum -a 256 -c - -tar -xzf box-v0.1.11-preview.10-aarch64-apple-darwin.tar.gz +mkdir -p ~/.local/share/box/0.3.0 && cd ~/.local/share/box/0.3.0 +curl -fSLO https://github.com/strands-agents/box/releases/download/v0.3.0/box-cli-v0.3.0-aarch64-apple-darwin.tar.gz +curl -fSLO https://github.com/strands-agents/box/releases/download/v0.3.0/SHA256SUMS.txt +grep box-cli-v0.3.0-aarch64-apple-darwin SHA256SUMS.txt | shasum -a 256 -c - +tar -xzf box-cli-v0.3.0-aarch64-apple-darwin.tar.gz ``` Linux arm64: ``` -mkdir -p ~/.local/share/box/0.1.11-preview.10 && cd ~/.local/share/box/0.1.11-preview.10 -curl -fSLO https://github.com/mquang-amazon/box-releases/releases/download/v0.1.11-preview.10/box-v0.1.11-preview.10-aarch64-unknown-linux-gnu.tar.gz -curl -fSLO https://github.com/mquang-amazon/box-releases/releases/download/v0.1.11-preview.10/SHA256SUMS.txt -grep aarch64-unknown-linux-gnu SHA256SUMS.txt | sha256sum -c - -tar -xzf box-v0.1.11-preview.10-aarch64-unknown-linux-gnu.tar.gz +mkdir -p ~/.local/share/box/0.3.0 && cd ~/.local/share/box/0.3.0 +curl -fSLO https://github.com/strands-agents/box/releases/download/v0.3.0/box-cli-v0.3.0-aarch64-unknown-linux-gnu.tar.gz +curl -fSLO https://github.com/strands-agents/box/releases/download/v0.3.0/SHA256SUMS.txt +grep box-cli-v0.3.0-aarch64-unknown-linux-gnu SHA256SUMS.txt | sha256sum -c - +tar -xzf box-cli-v0.3.0-aarch64-unknown-linux-gnu.tar.gz ``` The check must print `OK`. @@ -87,8 +88,8 @@ The check must print `OK`. Put the folder first on your `PATH`, for this shell and for new ones (use `~/.bashrc` for bash): ``` -export PATH="$HOME/.local/share/box/0.1.11-preview.10:$PATH" -grep -q 'share/box/0.1.11-preview.10' ~/.zshrc || echo 'export PATH="$HOME/.local/share/box/0.1.11-preview.10:$PATH"' >> ~/.zshrc +export PATH="$HOME/.local/share/box/0.3.0:$PATH" +grep -q 'share/box/0.3.0' ~/.zshrc || echo 'export PATH="$HOME/.local/share/box/0.3.0:$PATH"' >> ~/.zshrc ``` The `grep -q ... ||` adds the line only once, so running it again does not repeat it. When you move @@ -103,11 +104,11 @@ box --version - `which box` must name the folder you unpacked into. An older `box` earlier on your `PATH` (a source build, or Box Core's `box` in `/usr/local/bin`) wins otherwise. -- `box --version` should print the pinned `box 0.1.11-preview.10` (from +- `box --version` should print the pinned `box 0.3.0` (from `src/core/project/backends/boxRelease.json`). Build, deploy and dev accept - `0.1.11-linux-preview.7` or later. + `0.3.0` or later. - On macOS, if Gatekeeper refuses to run `box`, clear the download flag with - `xattr -dr com.apple.quarantine "$HOME/.local/share/box/0.1.11-preview.10"`. + `xattr -dr com.apple.quarantine "$HOME/.local/share/box/0.3.0"`. To move to a newer release, unpack it into its own folder the same way and change the `PATH` line to that folder. @@ -149,13 +150,16 @@ bun install ## 1. Get AWS credentials -Deploy creates real resources, so it needs write access. This example uses `ada` with an -Isengard dev account; use whatever grants credentials for your dev account. +Deploy creates real resources, so it needs write access to a development AWS account. Sign in +with IAM Identity Center, or configure access keys, in the profile you deploy with: ``` -ada credentials update --account --provider isengard --role Admin +aws configure sso --profile +export AWS_PROFILE= ``` +`aws configure` works too, for access keys. + ## 2. Build and pack the local L3 constructs `npm pack` makes a tarball you install into the generated CDK app. This is more reliable than a @@ -203,7 +207,7 @@ Runtime profile, its policy files, and box in the `.box-dist/` folder of the cod build context, and write a copy of the profile, the generated packs, and the policy files into `.box//aws/` for you to read. -Box `0.1.11-linux-preview.7` names its packs `@box/base`, `@box/bedrock`, and `@box/agentcore`. +Box `0.3.0` names its packs `@box/base`, `@box/bedrock`, and `@box/agentcore`. A profile that names a pack `box/` fails: box refuses it and names the `@box/` pack. - **Gateway targets.** Each host or `host:port` that an `[egress]` entry, an `[mcp]` server @@ -313,11 +317,12 @@ runtime the usual way, and stops on one that has `box.version` with The box release has these builds: -| Machine | Build | CodeZip dev | Container dev | -| ------------------- | ------------------------------------------ | ----------- | ------------- | -| macOS, Apple chip | `box-v-aarch64-apple-darwin` | yes | yes | -| Linux, arm64 | `box-v-aarch64-unknown-linux-gnu` | yes | yes | -| Linux or macOS, x86 | none | no | no | +| Machine | Build | CodeZip dev | Container dev | +| ----------------- | ---------------------------------------------- | ----------- | ------------- | +| macOS, Apple chip | `box-cli-v-aarch64-apple-darwin` | yes | yes | +| Linux, arm64 | `box-cli-v-aarch64-unknown-linux-gnu` | yes | yes | +| Linux, x86_64 | `box-cli-v-x86_64-unknown-linux-gnu` | untested | no | +| macOS, Intel | none | no | no | - The **container** image always uses the Linux arm64 build, because AgentCore Runtime is arm64. It runs on an Apple chip Mac through Finch or Docker, and on an arm64 Linux host. An x86 host @@ -336,7 +341,7 @@ box --version aws sts get-caller-identity ``` -- `box --version` must print `0.1.11-linux-preview.7` or later. Dev and build read the profile with +- `box --version` must print `0.3.0` or later. Dev and build read the profile with `box profile show --format json --full`. The AgentCore Runtime profile signs each Box gateway backend for `${{ inputs.aws.region }}`, and its default telemetry target reads one key of `OTEL_EXPORTER_OTLP_LOGS_HEADERS`. A box release before it cannot do all of these. @@ -614,7 +619,7 @@ These outlive the stack. Delete them too: - **Dev says `'box' was not found on your PATH`.** Download the build for your machine from the box release, unpack it into a folder, add that folder to your `PATH`, then retry. - **Dev or build says Box `cannot print the profile ... as JSON`.** The `box` on your `PATH` is - older than `0.1.11-linux-preview.7`. Install that release or later. + older than `0.3.0`. Install that release or later. - **Box says `box's own packs were not found; set BOX_RESOURCES`.** A stale `BOX_RESOURCES` is set. Run `unset BOX_RESOURCES`, or open a new terminal. - **Dev starts but model calls fail with `ExpiredTokenException`.** Your `[default]` credentials @@ -632,7 +637,7 @@ These outlive the stack. Delete them too: checkout often has no agent venv yet, and box then names `.venv/bin/python` under a write grant. The error then says to run `uv sync` in the agent's folder (`app/`). - **Build cannot download box.** The error names the release URL. Check your network; a 404 - means the pinned version is not published in `mquang-amazon/box-releases`. + means the pinned version is not published in `strands-agents/box`. - **`create` fails with `ENOENT while resolving package '@opentelemetry/core'`.** The CLI's dependencies are not installed, so `bun` fell back to its global cache. Run `bun install` in the CLI checkout (see "Install the CLI's dependencies"). diff --git a/scripts/bump-box-release.ts b/scripts/bump-box-release.ts index 17feb06df..9f2b055c4 100644 --- a/scripts/bump-box-release.ts +++ b/scripts/bump-box-release.ts @@ -54,7 +54,9 @@ const version = values.box; const sums = await checksums(repo, version); /** The pinned archive of `target`, which the release must list. */ function pin(target: string): { target: string; asset: string; sha256: string } { - const asset = `box-v${version}-${target}.tar.gz`; + // The box CLI archive, which holds box, its helpers, its packs and release.json. A release's + // `box-v-*` archives hold only box and its helpers, with no packs. + const asset = `box-cli-v${version}-${target}.tar.gz`; const sha256 = sums.get(asset); if (!sha256) throw new Error(`${repo} v${version} lists no ${asset}`); return { target, asset, sha256 }; diff --git a/src/core/project/__fixtures__/box-network-build-stopped.golden.txt b/src/core/project/__fixtures__/box-network-build-stopped.golden.txt index 0342f6681..08b4ecabc 100644 --- a/src/core/project/__fixtures__/box-network-build-stopped.golden.txt +++ b/src/core/project/__fixtures__/box-network-build-stopped.golden.txt @@ -5,7 +5,7 @@ Build stopped: 10 problems in the Box profile and agentcore.json. Build wrote no .box/agent_python_strands/local/policy.dw:7:1 This rule allows requests to every host, and each gateway target needs one fixed host. Add a condition that names each host, for example context.input.host == "api.example.com". .box/agent_python_strands/local/profile.toml:4:1 The rule "pack_mirrors", which a pack in `packs` adds, allows each host that matches "*.mirror.example.com", and each gateway target needs one fixed host. Name each host in the rule, for example context.input.host == "api.example.com". .box/agent_python_strands/local/profile.toml:4:1 [egress.legacy], which a pack in `packs` adds, reads its secret from credsd://prod, and the gateway cannot read credsd. Use an env:// secret, which build stores as an API key credential. -.box/agent_python_strands/local/profile.toml:47:1 [egress.signed] signs requests to api.example.com with aws://default, and the gateway signs only for Bedrock, AgentCore, and Lambda function URL hosts. Use an env:// secret for this host, or remove the secret. -.box/agent_python_strands/local/profile.toml:51:1 [egress.wide] has the wildcard destination "*.wide.example.com", and each gateway target needs one fixed host. Name each host in `destinations`. -.box/agent_python_strands/local/profile.toml:55:1 [mcp.docs] has the destination "docs.example.com/mcp", and the gateway route of an MCP server takes a host with no path. Remove /mcp from the destination. The agent's MCP client keeps the path in its URL. +.box/agent_python_strands/local/profile.toml:44:1 [egress.signed] signs requests to api.example.com with aws://default, and the gateway signs only for Bedrock, AgentCore, and Lambda function URL hosts. Use an env:// secret for this host, or remove the secret. +.box/agent_python_strands/local/profile.toml:48:1 [egress.wide] has the wildcard destination "*.wide.example.com", and each gateway target needs one fixed host. Name each host in `destinations`. +.box/agent_python_strands/local/profile.toml:52:1 [mcp.docs] has the destination "docs.example.com/mcp", and the gateway route of an MCP server takes a host with no path. Remove /mcp from the destination. The agent's MCP client keeps the path in its URL. agentcore/agentcore.json The gateway target 'gh' for api.github.com sends the API key credential 'github' in the header Authorization with the prefix Bearer, and [egress.github] sends no credential. Make the two the same, in agentcore.json or in .box/agent_python_strands/local/profile.toml. diff --git a/src/core/project/backends/boxCodeZip.test.ts b/src/core/project/backends/boxCodeZip.test.ts index 5ea9460a3..c2c0c4ea8 100644 --- a/src/core/project/backends/boxCodeZip.test.ts +++ b/src/core/project/backends/boxCodeZip.test.ts @@ -93,7 +93,7 @@ describe("stageBoxCodeZip", () => { expect(await readFile(join(dist, "resources", "shared", "base", "pack.toml"), "utf8")).toBe( "[pack]\n", ); - // box 0.1.11-mquang.preview.9 runs the Runtime's Python with no ffi shim. + // box 0.1.11-preview.9 and later run the Runtime's Python with no ffi shim. expect(existsSync(join(dist, "ffi"))).toBe(false); // The Runtime profile is the one build derived from the local profile. const { runtimeProfile, runtimeProfileHeader } = model([]); diff --git a/src/core/project/backends/boxRelease.json b/src/core/project/backends/boxRelease.json index 4a1217169..d8aa0aed1 100644 --- a/src/core/project/backends/boxRelease.json +++ b/src/core/project/backends/boxRelease.json @@ -1,16 +1,16 @@ { "box": { - "repo": "mquang-amazon/box-releases", - "version": "0.1.11-preview.10", + "repo": "strands-agents/box", + "version": "0.3.0", "linux": { "target": "aarch64-unknown-linux-gnu", - "asset": "box-v0.1.11-preview.10-aarch64-unknown-linux-gnu.tar.gz", - "sha256": "45740d3ea768783b9a8939111ea0a26efd2dacf27ffa86104a4634ce1c2dc583" + "asset": "box-cli-v0.3.0-aarch64-unknown-linux-gnu.tar.gz", + "sha256": "9c7c01b22374b0041823429ba068745829ac3800db7c43b762f1836b54b40658" }, "darwin": { "target": "aarch64-apple-darwin", - "asset": "box-v0.1.11-preview.10-aarch64-apple-darwin.tar.gz", - "sha256": "76a3909c5c99c435b6ead470be2f401a22c6155b5b60652263bfb1af3ef57e18" + "asset": "box-cli-v0.3.0-aarch64-apple-darwin.tar.gz", + "sha256": "bc077119fe6b9c4ff84dffea4f895bd23531d7eda36c965aa5503131c69aaa70" } } } diff --git a/src/core/project/backends/boxRelease.test.ts b/src/core/project/backends/boxRelease.test.ts index fb028477b..ac70c4dd8 100644 --- a/src/core/project/backends/boxRelease.test.ts +++ b/src/core/project/backends/boxRelease.test.ts @@ -275,29 +275,29 @@ describe("publishInstall", () => { describe("the pinned releases", () => { test("pins one box, with the asset of its own version and a SHA-256", () => { - expect(BOX_MINIMUM_VERSION).toBe("0.1.11-linux-preview.7"); + expect(BOX_MINIMUM_VERSION).toBe("0.3.0"); expect(BOX_RELEASE.linux.asset).toBe( - `box-v${BOX_RELEASE.version}-aarch64-unknown-linux-gnu.tar.gz`, + `box-cli-v${BOX_RELEASE.version}-aarch64-unknown-linux-gnu.tar.gz`, ); expect(BOX_RELEASE.linux.sha256).toMatch(/^[0-9a-f]{64}$/); // The e2e workflow installs the macOS build on its macOS runner, from this pin. expect(BOX_RELEASE.darwin?.asset).toBe( - `box-v${BOX_RELEASE.version}-aarch64-apple-darwin.tar.gz`, + `box-cli-v${BOX_RELEASE.version}-aarch64-apple-darwin.tar.gz`, ); expect(BOX_RELEASE.darwin?.sha256).toMatch(/^[0-9a-f]{64}$/); expect(BOX_RELEASE_PAGE).toBe( - `https://github.com/mquang-amazon/box-releases/releases/tag/v${BOX_RELEASE.version}`, + `https://github.com/strands-agents/box/releases/tag/v${BOX_RELEASE.version}`, ); }); test("the install hint names the pinned release, and the first release for a machine it has no build for", () => { - // 0.1.11-linux-preview.7 is the first release that reads the profiles the CLI writes. + // 0.3.0 is the first public release that reads the profiles the CLI writes. expect(BOX_INSTALL_HINT).toBe( "Install box: download the build for your machine from " + - `https://github.com/mquang-amazon/box-releases/releases/tag/v${BOX_RELEASE.version}, unpack it ` + + `https://github.com/strands-agents/box/releases/tag/v${BOX_RELEASE.version}, unpack it ` + "into a folder (tar -xzf -C ), and add that folder to your PATH. When that " + - "release has no build for your machine, use box 0.1.11-linux-preview.7 " + - "(https://github.com/mquang-amazon/box-releases/releases/tag/v0.1.11-linux-preview.7) or a " + + "release has no build for your machine, use box 0.3.0 " + + "(https://github.com/strands-agents/box/releases/tag/v0.3.0) or a " + "later release that has one.", ); }); diff --git a/src/core/project/backends/boxRelease.ts b/src/core/project/backends/boxRelease.ts index cc12466d4..bde58c32c 100644 --- a/src/core/project/backends/boxRelease.ts +++ b/src/core/project/backends/boxRelease.ts @@ -46,10 +46,11 @@ const PINNED = z.object({ box: BoxReleaseSchema }).parse(pinned); export const BOX_RELEASE: BoxRelease = PINNED.box; /** - * The first box release that reads the profiles that the CLI writes: their `@box/` packs, and - * the `key` of an input of the `@box/agentcore` pack. + * The first public box release that reads the profiles that the CLI writes (their `@box/` + * packs, and the `key` of an input of the `@box/agentcore` pack), and the first in + * `strands-agents/box` with a `box-cli` archive. */ -export const BOX_MINIMUM_VERSION = "0.1.11-linux-preview.7"; +export const BOX_MINIMUM_VERSION = "0.3.0"; /** The GitHub release page of the pinned box, with a build for each machine it supports. */ export const BOX_RELEASE_PAGE = `https://github.com/${BOX_RELEASE.repo}/releases/tag/v${BOX_RELEASE.version}`; diff --git a/src/core/project/boxProfileResolver.test.ts b/src/core/project/boxProfileResolver.test.ts index db877f739..bba8af487 100644 --- a/src/core/project/boxProfileResolver.test.ts +++ b/src/core/project/boxProfileResolver.test.ts @@ -98,9 +98,9 @@ const SHOWN_POLICY = /** The last sentence of each error that says to install another box: the pinned release. */ const INSTALL = - `Install box ${BOX_RELEASE.version} (https://github.com/mquang-amazon/box-releases/releases/tag/v${BOX_RELEASE.version}), then retry. ` + - "When that release has no build for your machine, use box 0.1.11-linux-preview.7 " + - "(https://github.com/mquang-amazon/box-releases/releases/tag/v0.1.11-linux-preview.7) or a later " + + `Install box ${BOX_RELEASE.version} (https://github.com/strands-agents/box/releases/tag/v${BOX_RELEASE.version}), then retry. ` + + "When that release has no build for your machine, use box 0.3.0 " + + "(https://github.com/strands-agents/box/releases/tag/v0.3.0) or a later " + "release that has one."; /** @@ -333,7 +333,7 @@ describe("BoxCliProfileResolver", () => { "Box refused the profile .box/profile.toml:\n" + ' box: error: /work/demo/.box/profile.toml: "@box/base" is\n' + " not a pack name\n" + - "This box is older than 0.1.11-linux-preview.7, the first box that names its packs " + + "This box is older than 0.3.0, the first public box that names its packs " + `@box/. ${INSTALL}`, ); }); diff --git a/src/core/project/boxProfileResolver.ts b/src/core/project/boxProfileResolver.ts index 25ccbfbe1..f18ee6db5 100644 --- a/src/core/project/boxProfileResolver.ts +++ b/src/core/project/boxProfileResolver.ts @@ -190,8 +190,8 @@ export class BoxCliProfileResolver implements BoxProfileResolver { `Box refused the profile ${profilePath}:`, ...lines.map((line) => ` ${line}`), oldBox - ? `This box is older than ${BOX_MINIMUM_VERSION}, the first box that names its packs ` + - `@box/. ${INSTALL_BOX}` + ? `This box is older than ${BOX_MINIMUM_VERSION}, the first public box that names ` + + `its packs @box/. ${INSTALL_BOX}` : agent === undefined ? "Fix what Box reports, then retry." : `Run 'uv sync' in ${agent}, then retry.`, diff --git a/src/core/project/manager.test.ts b/src/core/project/manager.test.ts index f72d95162..11638653a 100644 --- a/src/core/project/manager.test.ts +++ b/src/core/project/manager.test.ts @@ -2164,7 +2164,7 @@ describe("FsProjectManager.build", () => { // The test runner downloads nothing, so build stops before synth and names the URL. await expect(drain(subject.build(project))).rejects.toThrow( - /downloaded from https:\/\/github\.com\/mquang-amazon\/box-releases\//, + /downloaded from https:\/\/github\.com\/strands-agents\/box\//, ); expect(commands.map(({ command }) => command[0])).toEqual(["curl"]); }); diff --git a/src/core/project/runtimeProfile/rules/additions.test.ts b/src/core/project/runtimeProfile/rules/additions.test.ts index b0327d932..43362dc11 100644 --- a/src/core/project/runtimeProfile/rules/additions.test.ts +++ b/src/core/project/runtimeProfile/rules/additions.test.ts @@ -377,20 +377,14 @@ describe("the additions rule", () => { expect(local).toEqual(before); }); - test("removes the [tool.uname] table that a CodeZip template writes, and keeps each tool table of the user", () => { + test("writes no tool table for a CodeZip template, and keeps each tool table of the user", () => { const local = createdProfile(CODEZIP); const notes = { program: "/usr/bin/notes" }; - const changed = { filesystem: { deny_write: ["${{ workspace }}/app/agent/data"] } }; - expect(Object.keys(local.tool as TomlTable)).toEqual(["uname"]); + // The pinned box's @box/base has no tools, so the template gives none the project write grant. + expect(local).not.toHaveProperty("tool"); expect(apply(local, contextOf(CODEZIP)).table).not.toHaveProperty("tool"); - expect( - apply({ ...local, tool: { ...(local.tool as TomlTable), notes } }, contextOf(CODEZIP)).table - .tool, - ).toEqual({ notes }); - expect(apply({ ...local, tool: { uname: changed } }, contextOf(CODEZIP)).table.tool).toEqual({ - uname: changed, - }); + expect(apply({ ...local, tool: { notes } }, contextOf(CODEZIP)).table.tool).toEqual({ notes }); }); test("keeps the user's packs in their order, then adds the Runtime packs once", () => { diff --git a/src/core/project/templates/boxProfile.test.ts b/src/core/project/templates/boxProfile.test.ts index abebfc965..46cb5c701 100644 --- a/src/core/project/templates/boxProfile.test.ts +++ b/src/core/project/templates/boxProfile.test.ts @@ -73,7 +73,6 @@ describe("renderBoxProfile", () => { filesystem: VENV_GRANTS, ingress: [{ listen: "127.0.0.1:8080", workload_port: 8081 }], }, - tool: { uname: { filesystem: { deny_write: VENV_GRANTS.deny_write } } }, egress: { bedrock: { secret: { ref: "aws://" } } }, }); }); @@ -96,7 +95,7 @@ describe("renderBoxProfile", () => { // agentcore dev starts box in app/, so ${{ workspace }} and the project grant are that // folder: agentcore/.env.local, with the model's key, .git and agentcore/cdk lie outside them. test("grants the agent its own folder and no other folder of the project", () => { - const { project, agent, tool } = profile("agent-python-strands-box", { + const { project, agent } = profile("agent-python-strands-box", { modelProvider: "OpenAI", apiKey: "sk-test", }); @@ -105,7 +104,6 @@ describe("renderBoxProfile", () => { const path = typeof grant === "string" ? grant : grant.path; expect(path).not.toMatch(/agentcore|\.git|\.\./); } - expect(JSON.stringify(tool)).not.toMatch(/agentcore|\.git|\.\./); }); test("names no host path, so the profile works on any machine and after a move", () => { diff --git a/src/core/project/templates/boxProfile.ts b/src/core/project/templates/boxProfile.ts index 724cc560b..7964a2223 100644 --- a/src/core/project/templates/boxProfile.ts +++ b/src/core/project/templates/boxProfile.ts @@ -85,10 +85,11 @@ const ABSOLUTE_PATH_PATTERN = "(/[.]{0,2}[A-Za-z0-9_+-][A-Za-z0-9_.+-]*)+"; /** * The tools of @box/base that get the project's write grant: box gives each one its own grant, * so each lists the agent's `deny_write` folders as well. Taken from @box/base in the box release - * that `boxRelease.json` pins (0.1.11-preview.10). When the pin moves, check the tools of - * @box/base: box refuses a CodeZip box profile if a tool it misses gets the project write grant. + * that `boxRelease.json` pins (0.3.0), which has no tools: it dropped `uname`, and refuses a + * `[tool.uname]` table with no `command`. When the pin moves, check the tools of @box/base: box + * refuses a CodeZip box profile if a tool it misses gets the project write grant. */ -const BOX_BASE_PROJECT_WRITE_TOOLS = ["uname"]; +const BOX_BASE_PROJECT_WRITE_TOOLS: readonly string[] = []; type Protocol = NonNullable; From 628782015c0036e87c36dec7ec683a13ebae3782 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Mon, 23 Nov 2026 11:00:00 -0800 Subject: [PATCH 2/6] fix(box): Pin the macOS box build to v0.3.0-preview.1 The macOS box of v0.3.0 has a broken code signature (codesign reports an invalid Info.plist), so macOS kills it at launch. Keep Linux, which ships to AgentCore Runtime, on v0.3.0, and let the darwin build name its own release: boxRelease.json gains darwin.version, bump-box-release.ts takes --darwin-box, and the e2e workflow installs each build from its own release. The minimum box is 0.3.0-preview.1, which the macOS pin satisfies. --- .github/workflows/e2e-test.yml | 3 +- README.md | 5 +-- docs/box-local-testing.md | 35 +++++++++++--------- scripts/bump-box-release.ts | 34 ++++++++++++++----- src/core/project/backends/boxRelease.json | 5 +-- src/core/project/backends/boxRelease.test.ts | 13 ++++---- src/core/project/backends/boxRelease.ts | 10 +++--- src/core/project/boxProfileResolver.test.ts | 6 ++-- src/core/project/templates/boxProfile.ts | 3 +- 9 files changed, 70 insertions(+), 44 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 29ed848e5..e0caa4eaf 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -136,7 +136,8 @@ jobs: run: | PIN=src/core/project/backends/boxRelease.json REPO=$(jq -er .box.repo "$PIN") - VER=$(jq -er .box.version "$PIN") + # A build may name its own release, for a release whose build of this machine is broken. + VER=$(jq -er ".box.${BUILD}.version // .box.version" "$PIN") ASSET=$(jq -er ".box.${BUILD}.asset" "$PIN") SHA=$(jq -er ".box.${BUILD}.sha256" "$PIN") WORK=$(mktemp -d) diff --git a/README.md b/README.md index 090484ffe..469a84832 100644 --- a/README.md +++ b/README.md @@ -210,8 +210,9 @@ to a Box project, and refuses a TypeScript runtime and a Bedrock Agent import th box profile; build and deploy stop without them. Build derives the AgentCore Runtime profile of each runtime from its local profile. box comes from the `box-cli` archives of the public GitHub release `v0.3.0` of [strands-agents/box](https://github.com/strands-agents/box/releases). No token or account is -needed to download it. When that release has no build for your machine, use the build of `v0.3.0` -or a later release that has one, for `agentcore dev` and the profile checks of `build`. +needed to download it. On macOS, use the build of `v0.3.0-preview.1`: the macOS build of `v0.3.0` has a broken code +signature. When the release has no build for your machine, use the build of `v0.3.0-preview.1` or a +later release that has one, for `agentcore dev` and the profile checks of `build`. `src/core/project/backends/boxRelease.json` pins the Linux build of box that ships to AgentCore Runtime, with its repository, version and SHA-256. It also pins the macOS arm64 build, which the e2e diff --git a/docs/box-local-testing.md b/docs/box-local-testing.md index 5dc987ba4..1993f8215 100644 --- a/docs/box-local-testing.md +++ b/docs/box-local-testing.md @@ -41,8 +41,8 @@ to it. [aws/agentcore-l3-cdk-constructs#470](https://github.com/aws/agentcore-l3-cdk-constructs/pull/470), as its `box-integration` branch does. The Box gateway that `create` writes has `enableApplicationLogs`, and an older L3 refuses it at synth with a `ConfigValidationError`. -- `box` `0.3.0` on your `PATH`, the release the CLI pins and the oldest box that works: the - first public release whose telemetry target can read its settings from the host, which the +- `box` `0.3.0` on your `PATH` (`0.3.0-preview.1` on macOS), the release the CLI pins. + `0.3.0-preview.1` is the oldest box that works: the first public release whose telemetry target can read its settings from the host, which the default telemetry target of the AgentCore Runtime profile needs. Build, deploy and dev run it to read the box profile with `box profile show --format json --full`, and CodeZip dev runs the agent with it. See [Install box](#install-box). @@ -63,14 +63,15 @@ archive unpacks flat: `box`, its two helpers, `release.json`, and Download the archive for your machine, check it, and unpack it into a versioned folder. -macOS on an Apple chip: +macOS on an Apple chip, from `v0.3.0-preview.1`: the macOS build of `v0.3.0` has a broken code +signature, and macOS stops it at launch. ``` -mkdir -p ~/.local/share/box/0.3.0 && cd ~/.local/share/box/0.3.0 -curl -fSLO https://github.com/strands-agents/box/releases/download/v0.3.0/box-cli-v0.3.0-aarch64-apple-darwin.tar.gz -curl -fSLO https://github.com/strands-agents/box/releases/download/v0.3.0/SHA256SUMS.txt -grep box-cli-v0.3.0-aarch64-apple-darwin SHA256SUMS.txt | shasum -a 256 -c - -tar -xzf box-cli-v0.3.0-aarch64-apple-darwin.tar.gz +mkdir -p ~/.local/share/box/0.3.0-preview.1 && cd ~/.local/share/box/0.3.0-preview.1 +curl -fSLO https://github.com/strands-agents/box/releases/download/v0.3.0-preview.1/box-cli-v0.3.0-preview.1-aarch64-apple-darwin.tar.gz +curl -fSLO https://github.com/strands-agents/box/releases/download/v0.3.0-preview.1/SHA256SUMS.txt +grep box-cli-v0.3.0-preview.1-aarch64-apple-darwin SHA256SUMS.txt | shasum -a 256 -c - +tar -xzf box-cli-v0.3.0-preview.1-aarch64-apple-darwin.tar.gz ``` Linux arm64: @@ -85,11 +86,13 @@ tar -xzf box-cli-v0.3.0-aarch64-unknown-linux-gnu.tar.gz The check must print `OK`. -Put the folder first on your `PATH`, for this shell and for new ones (use `~/.bashrc` for bash): +Put the folder first on your `PATH`, for this shell and for new ones (use `~/.bashrc` for bash). +`BOX_VERSION` is the folder you unpacked into: `0.3.0-preview.1` on macOS, `0.3.0` on Linux. ``` -export PATH="$HOME/.local/share/box/0.3.0:$PATH" -grep -q 'share/box/0.3.0' ~/.zshrc || echo 'export PATH="$HOME/.local/share/box/0.3.0:$PATH"' >> ~/.zshrc +BOX_VERSION=0.3.0-preview.1 +export PATH="$HOME/.local/share/box/$BOX_VERSION:$PATH" +grep -q "share/box/$BOX_VERSION" ~/.zshrc || echo "export PATH=\"\$HOME/.local/share/box/$BOX_VERSION:\$PATH\"" >> ~/.zshrc ``` The `grep -q ... ||` adds the line only once, so running it again does not repeat it. When you move @@ -104,11 +107,11 @@ box --version - `which box` must name the folder you unpacked into. An older `box` earlier on your `PATH` (a source build, or Box Core's `box` in `/usr/local/bin`) wins otherwise. -- `box --version` should print the pinned `box 0.3.0` (from +- `box --version` should print the pinned `box 0.3.0`, or `box 0.3.0-preview.1` on macOS (from `src/core/project/backends/boxRelease.json`). Build, deploy and dev accept - `0.3.0` or later. + `0.3.0-preview.1` or later. - On macOS, if Gatekeeper refuses to run `box`, clear the download flag with - `xattr -dr com.apple.quarantine "$HOME/.local/share/box/0.3.0"`. + `xattr -dr com.apple.quarantine "$HOME/.local/share/box/0.3.0-preview.1"`. To move to a newer release, unpack it into its own folder the same way and change the `PATH` line to that folder. @@ -341,7 +344,7 @@ box --version aws sts get-caller-identity ``` -- `box --version` must print `0.3.0` or later. Dev and build read the profile with +- `box --version` must print `0.3.0-preview.1` or later. Dev and build read the profile with `box profile show --format json --full`. The AgentCore Runtime profile signs each Box gateway backend for `${{ inputs.aws.region }}`, and its default telemetry target reads one key of `OTEL_EXPORTER_OTLP_LOGS_HEADERS`. A box release before it cannot do all of these. @@ -619,7 +622,7 @@ These outlive the stack. Delete them too: - **Dev says `'box' was not found on your PATH`.** Download the build for your machine from the box release, unpack it into a folder, add that folder to your `PATH`, then retry. - **Dev or build says Box `cannot print the profile ... as JSON`.** The `box` on your `PATH` is - older than `0.3.0`. Install that release or later. + older than `0.3.0-preview.1`. Install that release or later. - **Box says `box's own packs were not found; set BOX_RESOURCES`.** A stale `BOX_RESOURCES` is set. Run `unset BOX_RESOURCES`, or open a new terminal. - **Dev starts but model calls fail with `ExpiredTokenException`.** Your `[default]` credentials diff --git a/scripts/bump-box-release.ts b/scripts/bump-box-release.ts index 9f2b055c4..835e19481 100644 --- a/scripts/bump-box-release.ts +++ b/scripts/bump-box-release.ts @@ -6,7 +6,10 @@ installs on its macOS runner. It reads the release's SHA256SUMS.txt, so the file changes only to a version whose archives are published. It imports nothing from src/. - bun scripts/bump-box-release.ts --box [--box-repo ] + bun scripts/bump-box-release.ts --box [--darwin-box ] [--box-repo ] + + --darwin-box pins the macOS build of another release of the same repository, for a release whose + macOS build is broken. Without it, macOS comes from the --box release. **/ import { join, resolve } from "node:path"; @@ -27,6 +30,7 @@ const { values } = parseArgs({ args: Bun.argv.slice(2), options: { box: { type: "string" }, + "darwin-box": { type: "string" }, "box-repo": { type: "string" }, }, }); @@ -48,20 +52,32 @@ async function checksums(repo: string, version: string): Promise { // The box CLI archive, which holds box, its helpers, its packs and release.json. A release's // `box-v-*` archives hold only box and its helpers, with no packs. const asset = `box-cli-v${version}-${target}.tar.gz`; - const sha256 = sums.get(asset); + const sha256 = (await checksums(repo, version)).get(asset); if (!sha256) throw new Error(`${repo} v${version} lists no ${asset}`); return { target, asset, sha256 }; } + +const pinned = await Bun.file(FILE).json(); +const repo = values["box-repo"] ?? pinned.box.repo; +const version = values.box; +const darwinVersion = values["darwin-box"] ?? version; console.log(`box: ${pinned.box.repo} ${pinned.box.version} → ${repo} ${version}`); -const box = { repo, version, linux: pin(LINUX_TARGET), darwin: pin(DARWIN_TARGET) }; +if (darwinVersion !== version) console.log(`box macOS: ${darwinVersion}`); +const darwin = await pin(repo, darwinVersion, DARWIN_TARGET); +const box = { + repo, + version, + linux: await pin(repo, version, LINUX_TARGET), + darwin: darwinVersion === version ? darwin : { version: darwinVersion, ...darwin }, +}; await Bun.write(FILE, `${JSON.stringify({ box }, null, 2)}\n`); diff --git a/src/core/project/backends/boxRelease.json b/src/core/project/backends/boxRelease.json index d8aa0aed1..bfa3417c5 100644 --- a/src/core/project/backends/boxRelease.json +++ b/src/core/project/backends/boxRelease.json @@ -8,9 +8,10 @@ "sha256": "9c7c01b22374b0041823429ba068745829ac3800db7c43b762f1836b54b40658" }, "darwin": { + "version": "0.3.0-preview.1", "target": "aarch64-apple-darwin", - "asset": "box-cli-v0.3.0-aarch64-apple-darwin.tar.gz", - "sha256": "bc077119fe6b9c4ff84dffea4f895bd23531d7eda36c965aa5503131c69aaa70" + "asset": "box-cli-v0.3.0-preview.1-aarch64-apple-darwin.tar.gz", + "sha256": "eaf085e443d0a1f6c9e5566194e786274c5bf30d6f7681923221f5680317bb77" } } } diff --git a/src/core/project/backends/boxRelease.test.ts b/src/core/project/backends/boxRelease.test.ts index ac70c4dd8..081ecf638 100644 --- a/src/core/project/backends/boxRelease.test.ts +++ b/src/core/project/backends/boxRelease.test.ts @@ -275,14 +275,15 @@ describe("publishInstall", () => { describe("the pinned releases", () => { test("pins one box, with the asset of its own version and a SHA-256", () => { - expect(BOX_MINIMUM_VERSION).toBe("0.3.0"); + expect(BOX_MINIMUM_VERSION).toBe("0.3.0-preview.1"); expect(BOX_RELEASE.linux.asset).toBe( `box-cli-v${BOX_RELEASE.version}-aarch64-unknown-linux-gnu.tar.gz`, ); expect(BOX_RELEASE.linux.sha256).toMatch(/^[0-9a-f]{64}$/); - // The e2e workflow installs the macOS build on its macOS runner, from this pin. + // The e2e workflow installs the macOS build on its macOS runner, from this pin, of its own + // release when it names one. expect(BOX_RELEASE.darwin?.asset).toBe( - `box-cli-v${BOX_RELEASE.version}-aarch64-apple-darwin.tar.gz`, + `box-cli-v${BOX_RELEASE.darwin?.version ?? BOX_RELEASE.version}-aarch64-apple-darwin.tar.gz`, ); expect(BOX_RELEASE.darwin?.sha256).toMatch(/^[0-9a-f]{64}$/); expect(BOX_RELEASE_PAGE).toBe( @@ -291,13 +292,13 @@ describe("the pinned releases", () => { }); test("the install hint names the pinned release, and the first release for a machine it has no build for", () => { - // 0.3.0 is the first public release that reads the profiles the CLI writes. + // 0.3.0-preview.1 is the first public release that reads the profiles the CLI writes. expect(BOX_INSTALL_HINT).toBe( "Install box: download the build for your machine from " + `https://github.com/strands-agents/box/releases/tag/v${BOX_RELEASE.version}, unpack it ` + "into a folder (tar -xzf -C ), and add that folder to your PATH. When that " + - "release has no build for your machine, use box 0.3.0 " + - "(https://github.com/strands-agents/box/releases/tag/v0.3.0) or a " + + "release has no build for your machine, use box 0.3.0-preview.1 " + + "(https://github.com/strands-agents/box/releases/tag/v0.3.0-preview.1) or a " + "later release that has one.", ); }); diff --git a/src/core/project/backends/boxRelease.ts b/src/core/project/backends/boxRelease.ts index bde58c32c..903e3ed71 100644 --- a/src/core/project/backends/boxRelease.ts +++ b/src/core/project/backends/boxRelease.ts @@ -26,13 +26,15 @@ const TargetAssetSchema = AssetSchema.extend({ target: z.string().min(1) }); /** * A box release: the Linux arm64 build that ships to AgentCore Runtime. Its archive holds box, * its helpers, its packs and release.json. `darwin`, the macOS arm64 build, is what the e2e - * workflow installs on its macOS runner; the CLI does not read it. + * workflow installs on its macOS runner; the CLI does not read it. Its own `version`, when set, + * names the release it comes from instead of `version`, for a release whose macOS build is + * broken. */ const BoxReleaseSchema = z.object({ repo: z.string().min(1), version: z.string().min(1), linux: TargetAssetSchema, - darwin: TargetAssetSchema.optional(), + darwin: TargetAssetSchema.extend({ version: z.string().min(1).optional() }).optional(), }); export type BoxRelease = z.infer; @@ -48,9 +50,9 @@ export const BOX_RELEASE: BoxRelease = PINNED.box; /** * The first public box release that reads the profiles that the CLI writes (their `@box/` * packs, and the `key` of an input of the `@box/agentcore` pack), and the first in - * `strands-agents/box` with a `box-cli` archive. + * `strands-agents/box` with a `box-cli` archive. Its macOS build runs where 0.3.0's does not. */ -export const BOX_MINIMUM_VERSION = "0.3.0"; +export const BOX_MINIMUM_VERSION = "0.3.0-preview.1"; /** The GitHub release page of the pinned box, with a build for each machine it supports. */ export const BOX_RELEASE_PAGE = `https://github.com/${BOX_RELEASE.repo}/releases/tag/v${BOX_RELEASE.version}`; diff --git a/src/core/project/boxProfileResolver.test.ts b/src/core/project/boxProfileResolver.test.ts index bba8af487..a5cf75bb4 100644 --- a/src/core/project/boxProfileResolver.test.ts +++ b/src/core/project/boxProfileResolver.test.ts @@ -99,8 +99,8 @@ const SHOWN_POLICY = /** The last sentence of each error that says to install another box: the pinned release. */ const INSTALL = `Install box ${BOX_RELEASE.version} (https://github.com/strands-agents/box/releases/tag/v${BOX_RELEASE.version}), then retry. ` + - "When that release has no build for your machine, use box 0.3.0 " + - "(https://github.com/strands-agents/box/releases/tag/v0.3.0) or a later " + + "When that release has no build for your machine, use box 0.3.0-preview.1 " + + "(https://github.com/strands-agents/box/releases/tag/v0.3.0-preview.1) or a later " + "release that has one."; /** @@ -333,7 +333,7 @@ describe("BoxCliProfileResolver", () => { "Box refused the profile .box/profile.toml:\n" + ' box: error: /work/demo/.box/profile.toml: "@box/base" is\n' + " not a pack name\n" + - "This box is older than 0.3.0, the first public box that names its packs " + + "This box is older than 0.3.0-preview.1, the first public box that names its packs " + `@box/. ${INSTALL}`, ); }); diff --git a/src/core/project/templates/boxProfile.ts b/src/core/project/templates/boxProfile.ts index 7964a2223..d8d78886e 100644 --- a/src/core/project/templates/boxProfile.ts +++ b/src/core/project/templates/boxProfile.ts @@ -85,7 +85,8 @@ const ABSOLUTE_PATH_PATTERN = "(/[.]{0,2}[A-Za-z0-9_+-][A-Za-z0-9_.+-]*)+"; /** * The tools of @box/base that get the project's write grant: box gives each one its own grant, * so each lists the agent's `deny_write` folders as well. Taken from @box/base in the box release - * that `boxRelease.json` pins (0.3.0), which has no tools: it dropped `uname`, and refuses a + * that `boxRelease.json` pins (0.3.0, and 0.3.0-preview.1 for macOS), which has no tools: it + * dropped `uname`, and refuses a * `[tool.uname]` table with no `command`. When the pin moves, check the tools of @box/base: box * refuses a CodeZip box profile if a tool it misses gets the project write grant. */ From 72e2233b707e31fc1a536684a93c52880d2295f9 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Mon, 23 Nov 2026 14:14:52 -0800 Subject: [PATCH 3/6] fix(box): Send macOS to the box release whose build runs, and name the box-cli archive The install hint and the profile errors said to download the build for the machine from v0.3.0. Its macOS build does not run, so on macOS they now name the darwin pin's archive and release. They also name the box-cli archive, since the release's box-v archives have no packs. --- src/core/project/backends/boxRelease.test.ts | 15 ++++++++++----- src/core/project/backends/boxRelease.ts | 18 ++++++++++++++++-- src/core/project/boxProfileResolver.test.ts | 3 +++ src/core/project/boxProfileResolver.ts | 3 ++- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/core/project/backends/boxRelease.test.ts b/src/core/project/backends/boxRelease.test.ts index 081ecf638..d3866eb91 100644 --- a/src/core/project/backends/boxRelease.test.ts +++ b/src/core/project/backends/boxRelease.test.ts @@ -291,12 +291,17 @@ describe("the pinned releases", () => { ); }); - test("the install hint names the pinned release, and the first release for a machine it has no build for", () => { - // 0.3.0-preview.1 is the first public release that reads the profiles the CLI writes. + test("the install hint names the box-cli archive of the pinned release, the macOS release, and the first release for a machine it has no build for", () => { + // 0.3.0-preview.1 is the first public release that reads the profiles the CLI writes, and the + // macOS build of 0.3.0 does not run. expect(BOX_INSTALL_HINT).toBe( - "Install box: download the build for your machine from " + - `https://github.com/strands-agents/box/releases/tag/v${BOX_RELEASE.version}, unpack it ` + - "into a folder (tar -xzf -C ), and add that folder to your PATH. When that " + + "Install box: download box-cli-v0.3.0-.tar.gz for your machine from " + + "https://github.com/strands-agents/box/releases/tag/v0.3.0 (not a box-v0.3.0-* archive, " + + "which has no packs), unpack it into a folder (tar -xzf -C ), and add " + + "that folder to your PATH. On macOS, use " + + "box-cli-v0.3.0-preview.1-aarch64-apple-darwin.tar.gz from " + + "https://github.com/strands-agents/box/releases/tag/v0.3.0-preview.1 instead: the macOS " + + "build of 0.3.0 does not run. When that " + "release has no build for your machine, use box 0.3.0-preview.1 " + "(https://github.com/strands-agents/box/releases/tag/v0.3.0-preview.1) or a " + "later release that has one.", diff --git a/src/core/project/backends/boxRelease.ts b/src/core/project/backends/boxRelease.ts index 903e3ed71..c6d392e45 100644 --- a/src/core/project/backends/boxRelease.ts +++ b/src/core/project/backends/boxRelease.ts @@ -64,6 +64,18 @@ export const BOX_RELEASE_PAGE = `https://github.com/${BOX_RELEASE.repo}/releases */ export const BOX_MINIMUM_RELEASE_PAGE = `https://github.com/${BOX_RELEASE.repo}/releases/tag/v${BOX_MINIMUM_VERSION}`; +/** + * Where macOS gets box when the darwin pin names its own release, because the pinned release's + * macOS build does not run; empty otherwise. + */ +const DARWIN_VERSION = BOX_RELEASE.darwin?.version; +export const BOX_MACOS_HINT = + DARWIN_VERSION !== undefined && DARWIN_VERSION !== BOX_RELEASE.version + ? `On macOS, use ${BOX_RELEASE.darwin?.asset} from ` + + `https://github.com/${BOX_RELEASE.repo}/releases/tag/v${DARWIN_VERSION} instead: the ` + + `macOS build of ${BOX_RELEASE.version} does not run. ` + : ""; + /** What to install when the pinned release has no build for the machine. */ export const BOX_OTHER_MACHINE_HINT = `When that release has no build for your machine, use box ${BOX_MINIMUM_VERSION} ` + @@ -89,8 +101,10 @@ export const BOX_BINARIES = [ * dev ask for when it is not on PATH. */ export const BOX_INSTALL_HINT = - `Install box: download the build for your machine from ${BOX_RELEASE_PAGE}, unpack it into ` + - "a folder (tar -xzf -C ), and add that folder to your PATH. " + + `Install box: download box-cli-v${BOX_RELEASE.version}-.tar.gz for your machine from ` + + `${BOX_RELEASE_PAGE} (not a box-v${BOX_RELEASE.version}-* archive, which has no packs), unpack ` + + "it into a folder (tar -xzf -C ), and add that folder to your PATH. " + + BOX_MACOS_HINT + BOX_OTHER_MACHINE_HINT; /** A Linux arm64 box for AgentCore Runtime. */ diff --git a/src/core/project/boxProfileResolver.test.ts b/src/core/project/boxProfileResolver.test.ts index a5cf75bb4..83dff3aab 100644 --- a/src/core/project/boxProfileResolver.test.ts +++ b/src/core/project/boxProfileResolver.test.ts @@ -99,6 +99,9 @@ const SHOWN_POLICY = /** The last sentence of each error that says to install another box: the pinned release. */ const INSTALL = `Install box ${BOX_RELEASE.version} (https://github.com/strands-agents/box/releases/tag/v${BOX_RELEASE.version}), then retry. ` + + "On macOS, use box-cli-v0.3.0-preview.1-aarch64-apple-darwin.tar.gz from " + + "https://github.com/strands-agents/box/releases/tag/v0.3.0-preview.1 instead: the macOS build " + + "of 0.3.0 does not run. " + "When that release has no build for your machine, use box 0.3.0-preview.1 " + "(https://github.com/strands-agents/box/releases/tag/v0.3.0-preview.1) or a later " + "release that has one."; diff --git a/src/core/project/boxProfileResolver.ts b/src/core/project/boxProfileResolver.ts index f18ee6db5..ef032f054 100644 --- a/src/core/project/boxProfileResolver.ts +++ b/src/core/project/boxProfileResolver.ts @@ -11,6 +11,7 @@ import { ProcessFailedError, streamProcess, type ProcessStreamer } from "../../i import { resolveExecutable } from "../../io/exec"; import { BOX_MINIMUM_VERSION, + BOX_MACOS_HINT, BOX_OTHER_MACHINE_HINT, BOX_RELEASE, BOX_RELEASE_PAGE, @@ -51,7 +52,7 @@ export interface BoxProfileResolver { } /** What to install, which each error names when the `box` on PATH cannot resolve a profile. */ -const INSTALL_BOX = `Install box ${BOX_RELEASE.version} (${BOX_RELEASE_PAGE}), then retry. ${BOX_OTHER_MACHINE_HINT}`; +const INSTALL_BOX = `Install box ${BOX_RELEASE.version} (${BOX_RELEASE_PAGE}), then retry. ${BOX_MACOS_HINT}${BOX_OTHER_MACHINE_HINT}`; /** The refusal of an `@box/` pack by a box older than {@link BOX_MINIMUM_VERSION}. */ const OLD_BOX_PACK_NAME = /"@box\/[^"\s]+" is not a pack name/; From 2f86a75c412896589f305dfaa3492d92f63d6751 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Mon, 23 Nov 2026 14:30:08 -0800 Subject: [PATCH 4/6] chore(box): Drop the references to box 0.1.11 and its ffi shim Every box the CLI supports is 0.3.0-preview.1 or later, so: - The open routes of box profile show are a list. The one-string form, which only box 0.1.11-linux-preview.6 printed, and its fixture go. - Comments name no 0.1.11 release, and the e2e README drops its stale note about an ffi shim pin. - The fake release of the boxRelease tests uses the pinned repository and version instead of made-up ones. --- e2eTest/README.md | 4 +- .../box-profile-show-open-routes.json | 1 - src/core/project/backends/boxCodeZip.test.ts | 2 - src/core/project/backends/boxRelease.test.ts | 16 +++---- src/core/project/backends/boxRelease.ts | 4 +- .../project/boxNetwork/policyParser.test.ts | 2 +- .../boxProfileResolver-test-support.ts | 2 +- src/core/project/boxProfileResolver.test.ts | 47 +++++++------------ src/core/project/boxProfileResolver.ts | 12 +---- .../project/runtimeProfile/derive.test.ts | 2 +- .../runtimeProfile/rules/additions.test.ts | 2 +- 11 files changed, 34 insertions(+), 60 deletions(-) delete mode 100644 src/core/project/__fixtures__/box-profile-show-open-routes.json diff --git a/e2eTest/README.md b/e2eTest/README.md index 3ac2e7a71..3313da1a5 100644 --- a/e2eTest/README.md +++ b/e2eTest/README.md @@ -51,9 +51,7 @@ AGENTCORE_E2E_BOX_CDK=file:/path/to/aws-agentcore-cdk-1.1.0.tgz bun run test:e2e That runs each Box template on its default Python. The CodeZip box template on Python 3.10 to 3.13 (`py_strands_box_3_10` to `py_strands_box_3_13`) is in the runtime templates describe, so it runs -with `--tagsFilter='runtime'` or a full run, given `box` and the same opt-in. Those four cases -pass only once box runs CodeZip agents without the ffi shim (#2867): until then `boxRelease.json` -pins a shim for `PYTHON_3_14` only, so they fail on any machine. +with `--tagsFilter='runtime'` or a full run, given `box` and the same opt-in. The `box-egress` test checks that box, under `agentcore dev`, lets the agent reach the host its profile allows (`checkip.amazonaws.com`) and blocks any other (`example.com`). It reaches public diff --git a/src/core/project/__fixtures__/box-profile-show-open-routes.json b/src/core/project/__fixtures__/box-profile-show-open-routes.json deleted file mode 100644 index 59def0174..000000000 --- a/src/core/project/__fixtures__/box-profile-show-open-routes.json +++ /dev/null @@ -1 +0,0 @@ -{"profile":"open","packs":[{"name":"box/base","version":"1"}],"policies":["policy.dw"],"storage":"/private/tmp/acbox/home/.box/storage/open/default","project":null,"inputs":[{"name":"terminal.colorterm","value":"truecolor","source":"default"},{"name":"terminal.term","value":"xterm-256color","source":"env:TERM"}],"skipped":[],"dropped":[],"open_routes":[{"route":"auth","destinations":"login.example.com, auth.example.com:8443"},{"route":"github","destinations":"api.github.com"}],"copies":[],"links":[],"parts":[],"mcp":{"unstarted":[],"servers":[],"dropped":[],"path_dropped":[],"skipped":[],"unread":[]},"warnings":[],"box_toml":{"name":"open-preview","box_dir":"/private/tmp/acbox/home/.box/runs/open-preview/box","policy":"policy.dw","file-attributes":true,"agent":{"command":["/bin/sh"],"workspace":"/private/tmp/acbox/demo","env":{"COLORTERM":"truecolor","PATH":"/usr/bin:/bin","TERM":"xterm-256color"},"filesystem":{"deny":["/private/tmp/acbox/demo/.box"]}},"tool":{"uname":{"command":["/usr/bin/uname"],"env":{"PATH":"/usr/bin:/bin","TMPDIR":"/private/tmp/acbox/home/.box/runs/open-preview/tool-tmp/uname"},"filesystem":{"read":["/private/tmp/acbox/home/.box/runs/open-preview/tool-tmp/uname"],"write":["/private/tmp/acbox/home/.box/runs/open-preview/tool-tmp/uname"],"deny":["/private/tmp/acbox/demo/.box"]}}},"egress":{"keyed":{"destinations":["k.example.com:8443"],"secret":{"ref":"env://KEY"}}},"telemetry":{"records":{"destination":"/private/tmp/acbox/home/.box/runs/open-preview/records.jsonl","include":["deny","permit","trace","logs"],"kind":"file"}}},"policy":"// No admin paths on GitHub.\n@id(\"no_admin\") forbid (principal, action == Box::Action::\"http:request\", resource) when { context.input.host == \"api.github.com\" && context.input.path like \"/admin/*\" };\n\n@id(\"spawn_uname\") permit (principal, action == Box::Action::\"shell:spawn\", resource) when { context.input.program_path == \"/usr/bin/uname\" && context.input.program == \"uname\" };\n\n@id(\"route_auth_connect\") permit (principal, action == Box::Action::\"net:connect\", resource) when { (context.input.host == \"login.example.com\" && context.input.port == 443) || (context.input.host == \"auth.example.com\" && context.input.port == 8443) };\n@id(\"route_auth_request\") permit (principal, action == Box::Action::\"http:request\", resource) when { context.input.host == \"login.example.com\" || context.input.host == \"auth.example.com\" };\n@id(\"route_github_connect\") permit (principal, action == Box::Action::\"net:connect\", resource) when { (context.input.host == \"api.github.com\" && context.input.port == 443) };\n@id(\"route_github_request\") permit (principal, action == Box::Action::\"http:request\", resource) when { context.input.host == \"api.github.com\" };\n@id(\"route_keyed_connect\") permit (principal, action == Box::Action::\"net:connect\", resource) when { (context.input.host == \"k.example.com\" && context.input.port == 8443) };\n@id(\"route_keyed_request\") permit (principal, action == Box::Action::\"http:request\", resource) when { context.input.host == \"k.example.com\" };\n@id(\"box_home_write\") forbid (principal, action == Box::Action::\"fs:write\", resource) when { (context.input.path == \"~/.box\" || context.input.path like \"~/.box/*\") };\n@id(\"box_home_delete\") forbid (principal, action == Box::Action::\"fs:delete\", resource) when { (context.input.path == \"~/.box\" || context.input.path like \"~/.box/*\") };\n@id(\"box_home_move\") forbid (principal, action == Box::Action::\"fs:move\", resource) when { (context.input.path == \"~/.box\" || context.input.path like \"~/.box/*\") };\n\n@id(\"project_configuration_write\") forbid (principal, action == Box::Action::\"fs:write\", resource) when { context.input.path == \"/private/tmp/acbox/demo/.box\" || context.input.path like \"/private/tmp/acbox/demo/.box/*\" };\n@id(\"project_configuration_delete\") forbid (principal, action == Box::Action::\"fs:delete\", resource) when { context.input.path == \"/private/tmp/acbox/demo/.box\" || context.input.path like \"/private/tmp/acbox/demo/.box/*\" };\n@id(\"project_configuration_move\") forbid (principal, action == Box::Action::\"fs:move\", resource) when { context.input.path == \"/private/tmp/acbox/demo/.box\" || context.input.path like \"/private/tmp/acbox/demo/.box/*\" };\n"} diff --git a/src/core/project/backends/boxCodeZip.test.ts b/src/core/project/backends/boxCodeZip.test.ts index c2c0c4ea8..9925f3fb2 100644 --- a/src/core/project/backends/boxCodeZip.test.ts +++ b/src/core/project/backends/boxCodeZip.test.ts @@ -93,8 +93,6 @@ describe("stageBoxCodeZip", () => { expect(await readFile(join(dist, "resources", "shared", "base", "pack.toml"), "utf8")).toBe( "[pack]\n", ); - // box 0.1.11-preview.9 and later run the Runtime's Python with no ffi shim. - expect(existsSync(join(dist, "ffi"))).toBe(false); // The Runtime profile is the one build derived from the local profile. const { runtimeProfile, runtimeProfileHeader } = model([]); expect(await readFile(join(dist, "profile.toml"), "utf8")).toBe( diff --git a/src/core/project/backends/boxRelease.test.ts b/src/core/project/backends/boxRelease.test.ts index d3866eb91..297429e1d 100644 --- a/src/core/project/backends/boxRelease.test.ts +++ b/src/core/project/backends/boxRelease.test.ts @@ -33,7 +33,7 @@ async function temp(prefix: string): Promise { } const BINARIES = ["box", "strands-box-sock-alias", "strands-box-contain-trampoline"]; -const VERSION = "9.9.9-linux-preview.1"; +const VERSION = BOX_RELEASE.version; /** A tarball of `files` (relative path to content), and its SHA-256. */ async function tarball(name: string, files: Record) { @@ -58,13 +58,13 @@ async function fakeRelease(boxFiles?: Record) { "resources/config.toml": "", "release.json": JSON.stringify({ box_version: VERSION }), }; - const box = await tarball(`box-v${VERSION}-aarch64-unknown-linux-gnu.tar.gz`, files); + const box = await tarball(`box-cli-v${VERSION}-aarch64-unknown-linux-gnu.tar.gz`, files); const release: BoxRelease = { - repo: "owner/box-releases", + repo: BOX_RELEASE.repo, version: VERSION, linux: { target: "aarch64-unknown-linux-gnu", - asset: `box-v${VERSION}-aarch64-unknown-linux-gnu.tar.gz`, + asset: `box-cli-v${VERSION}-aarch64-unknown-linux-gnu.tar.gz`, sha256: box.sha256, }, }; @@ -109,7 +109,7 @@ describe("resolveBoxLinuxBuild from the box release", () => { expect( commands.filter((command) => command[0] === "curl").map((command) => command.at(-1)), ).toEqual([ - `https://github.com/owner/box-releases/releases/download/v${VERSION}/${release.linux.asset}`, + `https://github.com/${BOX_RELEASE.repo}/releases/download/v${VERSION}/${release.linux.asset}`, ]); }); @@ -189,7 +189,7 @@ describe("resolveBoxLinuxBuild from the box release", () => { ); await expect(resolveBoxLinuxBuild({}, { runner, home, release })).rejects.toThrow( - /has no release\.json for box 9\.9\.9-linux-preview\.1, or no box packs/, + `has no release.json for box ${VERSION}, or no box packs`, ); }); @@ -203,7 +203,7 @@ describe("resolveBoxLinuxBuild from the box release", () => { const result = resolveBoxLinuxBuild({}, { runner, home, release }); await expect(result).rejects.toThrow( - /downloaded from https:\/\/github\.com\/owner\/box-releases\/releases\/download\/v9\.9\.9-linux-preview\.1\/box-v/, + `downloaded from https://github.com/${BOX_RELEASE.repo}/releases/download/v${VERSION}/box-cli-v`, ); await expect(result).rejects.toThrow(/HTTP 404: Not Found/); }); @@ -215,7 +215,7 @@ describe("boxReleaseFor a runtime's box.version", () => { expect(await boxReleaseFor(BOX_RELEASE.version)).toBe(BOX_RELEASE); }); - test.each(["0.1.11-linux-preview.6", "2.0.0"])( + test.each(["0.2.4", "2.0.0"])( "refuses %s, a box this CLI does not pin, and says to set the pinned one", async (version) => { await expect(boxReleaseFor(version)).rejects.toThrow( diff --git a/src/core/project/backends/boxRelease.ts b/src/core/project/backends/boxRelease.ts index c6d392e45..96e60f66a 100644 --- a/src/core/project/backends/boxRelease.ts +++ b/src/core/project/backends/boxRelease.ts @@ -311,8 +311,8 @@ async function download( /** * The box release that `version`, a runtime's `box.version`, names. It must be the pinned one, - * BOX_RELEASE, whose checksums `boxRelease.json` pins: another box is untested with this CLI (box - * 0.1.11-linux-preview.6, for one, refuses the `@box/` packs the CLI writes), and build cannot + * BOX_RELEASE, whose checksums `boxRelease.json` pins: another box is untested with this CLI (a box + * older than BOX_MINIMUM_VERSION, for one, refuses the `@box/` packs the CLI writes), and build cannot * see that, since it checks the profile with the box on PATH. No version means BOX_RELEASE. */ export async function boxReleaseFor(version: string | undefined): Promise { diff --git a/src/core/project/boxNetwork/policyParser.test.ts b/src/core/project/boxNetwork/policyParser.test.ts index 43e13bd18..1e50b8648 100644 --- a/src/core/project/boxNetwork/policyParser.test.ts +++ b/src/core/project/boxNetwork/policyParser.test.ts @@ -6,7 +6,7 @@ const HR = 'action == Box::Action::"http:request"'; const NO_ADMIN = `@id("no_admin") forbid (principal, ${HR}, resource) when { context.input.host == "api.github.com" && context.input.path like "/admin/*" };`; const MORE = `@id("more_rule") forbid (principal, ${HR}, resource) when { context.input.host == "example.com" };`; -/** Box's policy as box 0.1.11 prints it for two policy files and the route `github`. */ +/** Box's policy as box prints it for two policy files and the route `github`. */ const RESOLVED = [ "// No admin paths on GitHub.", NO_ADMIN, diff --git a/src/core/project/boxProfileResolver-test-support.ts b/src/core/project/boxProfileResolver-test-support.ts index b47d39bc4..cd64dfcfd 100644 --- a/src/core/project/boxProfileResolver-test-support.ts +++ b/src/core/project/boxProfileResolver-test-support.ts @@ -1,6 +1,6 @@ /** * A stand-in for `box profile show --format json --full`, for the tests of the Box network, and the - * network rules that box 0.1.11 prints. `boxProfileResolver.test.ts` compares the rules with the + * network rules that box prints. `boxProfileResolver.test.ts` compares the rules with the * real box when one with `--format json --full` is on PATH. */ import type { BoxProfileResolver, ResolvedBoxProfile } from "./boxProfileResolver"; diff --git a/src/core/project/boxProfileResolver.test.ts b/src/core/project/boxProfileResolver.test.ts index 83dff3aab..601de1b0e 100644 --- a/src/core/project/boxProfileResolver.test.ts +++ b/src/core/project/boxProfileResolver.test.ts @@ -109,20 +109,12 @@ const INSTALL = /** * `box profile show open --format json --full` for a profile with the routes `auth` and `github` * with no secret, the route `keyed` with one, and {@link POLICY}, as box prints it, with HOME at - * /tmp/acbox/home. Box 0.1.11-linux-preview.6 joins the destinations of an open route into one - * string, and 0.1.11-linux-preview.7 prints the second, a list. preview.6 printed the first for the - * same profile with its pack named box/base, the name it had before `@box/`. + * /tmp/acbox/home. */ -const OPEN_ROUTES_SHOWN = Object.entries({ - "one string": readFileSync( - join(import.meta.dir, "__fixtures__", "box-profile-show-open-routes.json"), - "utf8", - ), - "a list": readFileSync( - join(import.meta.dir, "__fixtures__", "box-profile-show-open-routes-list.json"), - "utf8", - ), -}); +const OPEN_ROUTES_SHOWN = readFileSync( + join(import.meta.dir, "__fixtures__", "box-profile-show-open-routes-list.json"), + "utf8", +); describe("parseBoxProfileShow", () => { test("takes the box.toml as a table in the order of the file, the policy.dw, the packs, and the warnings", () => { @@ -171,20 +163,17 @@ describe("parseBoxProfileShow", () => { ); }); - test.each(OPEN_ROUTES_SHOWN)( - "takes each open route, which box.toml leaves out, and its destinations from %s", - (_, shown) => { - const resolved = parseBoxProfileShow(shown, ".box/profile.toml"); - - expect(resolved.openRoutes).toEqual([ - { route: "auth", destinations: ["login.example.com", "auth.example.com:8443"] }, - { route: "github", destinations: ["api.github.com"] }, - ]); - expect(resolved.boxToml.egress).toEqual({ - keyed: { destinations: ["k.example.com:8443"], secret: { ref: "env://KEY" } }, - }); - }, - ); + test("takes each open route, which box.toml leaves out, and its destinations", () => { + const resolved = parseBoxProfileShow(OPEN_ROUTES_SHOWN, ".box/profile.toml"); + + expect(resolved.openRoutes).toEqual([ + { route: "auth", destinations: ["login.example.com", "auth.example.com:8443"] }, + { route: "github", destinations: ["api.github.com"] }, + ]); + expect(resolved.boxToml.egress).toEqual({ + keyed: { destinations: ["k.example.com:8443"], secret: { ref: "env://KEY" } }, + }); + }); const document = JSON.parse(SHOWN) as Record; const { box_toml: _boxToml, ...noBoxToml } = document; @@ -322,8 +311,8 @@ describe("BoxCliProfileResolver", () => { ); }); - test("says to install the pinned box when a box older than preview.7 refuses an @box/ pack", async () => { - // Box 0.1.11-linux-preview.6 wraps its error, here inside the pack name's line. + test("says to install the pinned box when a box older than the minimum refuses an @box/ pack", async () => { + // An older box wraps its error, here inside the pack name's line. const error = await failure( refusal([ 'box: error: /work/demo/.box/profile.toml: "@box/base" is', diff --git a/src/core/project/boxProfileResolver.ts b/src/core/project/boxProfileResolver.ts index ef032f054..c7acf5c03 100644 --- a/src/core/project/boxProfileResolver.ts +++ b/src/core/project/boxProfileResolver.ts @@ -60,21 +60,11 @@ const OLD_BOX_PACK_NAME = /"@box\/[^"\s]+" is not a pack name/; /** The error of a box that has no `--format` or `--full` option, as clap prints it. */ const REFUSED_JSON = /(?:unexpected argument|Found argument) '--(?:format|full)'/; -/** - * The destinations of an open route, as a list: box 0.1.11-linux-preview.6 joins them into one - * string with ", ", and later boxes print a list. - */ -const OpenRouteDestinations = z - .union([z.string(), z.array(z.string())]) - .transform((destinations) => - typeof destinations === "string" ? destinations.split(", ") : destinations, - ); - /** The parts of the document of `box profile show --format json --full` that build reads. */ const BoxProfileShowSchema = z.object({ box_toml: z.record(z.string(), z.unknown()), policy: z.string(), - open_routes: z.array(z.object({ route: z.string(), destinations: OpenRouteDestinations })), + open_routes: z.array(z.object({ route: z.string(), destinations: z.array(z.string()) })), packs: z.array(z.object({ name: z.string(), version: z.string() })).default([]), warnings: z.array(z.string()).default([]), }); diff --git a/src/core/project/runtimeProfile/derive.test.ts b/src/core/project/runtimeProfile/derive.test.ts index eaec6ce02..23f2d9186 100644 --- a/src/core/project/runtimeProfile/derive.test.ts +++ b/src/core/project/runtimeProfile/derive.test.ts @@ -32,7 +32,7 @@ const context = (runtime: ProjectRuntime, places = new Map()) => places, }); -/** The keys of a profile that no rule of the derivation changes, as box 0.1.11-linux-preview.6 takes them. */ +/** The keys of a profile that no rule of the derivation changes, as box takes them. */ const CARRIED: TomlTable = { "agent-args": ["--verbose"], "file-attributes": true, diff --git a/src/core/project/runtimeProfile/rules/additions.test.ts b/src/core/project/runtimeProfile/rules/additions.test.ts index 43362dc11..7a6ef0537 100644 --- a/src/core/project/runtimeProfile/rules/additions.test.ts +++ b/src/core/project/runtimeProfile/rules/additions.test.ts @@ -192,7 +192,7 @@ const TELEMETRY_CASES: Record = { * the gateway fixture. The gateway fixture is recorded from renderRuntimeBoxProfile of * box-integration (f5503f02). The two template sets are recorded, with the default telemetry * target, from the renderer of aws/agentcore-cli#2867 (f40ebce7): box-integration (7252504c) with - * the `@box/` pack names and no ffi shim. + * the `@box/` pack names. */ const OLD_RENDERER = JSON.parse( readFileSync(join(import.meta.dir, "..", "__fixtures__", "old-renderer-tables.json"), "utf8"), From d69acea7e03281d75b3edb7e92cd378a2c756354 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Mon, 23 Nov 2026 18:26:27 -0800 Subject: [PATCH 5/6] fix(box): Sign in to Bedrock with the api-key route of @box/bedrock on the Runtime Box 0.3 (#690 of the box CLI) makes @box/bedrock sign each Bedrock call with aws:// by default, under a new bedrock.sign-in input. On the Runtime, the Bedrock route goes through a Box gateway backend, and box refuses a signed secret beside a backend ("a destination secret beside a backend must be env://"), so box exited before the agent started and each invoke timed out at 30s. The Runtime profile now sets bedrock.sign-in = "api-key", beside bedrock.region, and the gateway rule writes the Bedrock route as [egress.bedrock-api-key], the pack's route for that sign-in. Its env:// secret is one box replaces with a stand-in and strips; the gateway signs the call with its own role. The local profile keeps aws://, so agentcore dev signs with the developer's credentials as before. --- src/core/project/manager.boxNetwork.test.ts | 26 ++++++---- .../runtimeProfile/rules/additions.test.ts | 50 ++++++++++++++++--- .../project/runtimeProfile/rules/additions.ts | 15 ++++-- .../runtimeProfile/rules/gateway.test.ts | 18 +++++-- .../project/runtimeProfile/rules/gateway.ts | 19 ++++++- src/core/project/templates/boxProfile.ts | 17 +++++++ 6 files changed, 119 insertions(+), 26 deletions(-) diff --git a/src/core/project/manager.boxNetwork.test.ts b/src/core/project/manager.boxNetwork.test.ts index ec335ef15..9c40f1ecc 100644 --- a/src/core/project/manager.boxNetwork.test.ts +++ b/src/core/project/manager.boxNetwork.test.ts @@ -297,16 +297,18 @@ describe("build writes the Box network of the box profile", () => { expect(profile.policies).toEqual(["policy.dw"]); expect(await text(root, "app/agent_python_strands/.box-dist/policy.dw")).toBe(POLICY); const egress = profile.egress as Record; - // The route of [egress.github] keeps the name of its entry, and goes to its target. + // The route of [egress.github] keeps the name of its entry, and goes to its target. The + // Bedrock route is the api-key route of @box/bedrock, whose env:// secret box takes beside a + // backend. expect(Object.keys(egress).sort()).toEqual([ "agentcore", - "bedrock", + "bedrock-api-key", "egress-httpbin-org", "github", ]); expect(egress.github).toEqual(gatewayRoute("egress-github", "api.github.com")); expect(egress["egress-httpbin-org"]).toEqual(gatewayRoute("egress-httpbin-org", "httpbin.org")); - expect(egress.bedrock).toEqual( + expect(egress["bedrock-api-key"]).toEqual( gatewayRoute("bedrock", "bedrock-runtime.us-west-2.amazonaws.com"), ); expect(await boxFiles(root)).toEqual(before); @@ -377,7 +379,7 @@ describe("build writes the Box network of the box profile", () => { string, { destinations: string[] } >; - expect(Object.keys(egress).sort()).toEqual(["agentcore", "bedrock"]); + expect(Object.keys(egress).sort()).toEqual(["agentcore", "bedrock-api-key"]); }); test("changes nothing on a second build", async () => { @@ -433,7 +435,7 @@ describe("build writes the Box network of the box profile", () => { ); expect(warnings).toEqual([]); const profile = await runtimeProfile(root); - expect(Object.keys(profile.egress as object)).toEqual(["bedrock", "agentcore"]); + expect(Object.keys(profile.egress as object)).toEqual(["bedrock-api-key", "agentcore"]); expect(profile.mcp).toEqual({ tools: { ...tools, backends: gatewayRoute("egress-tools", "tools.example.com").backends }, }); @@ -520,7 +522,7 @@ describe("build writes the Box network of the box profile", () => { expect(await targetNames(root)).toEqual(["bedrock", "agentcore"]); const egress = (await runtimeProfile(root)).egress as Record; // The route of [egress.memory] keeps the name of its entry, and goes to the agentcore target. - expect(Object.keys(egress)).toEqual(["bedrock", "memory"]); + expect(Object.keys(egress)).toEqual(["bedrock-api-key", "memory"]); expect(egress.memory).toEqual( gatewayRoute("agentcore", "bedrock-agentcore.us-west-2.amazonaws.com"), ); @@ -1044,11 +1046,13 @@ describe("build writes the Bedrock and Memory targets for the region it builds f outboundAuth: { region: "eu-central-1" }, }); const profile = await runtimeProfile(root); - expect(profile.options).toEqual({ bedrock: { region: "eu-central-1" } }); + expect(profile.options).toEqual({ bedrock: { region: "eu-central-1", "sign-in": "api-key" } }); const egress = profile.egress as Record; - expect(egress.bedrock!.destinations).toEqual(["bedrock-runtime.eu-central-1.amazonaws.com"]); + expect(egress["bedrock-api-key"]!.destinations).toEqual([ + "bedrock-runtime.eu-central-1.amazonaws.com", + ]); // The backend signs for the Runtime's own region, which box reads from AWS_REGION there. - expect(JSON.stringify(egress.bedrock!.backends)).toContain( + expect(JSON.stringify(egress["bedrock-api-key"]!.backends)).toContain( '"region":"${{ inputs.aws.region }}"', ); }); @@ -1061,7 +1065,9 @@ describe("build writes the Bedrock and Memory targets for the region it builds f const { targets } = await boxGateway(root); expect(targets.find(({ name }) => name === "bedrock")).toEqual(bedrockTarget("ap-northeast-1")); - expect((await runtimeProfile(root)).options).toEqual({ bedrock: { region: "ap-northeast-1" } }); + expect((await runtimeProfile(root)).options).toEqual({ + bedrock: { region: "ap-northeast-1", "sign-in": "api-key" }, + }); }); test("has box resolve the profile for that region, from a copy it then removes", async () => { diff --git a/src/core/project/runtimeProfile/rules/additions.test.ts b/src/core/project/runtimeProfile/rules/additions.test.ts index 7a6ef0537..e4b9afd46 100644 --- a/src/core/project/runtimeProfile/rules/additions.test.ts +++ b/src/core/project/runtimeProfile/rules/additions.test.ts @@ -12,7 +12,13 @@ import type { ProjectRuntime } from "../../../../projectSchemas/runtime"; import { cloudWatchTelemetry, withDeployRegion, type CloudWatchTelemetry } from "../../boxNetwork"; import { readFileSync } from "node:fs"; import { join } from "node:path"; -import { renderAgentCorePack, renderBoxProfile } from "../../templates/boxProfile"; +import { + BOX_BEDROCK_API_KEY_ROUTE, + BOX_BEDROCK_PACK, + BOX_BEDROCK_ROUTE, + renderAgentCorePack, + renderBoxProfile, +} from "../../templates/boxProfile"; import { runtimeProfileContext } from "../context"; import { deriveRuntimeProfile } from "../derive"; import { serializeRuntimeProfile } from "../serialize"; @@ -159,6 +165,29 @@ const OTEL_START: Record = { Container: ["${{ workspace }}/.venv/bin/opentelemetry-instrument"], }; +/** + * `profile`, a Runtime profile that the old renderer wrote, as the derivation writes it for box + * 0.3: with @box/bedrock, `bedrock.sign-in` is `api-key`, and the Bedrock route through the + * gateway is `[egress.bedrock-api-key]`, the pack's route for that sign-in. Nothing else changes. + */ +function withApiKeySignIn(profile: TomlTable): TomlTable { + const packs = profile.packs; + if (!Array.isArray(packs) || !packs.includes(BOX_BEDROCK_PACK)) return profile; + const result = structuredClone(profile); + const options = result.options as TomlTable; + options.bedrock = { ...(options.bedrock as TomlTable), "sign-in": "api-key" }; + const egress = result.egress as TomlTable | undefined; + if (egress !== undefined && Object.hasOwn(egress, BOX_BEDROCK_ROUTE)) { + result.egress = Object.fromEntries( + Object.entries(egress).map(([name, route]) => [ + name === BOX_BEDROCK_ROUTE ? BOX_BEDROCK_API_KEY_ROUTE : name, + route, + ]), + ); + } + return result; +} + /** * `profile`, a Runtime profile with OTEL off, as OTEL on gives it: the agent starts under * opentelemetry-instrument, and the default X-Ray target comes last when no target is @@ -263,7 +292,8 @@ describe("deriveRuntimeProfile on the created templates", () => { const recorded = OLD_RENDERER.templates[ `${build} ${protocol} ${provider} memories=${memories.length} telemetry=${telemetryCase}` ] as TomlTable; - const expected = otel ? withOtel(recorded, build) : recorded; + const signedIn = withApiKeySignIn(recorded); + const expected = otel ? withOtel(signedIn, build) : signedIn; expect(problems).toEqual([]); for (const key of OWNED) expect([key, profile[key]]).toEqual([key, expected[key] ?? undefined]); @@ -338,7 +368,8 @@ describe("deriveRuntimeProfile on each box template of create", () => { `${template} provider=${provider} memories=${memories.length} telemetry=${telemetryCase}` ]!; expect(problems).toEqual([]); - expect(profile).toEqual(otel ? withOtel(recorded, input.build as Build) : recorded); + const signedIn = withApiKeySignIn(recorded); + expect(profile).toEqual(otel ? withOtel(signedIn, input.build as Build) : signedIn); }, ); }); @@ -422,19 +453,26 @@ describe("the additions rule", () => { }); }); - test("sets bedrock.region to the build region, and keeps the other options", () => { + test("sets bedrock.region to the build region and bedrock.sign-in to api-key, and keeps the other options", () => { + // Box refuses the aws:// route of @box/bedrock beside the gateway backend, so the Runtime + // signs in with the pack's api-key route, whose env:// secret box replaces with a stand-in. const dotted = { options: { bedrock: { region: CREATE_REGION }, other: { input: "x" } } }; const quoted = { options: { "bedrock.region": CREATE_REGION } }; + const signedIn = { options: { bedrock: { region: CREATE_REGION, "sign-in": "aws" } } }; expect(apply(dotted, contextOf(CODEZIP)).table.options).toEqual({ - bedrock: { region: BUILD_REGION }, + bedrock: { region: BUILD_REGION, "sign-in": "api-key" }, other: { input: "x" }, }); expect(apply(quoted, contextOf(CODEZIP)).table.options).toEqual({ "bedrock.region": BUILD_REGION, + "bedrock.sign-in": "api-key", + }); + expect(apply(signedIn, contextOf(CODEZIP)).table.options).toEqual({ + bedrock: { region: BUILD_REGION, "sign-in": "api-key" }, }); expect(apply({ packs: ["@box/bedrock"] }, contextOf(CODEZIP)).table.options).toEqual({ - bedrock: { region: BUILD_REGION }, + bedrock: { region: BUILD_REGION, "sign-in": "api-key" }, }); expect(apply({ packs: ["@box/base"] }, contextOf(CODEZIP)).table.options).toBeUndefined(); }); diff --git a/src/core/project/runtimeProfile/rules/additions.ts b/src/core/project/runtimeProfile/rules/additions.ts index 2416a7662..412116190 100644 --- a/src/core/project/runtimeProfile/rules/additions.ts +++ b/src/core/project/runtimeProfile/rules/additions.ts @@ -7,6 +7,7 @@ * | `packs` | the user's packs in their order, then @box/agentcore, and @box/agentcore-codezip for CodeZip | * | `[profile] name` | the project's name | * | `[options] bedrock.region` | the build region, where the profile sets it or imports @box/bedrock | + * | `[options] bedrock.sign-in` | `api-key`, beside `bedrock.region`: the gateway signs each Bedrock call, and box refuses the `aws://` route of @box/bedrock beside its backend | * | `[agent] command` | the template's own command becomes its Runtime command; a command of the user loses `--reload` and `--reload-dir `; with OTEL on, a command of the venv's Python starts under opentelemetry-instrument | * | `[agent.env]` | a template value becomes its Runtime value; `LOCAL_DEV` goes; the region of the Runtime replaces a region of the user, with a warning; `AWS_PROFILE` goes, with a warning; the AWS stand-ins and (CodeZip) a `PYTHONPATH` of the code folder come in; each other value of the user stays | * | `[agent.filesystem]` | the template's grants become its Runtime grants; each grant of the user stays | @@ -23,6 +24,7 @@ import { AGENTCORE_CODEZIP_PACK_NAME, AGENTCORE_PACK_NAME, BOX_BEDROCK_PACK, + BOX_BEDROCK_RUNTIME_SIGN_IN, boxIngressPort, boxWorkloadPort, OBSERVABILITY_OFF_ENV, @@ -228,7 +230,8 @@ function runtimePacks(packs: unknown, context: RuntimeProfileContext): unknown { /** * `[options]` with `bedrock.region` in the build region, the region of the gateway's `bedrock` - * target: where the profile sets it, as a dotted or a quoted key, or where it imports @box/bedrock. + * target, and `bedrock.sign-in` of the route that goes through the gateway: where the profile sets + * `bedrock.region`, as a dotted or a quoted key, or where it imports @box/bedrock. */ function runtimeOptions(options: unknown, bedrock: boolean, region: string): unknown { if (options !== undefined && !isTable(options)) return options; @@ -236,8 +239,14 @@ function runtimeOptions(options: unknown, bedrock: boolean, region: string): unk const dotted = options !== undefined && isTable(options.bedrock); if (!quoted && !dotted && !bedrock) return options; const result: TomlTable = { ...options }; - if (quoted) result["bedrock.region"] = region; - if (dotted || !quoted) result.bedrock = { ...(result.bedrock as TomlTable), region }; + const signIn = BOX_BEDROCK_RUNTIME_SIGN_IN; + if (quoted) { + result["bedrock.region"] = region; + result["bedrock.sign-in"] = signIn; + } + if (dotted || !quoted) { + result.bedrock = { ...(result.bedrock as TomlTable), region, "sign-in": signIn }; + } return result; } diff --git a/src/core/project/runtimeProfile/rules/gateway.test.ts b/src/core/project/runtimeProfile/rules/gateway.test.ts index 585b2e30d..4b708650d 100644 --- a/src/core/project/runtimeProfile/rules/gateway.test.ts +++ b/src/core/project/runtimeProfile/rules/gateway.test.ts @@ -483,13 +483,20 @@ function rendered(label: string): TomlTable { /** * The `[egress]` routes of the old renderer under the keys that the gateway rule gives them: the * old renderer named each route after its target, and the rule names the route of the first host of - * an entry after the entry, so that a pack table of that name merges with it. The routes are the - * same. + * an entry after the entry, so that a pack table of that name merges with it. With @box/bedrock, + * the Bedrock route is `bedrock-api-key`, the route of the pack that the Runtime profile signs in + * with. The routes are the same. */ -const withEntryKeys = (egress: unknown) => +const withEntryKeys = (egress: unknown, bedrockPack = true) => Object.fromEntries( Object.entries(egress as TomlTable).map(([key, route]) => [ - { "egress-github": "github", "egress-models-api-one-example-com": "models" }[key] ?? key, + ( + { + ...(bedrockPack && { bedrock: "bedrock-api-key" }), + "egress-github": "github", + "egress-models-api-one-example-com": "models", + } as Record + )[key] ?? key, route, ]), ); @@ -702,7 +709,8 @@ describe("the gateway rule and the Runtime renderer it replaced", () => { ["MCP_DESTINATION_NOT_ONE_HOST", "pathed"], ]); expect(derived.problems).toEqual([]); - expect(derived.profile.egress).toEqual(withEntryKeys(old.egress)); + // The profile imports no @box/bedrock, so its Bedrock route keeps its name. + expect(derived.profile.egress).toEqual(withEntryKeys(old.egress, false)); expect(derived.profile.mcp).toBeUndefined(); expect(old.mcp).toBeUndefined(); }); diff --git a/src/core/project/runtimeProfile/rules/gateway.ts b/src/core/project/runtimeProfile/rules/gateway.ts index 321e267b6..e4ef203c8 100644 --- a/src/core/project/runtimeProfile/rules/gateway.ts +++ b/src/core/project/runtimeProfile/rules/gateway.ts @@ -15,12 +15,21 @@ * | an entry with no host in the Box network model | removed; the model fails the entry, and build stops | * * A stdio `[mcp.]` stays as it is: the `refusals` and `paths` rules own it. + * + * With @box/bedrock, the route of its `[egress.bedrock]` is `[egress.bedrock-api-key]`: the + * `additions` rule picks that route of the pack with `bedrock.sign-in = "api-key"`, because box + * refuses the `aws://` secret of `[egress.bedrock]` beside a backend. */ import { InputValidationError } from "../../../../errors/errors"; import type { AgentCoreGatewayTarget } from "../../../../projectSchemas/gateway"; import type { BoxHostSource, BoxNetworkHost } from "../../boxNetwork"; import { BOX_EGRESS_TARGET_PREFIX } from "../../boxNetwork/egress"; import { gatewayTargetFor } from "../../boxNetwork/projectSpec"; +import { + BOX_BEDROCK_API_KEY_ROUTE, + BOX_BEDROCK_PACK, + BOX_BEDROCK_ROUTE, +} from "../../templates/boxProfile"; import { isHttpServer, isTable } from "../projectPaths"; import { RUNTIME_AWS_SIGNER, @@ -44,6 +53,12 @@ interface GatewayRoute { export function apply(table: Readonly, context: RuntimeProfileContext): RuleResult { const routes = gatewayRoutes(context); const written = new Set(); + const bedrockPack = Array.isArray(table.packs) && table.packs.includes(BOX_BEDROCK_PACK); + // The route of @box/bedrock that the Runtime profile signs in with merges with this one. + const keyOf = (route: GatewayRoute) => { + const key = routeKey(route, routes, context); + return bedrockPack && key === BOX_BEDROCK_ROUTE ? BOX_BEDROCK_API_KEY_ROUTE : key; + }; const egress: TomlTable = {}; for (const [name, entry] of Object.entries(isTable(table.egress) ? table.egress : {})) { @@ -55,7 +70,7 @@ export function apply(table: Readonly, context: RuntimeProfileContext host.sources.some((source) => source.kind === "entry" && source.egressEntry === name), ); for (const route of routesOf(hosts, routes)) { - egress[routeKey(route, routes, context)] = egressRoute(entry, route); + egress[keyOf(route)] = egressRoute(entry, route); written.add(route.target); } } @@ -77,7 +92,7 @@ export function apply(table: Readonly, context: RuntimeProfileContext if (route.server) { mcp[route.server.mcpEntry] = mcpServer({}, route, route.server); } else { - egress[routeKey(route, routes, context)] = egressRoute({}, route); + egress[keyOf(route)] = egressRoute({}, route); } } diff --git a/src/core/project/templates/boxProfile.ts b/src/core/project/templates/boxProfile.ts index 8da55155e..7519b876c 100644 --- a/src/core/project/templates/boxProfile.ts +++ b/src/core/project/templates/boxProfile.ts @@ -54,6 +54,23 @@ const BOX_BASE_PACK = "@box/base"; /** The pack of box that routes the Bedrock model calls, with its `[options] bedrock.region`. */ export const BOX_BEDROCK_PACK = "@box/bedrock"; +/** + * The route of {@link BOX_BEDROCK_PACK} that signs each Bedrock call with the AWS credentials, + * `aws://`, for its `bedrock.sign-in` input `aws`, the default. The local profile uses it. + */ +export const BOX_BEDROCK_ROUTE = "bedrock"; + +/** + * The route of {@link BOX_BEDROCK_PACK} for its `bedrock.sign-in` input `api-key`, whose secret is + * `env://AWS_BEARER_TOKEN_BEDROCK`. The Runtime profile uses it: there each Bedrock call goes + * through a Box gateway backend, and box takes only an `env://` secret beside a backend. Box gives + * the agent a stand-in for it and strips it, and the gateway signs the call with its own role. + */ +export const BOX_BEDROCK_API_KEY_ROUTE = "bedrock-api-key"; + +/** The `bedrock.sign-in` of the Runtime profile, which selects {@link BOX_BEDROCK_API_KEY_ROUTE}. */ +export const BOX_BEDROCK_RUNTIME_SIGN_IN = "api-key"; + /** {@link renderAgentCorePack}. */ export const AGENTCORE_PACK_NAME = "@box/agentcore"; export const AGENTCORE_PACK_PATH = "resources/packs/agentcore/pack.toml"; From b894a3820682779a714da23f87092de735e12ba5 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Mon, 23 Nov 2026 21:23:08 -0800 Subject: [PATCH 6/6] test(migrate): Give the two slowest apply tests 30s On GitHub-hosted Windows runners, "on a terminal, asks first and applies on yes" took 5258 ms and failed verify / Windows at bun's 5 s default; "--yes never applies a plan that isn't ready" took 3975 ms. As #2900 did for the Toolkit loading test, give each 30 s. --- src/handlers/project/migrate/index.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/handlers/project/migrate/index.test.ts b/src/handlers/project/migrate/index.test.ts index d56037945..10ceda2fd 100644 --- a/src/handlers/project/migrate/index.test.ts +++ b/src/handlers/project/migrate/index.test.ts @@ -685,6 +685,7 @@ describe("agentcore migrate, applying", () => { ); }); + // On GitHub-hosted Windows runners this takes 4 to 5 s or more, past bun's 5 s default. test("--yes never applies a plan that isn't ready", async () => { await inCommittedV0Project(); const subject = scriptedCli({ ready: false }); @@ -692,8 +693,9 @@ describe("agentcore migrate, applying", () => { await expect(subject.run("--yes")).rejects.toBeInstanceOf(SilentCLIError); expect(subject.calls.apply).toBe(0); expect(subject.io.stderr()).toContain(MIGRATION_FAILURE_GUIDANCE); - }); + }, 30_000); + // On GitHub-hosted Windows runners this takes 4 to 5 s or more, past bun's 5 s default. test("on a terminal, asks first and applies on yes", async () => { await inCommittedV0Project(); const subject = scriptedCli({ isTTY: true, stdin: "y\n" }); @@ -709,7 +711,7 @@ describe("agentcore migrate, applying", () => { const err = subject.io.stderr(); expect(err.indexOf(CONFIRM_QUESTION.trim())).toBeGreaterThan(err.indexOf("Reading stack S")); expect(err.indexOf(CONFIRM_QUESTION.trim())).toBeLessThan(err.indexOf("Refactoring stack S")); - }); + }, 30_000); test("on a terminal, anything but yes cancels", async () => { await inCommittedV0Project();