Skip to content

feat(gateway): Accept enableApplicationLogs and enableTraces, send the logs of a new Box gateway, and find the target ids of two Box gateways - #2860

Merged
SaiAbhishek98 merged 12 commits into
aws:box-integrationfrom
SaiAbhishek98:sa/gateway-telemetry-fields
Nov 20, 2026
Merged

SaiAbhishek98 merged 12 commits into
aws:box-integrationfrom
SaiAbhishek98:sa/gateway-telemetry-fields

Conversation

@SaiAbhishek98

@SaiAbhishek98 SaiAbhishek98 commented Nov 19, 2026 •

Copy link
Copy Markdown

Description

From sa/gateway-telemetry-fields into box-integration. This PR is the CLI partner of
aws/agentcore-l3-cdk-constructs#470. The plan tells us to
merge each CDK PR "no later than its CLI partner". Thus merge
aws/agentcore-l3-cdk-constructs#470 before this PR, or
at the same time.

This PR has ten commits:

  1. 54abc7e6 accepts
    the two new gateway fields.
  2. a2404eee finds the
    id of a target name that two gateways have.
  3. 34da4891 writes
    enableApplicationLogs: true in the Box gateway of a new Box project.
  4. 3b54f984 finds a
    gateway target id only by the export name that the CDK library writes. This is from the review.
  5. 14cf2109 removes a
    test of zod and a comment. This is from the review.
  6. 6a48a181 gives a
    create warning that a new Box gateway sends its logs. This is from the review.
  7. 239df187 merges
    box-integration, because of a conflict in the imports of cdk.test.ts.
  8. 7c2b49fa merges
    box-integration again, with no conflict.
  9. aff8f148 gives the
    same warning from add runtime. This is from the review.
  10. fd93daaf adds a
    target id test with a _ in a gateway name. This is from the review.

The CLI does not accept the two new gateway fields

Problem. aws/agentcore-l3-cdk-constructs#470 adds
two optional fields to a gateway entry. When enableApplicationLogs is true, the gateway sends its
APPLICATION_LOGS to CloudWatch Logs. When enableTraces is true, the gateway sends its TRACES to X-Ray. The CLI
gateway schema, AgentCoreGatewaySchema in src/projectSchemas/gateway.ts, is .strict(). Thus the CLI does not
accept a project that sets one of the two fields. A user cannot send the logs or the TRACES of a gateway, and cannot
stop the logs of a Box gateway.

Change. AgentCoreGatewaySchema has enableApplicationLogs and enableTraces as optional booleans. Each field has
the same doc comment as the CDK library schema. The CDK library applies these defaults:

Value enableApplicationLogs, each gateway enableTraces, each gateway
not set no logs no TRACES
true logs sent TRACES sent
false no logs no TRACES

A new Box gateway sends no logs

Problem. In
aws/agentcore-l3-cdk-constructs#470, the default of
enableApplicationLogs is false for each gateway, also for a gateway with boundRuntime. Thus a Box gateway without the field sends no APPLICATION_LOGS. The logs are
optional in the CDK library, but they must be on by default for a Box gateway.

Change. boxGatewaySpec writes enableApplicationLogs: true. agentcore create uses it for the Box gateway of a
new Box project. agentcore build changes only the targets of a Box gateway. Thus a false that a user writes stays.

Each command that writes a new Box gateway gives a warning for it: agentcore create, and agentcore add runtime in a
Box project. The two use one helper, boxGatewayLogsWarnings. The warning says that the logs can hold the request and
response bodies of its calls, prompts and completions included. It also says that CloudWatch Logs keeps them for 90
days, and that "enableApplicationLogs": false stops them.

A Box project can have one Box gateway with logs and one without.
aws/agentcore-cli#2859 lets add runtime add a box runtime to a Box
project, and addBoxRuntime writes its Box gateway with boxGatewaySpec. Thus, in a Box project from a previous CLI,
a runtime that add runtime adds gets a Box gateway with enableApplicationLogs: true, and the first Box gateway has no
field. The new gateway has no log group to collide with, and the warning tells the user about the logs.

A Box project from a previous CLI gets no logs. Its Box gateway has no enableApplicationLogs, and
agentcore build does not add the field. We accept this for the integration branch. The decision is below, and the
release note tells the user how to get the logs.

Status shows the targets of two Box gateways as local-only

Problem. A project with two Box runtimes has two Box gateways. Each Box gateway has a bedrock target, and usually
an agentcore target. Before
aws/agentcore-l3-cdk-constructs#470, such a project does
not synthesize. After it, the CDK library adds the gateway name to the export name of a target name that two or more
gateways have: GatewayTarget-<gateway>:<target>-Id. A target name that only one gateway has keeps
GatewayTarget-<target>-Id. identifierOf in src/core/project/backends/cdk.ts looks for
GatewayTarget-<target>-Id only. Thus, after a deploy, agentcore project status shows each shared target as
local-only.

Change. identifierOf counts the gateways in spec.agentCoreGateways that have each target name, as the CDK
library does. For a target name that two or more gateways have, it looks only for
GatewayTarget-<gateway>:<target>-Id. For a different target name, it looks only for GatewayTarget-<target>-Id.
A colon is not in a gateway name or in a target name, thus each export name has one gateway and one target. When the
gateway itself has no deployed id, each of its targets is local-only.

The second commit looked for GatewayTarget-<gateway>-<target>-Id first, and then for GatewayTarget-<target>-Id.
Thus a target could get the id of a different target when a name had a hyphen. An example is the gateway a with the
target b, and the gateway tools with the target a-b. This occurred also with one gateway: tools with the targets
search and tools-search. Also, a target of a gateway that was not deployed got the id of a target of a different
gateway with that name. The fourth commit removes these problems.

When a second gateway gets a target name of a deployed gateway, the two targets are local-only until the next deploy.
The stack has only GatewayTarget-<target>-Id, and the CLI gives no id rather than the id of a different gateway.

Decisions that the diff does not show:

  • The two fields have no schema default. The CLI writes the parsed spec back to agentcore.json, and a schema default
    adds the field to each project file.
  • agentcore build does not add enableApplicationLogs to a Box gateway that does not have it. Thus a Box project from
    a previous CLI version gets no new resources from an update of the CDK library. If the build adds the field, the first
    deploy after the update makes the log group. When an operator added a console log delivery to that gateway, the log
    group exists, and that deploy fails. To get the logs, the user adds "enableApplicationLogs": true to the Box gateway.
  • The CLI has no other copy of the gateway schema that it must keep in step with the CDK library. The v0 schema in
    src/projectSchemas/v0 is a frozen copy, and this PR does not change it.
  • This PR adds no flag to agentcore add gateway. A user sets the two fields in agentcore.json.

Base. This PR starts from box-integration at
71051b42, the merge of
aws/agentcore-cli#2852. The seventh commit merges box-integration
at f5503f02, the merge of aws/agentcore-cli#2857,
with aws/agentcore-cli#2853. The fourth commit and that PR changed the
imports of cdk.test.ts, thus the branch had a conflict. That merge keeps the two imports. The eighth commit merges
box-integration at 1405932a, with
aws/agentcore-cli#2858 and
aws/agentcore-cli#2859, with no conflict. I did not rebase.

Merge order. Merge aws/agentcore-l3-cdk-constructs#470
before this PR, or at the same time. A release of @aws/agentcore-cdk with that change, and an increase of the pin in
src/assets/cdk/package.json (now 1.1.0, which does not have that change), must follow. The cause is the gateway schema of the CDK library on
box-integration. It is also .strict(), and it does not have the two fields. Thus, before that change, a project that
sets one of the fields gets through the CLI, but the synth stops. A new Box project has enableApplicationLogs: true,
thus its synth also stops with the CDK library before that change. With the CDK library before that change, the status
of a target name that two or more gateways have is local-only, because no stack has an export name with a colon.

Related Issue

None.

Documentation PR

None. The doc comments in AgentCoreGatewaySchema give the two fields. The README.md of
aws/agentcore-l3-cdk-constructs#470 gives the
CloudWatch Transaction Search prerequisite for enableTraces.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran bun test on the head, after the second merge of box-integration: 5504 tests in 346 files, with
    5497 pass, 7 skip and 0 fail. With no bun on PATH, one test fails before and after the review commits:
    SourceResolver bytes > waits for delayed process stdin under bun after importing Ink starts bun from PATH.
  • I ran bun run test:package on the head: the four npm installations pass.
  • I ran the relevant end-to-end tests with bun run test:e2e, or explained why they are not applicable
    (CI does not run them for you). I did not do these tests. I did not deploy, and I made no AWS call.
  • I ran bun run typecheck
  • I ran bun run lint:check: 0 warnings and 0 errors.
  • I ran bun run format:check
  • I ran bun run audit: 0 vulnerabilities.
  • I ran bun run secrets:check
  • I ran bun run build
  • If I modified src/assets/, I updated affected snapshots with bun test <test-file> --update-snapshots and
    committed them. I did not change src/assets/.
  • If I re-recorded fixtures or golden files, every change beyond account identifiers is explained by this PR. I did
    not record fixtures.
  • This PR does not change command.md (the release workflow regenerates it)

bun.lock does not change.

Gateway fields. src/projectSchemas/gateway.test.ts, in gateway application logs and traces, has these tests:

  • The schema accepts true and false for each field. Each value stays after the CLI writes the spec to JSON and reads
    it again.
  • A gateway without the two fields has no such field after the CLI writes the spec to JSON and reads it again.

Box gateway logs. src/core/project/manager.box.test.ts, in agentcore create, makes sure that a Box template
writes enableApplicationLogs: true in each Box gateway. src/core/project/manager.boxNetwork.test.ts, in "build
writes the Box network of the box profile", has the test "keeps the enableApplicationLogs of the Box gateway as the user
wrote it". agentcore build keeps a false. When the user removes the field, a build that changes the targets does
not add the field again. The test "create says that the Box gateway sends its logs, and how to stop them" makes sure that
create gives the warning. In manager.box.test.ts, each create --template test makes sure that a Box template gives
the warning and that a different template does not. The test "add runtime says that the new Box gateway sends its logs,
and how to stop them" makes sure that add runtime gives the warning for its new gateway only.

Target ids. src/core/project/backends/cdk.test.ts, in CdkBackend.resolveProjectResources, has these tests:

One test.each, with the gateway names of boxGatewaySpec, has eight tests:

  • Two gateways have a bedrock target, and one gateway also has an egress-github target. Each bedrock target gets
    the id of its own gateway. egress-github gets the id from the export name without the gateway.
  • One gateway has a bedrock target. The target gets the id from the export name without the gateway.
  • The gateway a has the target b, and the gateway tools has the target a-b. Each target gets its own id.
  • The one gateway tools has the targets search and tools-search. Each target gets its own id.
  • The gateways a and x have the target b-c, and the gateway a-b has the target c. Each target gets its own id.
  • The gateways my_tools and other have the target search. Each target gets its own id, and the export name has
    my-tools.
  • Two gateways have bedrock, and the stack has only GatewayTarget-bedrock-Id. No target gets an id.
  • A gateway that is not deployed has a target with an export of its name. The target gets no id.

I changed the code to make it incorrect. Each time, the related tests showed an error:

  • No enableApplicationLogs and no enableTraces in the schema: 57 tests.
  • A schema default for enableApplicationLogs: 1 test.
  • No enableApplicationLogs: true in boxGatewaySpec: 2 tests.
  • agentcore build writes enableApplicationLogs: true in the Box gateway at each run: 1 test.
  • agentcore build writes enableApplicationLogs: true when the Box gateway does not have the field: 1 test.
  • No create warning: 3 tests.
  • No add runtime warning: 1 test.
  • No warning from boxGatewayLogsWarnings: 4 tests.
  • No change from _ to - in stackExportName: 2 tests.
  • The lookup of the second commit, with the gateway and a hyphen first, then the name alone: 5 tests.
  • The two names in the other sequence, with a fallback: 1 test.
  • A hyphen, not a colon, between the gateway and the target: 2 tests.
  • No check that the gateway is deployed: 1 test.

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published.
    aws/agentcore-l3-cdk-constructs#470 is open.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

Release note

A Box project that an earlier CLI made has a Box gateway with no enableApplicationLogs field, so the gateway sends no APPLICATION_LOGS. To send them, add "enableApplicationLogs": true to the Box gateway in agentcore/agentcore.json, then deploy.

Sai Abhishek added 2 commits November 19, 2026 12:56
The CDK library adds two optional fields to a gateway entry, on the
branch `sa/box-gateway-vended-logs` of aws/agentcore-l3-cdk-constructs.
When `enableApplicationLogs` is `true`, the gateway sends its
`APPLICATION_LOGS` to CloudWatch Logs. When `enableTraces` is `true`,
the gateway sends its `TRACES` to X-Ray. The CLI gateway schema does
not accept an unknown field. Thus the CLI does not accept a project
that sets one of the two fields, and a user cannot send the `TRACES` of
a gateway to X-Ray.

`AgentCoreGatewaySchema` has the two fields as optional booleans, with
the same doc comments as the CDK library schema. The two fields have no
schema default. The CLI writes the parsed spec back to
`agentcore.json`, and a schema default adds the field to each project
file. The default of `enableApplicationLogs` also changes with
`boundRuntime`, and the CDK library applies it.

The CLI has no other copy of the gateway schema that it must keep in
step with the CDK library. The v0 schema in `src/projectSchemas/v0` is
a frozen copy, and this change does not touch it.

Tests: `gateway application logs and traces` in
`src/projectSchemas/gateway.test.ts`. The schema accepts `true` and
`false` for each field. Each value stays after the CLI writes the spec
to JSON and reads it again. A gateway without the two fields has no
such field after it is written and read again. The schema does not
accept a string for each field.
A project with two Box runtimes has two Box gateways. Each Box gateway
has a `bedrock` target, and usually an `agentcore` target. The CDK
library change on the branch `sa/box-gateway-vended-logs` of
aws/agentcore-l3-cdk-constructs adds the gateway name to the export
name of a target name that two or more gateways have:
`GatewayTarget-<gateway>-<target>-Id`. `agentcore project status` looks
for `GatewayTarget-<target>-Id` only. Thus, after a deploy, the status
shows each of these targets as `local-only`.

`identifierOf` in `src/core/project/backends/cdk.ts` looks for the
name with the gateway first, and then for the name without the
gateway. A target name that only one gateway has keeps the name without
the gateway. Thus a project with one gateway finds its targets with no
change.

Tests: in `src/core/project/backends/cdk.test.ts`, the test
`resolves a target name that two gateways share to each gateway's own id`
gives two gateways with a `bedrock` target, and one of them also with
an `egress-github` target. Each `bedrock` target gets the id of the gateway
that has it, and `egress-github` gets the id from the name without the
gateway. The test
`resolves the target of one gateway through the export name without the gateway`
gives one gateway with a `bedrock` target, and the target gets its id.
@SaiAbhishek98
SaiAbhishek98 requested a review from a team November 19, 2026 21:55
… of a new Box project

On the branch `sa/box-gateway-vended-logs` of
aws/agentcore-l3-cdk-constructs, the CDK library sends the
`APPLICATION_LOGS` of a gateway only when its entry sets
`enableApplicationLogs: true`. This is the same for a gateway with
`boundRuntime`. Before that change, a gateway with `boundRuntime` sent
them when the entry did not set the field. Thus, after that change, a
Box gateway without the field sends no logs.

`boxGatewaySpec` writes `enableApplicationLogs: true`. Thus the Box
gateway of a new Box project sends its `APPLICATION_LOGS`. `agentcore build`
changes only the targets of a Box gateway. Thus a `false` that a user
writes stays, and `agentcore build` does not add the field to a Box
gateway without it. A Box project from a previous CLI version gets no
new resources from a CDK update. The doc comment of the field gives the new default.

Tests: in `manager.box.test.ts`, a Box template writes
`enableApplicationLogs: true` in each Box gateway. In
`manager.boxNetwork.test.ts`, `agentcore build` keeps a `false`, and
does not add the field when the user removes it. Without the field in
`boxGatewaySpec`, 2 tests show an error. With an `agentcore build` that
writes `true` at each run, or only when the field is not there, 1 test
shows an error.
@SaiAbhishek98 SaiAbhishek98 changed the title feat(gateway): Accept enableApplicationLogs and enableTraces, and find the target ids of two Box gateways feat(gateway): Accept enableApplicationLogs and enableTraces, send the logs of a new Box gateway, and find the target ids of two Box gateways Nov 19, 2026
@codecov-commenter

codecov-commenter commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.79%. Comparing base (76261f6) to head (b05116c).
⚠️ Report is 1 commits behind head on box-integration.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           box-integration    #2860      +/-   ##
===================================================
+ Coverage            96.78%   96.79%   +0.01%     
===================================================
  Files                  766      766              
  Lines                66590    66803     +213     
===================================================
+ Hits                 64452    64665     +213     
  Misses                2138     2138              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of #2860 at 34da4891 (first review by leo237)

Plan check. The squash plan doc (https://pippin.amazon.dev/docs/XFRmP1pP9L90nl/box-integration-squash-and-pr-plan-v2) returned 401 when I tried to read it, so I checked the commits against the branches. None of the three commits (54abc7e6, a2404eee, 34da4891) ports anything from box-integration-development:

  • Dev has no enableApplicationLogs/enableTraces in src/projectSchemas/gateway.ts.
  • Dev's identifierOf still reads only GatewayTarget-<target>-Id.
  • The source commit 2f8ac91c is on the SaiAbhishek98 fork (fix/box-runtime-gaps), not on dev.

So this is a standalone CLI partner of aws/agentcore-l3-cdk-constructs#470, not one of the phased plan PRs. There are no missing or extra plan commits to check against.

Nothing is applied twice. No merged plan PR touches identifierOf, AgentCoreGatewaySchema or boxGatewaySpec, and #2857 and #2859 (0a8510b4) don't either. The base is 71051b42 (#2852). box-integration has since moved to dd36f7b2 (#2853), and the PR is still MERGEABLE. #2853's change to cdk.ts (the runtimeRunsInBox OTel warning) does not overlap this diff.

Protected box-integration fixes. The diff touches only identifierOf, AgentCoreGatewaySchema and boxGatewaySpec. None of the #2845/#2848/#2849/#2850/#2851/#2852/#2853 fixes is changed, and runtimeRunsInBox stays as it is.

What I checked

  • The defaults match L3 #470 at its current head. L3 #470 now has 4df982c9, which sends APPLICATION_LOGS only when enableApplicationLogs: true. The enableApplicationLogs doc comment ("Defaults to false for every gateway"), the defaults table in the body and 34da4891 all agree with it.

  • Every Box gateway the CLI creates gets enableApplicationLogs: true. All three callers of boxGatewaySpec get it: newProjectSpec (create), ensureBoxGateway, and the "Runtime has no Box gateway" validation message that prints the entry to paste. Because patchNamedEntries writes back only the fields that changed, build keeps a user's false and does not add the field back. manager.boxNetwork.test.ts covers both cases.

  • Silent failures. None found. A Box project created before this PR has a Box gateway without the field, so it sends no APPLICATION_LOGS after the CDK bump, with no message. Before #470 the CDK sent no Box gateway logs at all, so nothing that worked before is lost. I am noting it, not blocking on it.

  • New types. None. The PR adds two optional booleans to an existing .strict() schema, with no schema default. That is right for a schema the CLI writes back to agentcore.json. The frozen v0 schema is unchanged.

  • Comments. The identifierOf, enableApplicationLogs, enableTraces and boxGatewaySpec comments are accurate.

  • Tests. The coverage is good:

    • the schema round trip, with no default added;
    • rejection of a non-boolean value;
    • shared and unique target names, including the _ to - sanitization through second_agent-box;
    • create writes true;
    • build keeps false and does not add a removed field back.

    None of the new tests uses a Windows-unsafe pattern.

Non-blocking

  1. The lookup order in identifierOf can silently pick the wrong id (inline). The PR body already describes this case. If the lookup used the gateway-qualified name only when the spec has the target name on two or more gateways (the L3's own rule), there would be no ambiguity.
  2. Test nit (inline). The cdk.test.ts gateways are named agent-box, not the real <runtime>-box-egress. There is also no test for a shared name in the spec when the stack has only the unqualified export (the fallback path).
  3. Merge order / pin. Until @aws/agentcore-cdk ships with #470 and src/assets/cdk/package.json is bumped from 1.0.2, two things happen. A user-set field passes the CLI and then fails at synth. Every new Box project also writes enableApplicationLogs: true, which the current strict L3 gateway schema rejects. So new Box projects will not synth until #470 merges and the pin is bumped. The body states the merge order. Please keep this PR and the pin bump together with #470.
  4. Existing Box projects made before this PR keep a gateway without the field, so they send no logs (see above). A one-line release note telling users to add "enableApplicationLogs": true would help.

Open items from earlier reviews

This PR does not touch the following items, and none of them were expected here. They stay with their later PRs:

  • the network?.region ?? DEFAULT_EGRESS_BEDROCK_REGION fallback;
  • the agentcore dev credential refresh and AWS_PROFILE reporting;
  • box.version in agentcore dev;
  • the assert comment;
  • the refusal message after remove;
  • the seven duplicated template files;
  • the start.py test;
  • the skipped telemetry targets (29d283d6);
  • BOX_BASE_PROJECT_WRITE_TOOLS.

The ensureBoxGateway doc comment still lists add runtime and export harness as callers, although #2853 makes Box projects refuse both. That comment predates this PR.

CI (head 34da4891)

Linux, Windows, Analyze, CodeQL and the CodeBuild e2e checks pass. verify / macOS was still pending after about 13 minutes of waiting. The known flaky macOS screen-test 5 s timeouts and the Windows transactionSearch EFAULT test on the base are non-blocking if either appears.

Decision: APPROVE. Only non-blocking items remain, assuming macOS goes green.

Comment thread src/core/project/backends/cdk.ts Resolved
Comment thread src/core/project/backends/cdk.test.ts Resolved

@tejaskash tejaskash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for the target id lookup (inline), which can give a target another target's id, including in existing single-gateway projects. The schema side matches #470: same field names, types, no default, and the export name sanitizer is the same. Upgrade looks right too, since build doesn't add the field and the L3 default is off.

One description fix: add runtime and export harness also write enableApplicationLogs: true through ensureBoxGateway (manager.tsx:2254), not just create. So a Box project made by an earlier CLI that adds a runtime ends up with one gateway logging and one not. That's reasonable, since a new gateway has no log group to collide with, but the description and release note should say so.

Comment thread src/core/project/backends/cdk.ts Resolved
Comment thread src/core/project/backends/cdk.ts Resolved
Comment thread src/core/project/backends/cdk.ts Resolved
Comment thread src/projectSchemas/gateway.test.ts Resolved
Sai Abhishek added 4 commits November 19, 2026 18:23
…e CDK library writes

Before this change, `identifierOf` looked for
`GatewayTarget-<gateway>-<target>-Id` first, and then for
`GatewayTarget-<target>-Id`. A gateway name and a target name can have
a hyphen. Thus a target could get the id of a different target. An
example is the gateway `a` with the target `b`, and the gateway `tools`
with the target `a-b`. The target `b` got the id of `tools:a-b`. This
occurred also with one gateway: `tools` with the targets `search` and
`tools-search`. Also, a target of a new gateway that was not deployed
got the id of the target of a different gateway with that name.

After this change, the CLI counts the gateways in
`agentCoreGateways` that have each target name. The CDK library does
the same. For a target name that two or more gateways have, it looks only
for `GatewayTarget-<gateway>:<target>-Id`. For a different target name,
it looks only for `GatewayTarget-<target>-Id`. When the gateway itself
has no deployed id, each of its targets is `local-only`. When a second
gateway gets a target name of a deployed gateway, the two targets are
`local-only` until the next deploy writes the new export names.

Tests: in `cdk.test.ts`, one `test.each` with the gateway names of
`boxGatewaySpec` has seven tests: a shared name, one gateway, the two
hyphen examples above, a shared name with a hyphen, a shared name with
only the export from before, and a gateway that is not deployed. The lookup of
the previous commit makes 5 tests show an error. The two names in the
other sequence with a fallback, a hyphen as the separator, and
no check of the gateway each make 1 or 2 tests show an error.
…ells the assertion again

`gateway.test.ts` had a test that `AgentCoreGatewaySchema` refuses a
string for each of the two fields. That is the behavior of
`z.boolean()`, not a decision of this change. A comment in
`manager.boxNetwork.test.ts` told again what the next assertion
examines. The two are removed.
…d how to stop them

`agentcore create` writes `enableApplicationLogs: true` in the Box
gateway of a new Box project. Thus the gateway sends its
`APPLICATION_LOGS` to CloudWatch Logs, and the logs can hold the request
and response bodies of its calls. CloudWatch Logs keeps them for 90
days, and the log group has no KMS key. Before this change, `create`
did not tell the user about this.

After this change, `create` gives a warning for each Box gateway with
`enableApplicationLogs: true`. The warning says what the logs can hold,
how long CloudWatch Logs keeps them, and that
`"enableApplicationLogs": false` stops them.

Tests: in `manager.boxNetwork.test.ts`, `create` of a Box project gives
the warning. Without the warning, 1 test shows an error.
`box-integration` changed the imports of `cdk.test.ts`, and this
branch also changed them. Thus the branch had a conflict with
`box-integration`. The merge keeps the two imports.
@SaiAbhishek98

Copy link
Copy Markdown
Author

Thank you. 3b54f984 makes the target id lookup accurate. The CLI counts the gateways that have each target name, as the CDK library does. Then it looks only for the one export name that the CDK library writes. A target of a gateway that is not deployed gets no id. Each inline comment has its own reply.

About ensureBoxGateway: you are correct for the base of the first commits. 239df187 merges box-integration with aws/agentcore-cli#2853, which removes ensureBoxGateway. After that change, a Box project refuses a second runtime, thus only create writes a Box gateway. The description and the release note say this. A Box project from a previous CLI gets no logs until the user adds "enableApplicationLogs": true, and we accept this for the integration branch. 6a48a181 adds a create warning about the logs and how to stop them.

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of #2860 at 239df187 (since our approval at 34da4891)

What changed. This was a merge, not a rebase. There are three new commits, 3b54f984, 14cf2109 and 6a48a181, and a merge, 239df187, which brings in box-integration at f5503f02 (#2857). The one conflict, in the imports of cdk.test.ts, is resolved correctly: it keeps both boxGatewaySpec and BOX_RELEASE. Leaving out the conflicted file, the merge adds nothing beyond #2853 and #2857.

The branch does not have #2858 or #2859 yet. Its merge base is f5503f02, and box-integration is now at 1405932a. A trial merge of box-integration into this branch is clean. It touches only the eight files of this PR, and every must-survive fix from #2845, #2848/#2849, #2850, #2851, #2852, #2853, #2857 and #2859 stays as it is. However, see CI and the first blocking item below.

Plan check. The squash plan doc (https://pippin.amazon.dev/docs/XFRmP1pP9L90nl/box-integration-squash-and-pr-plan-v2) still returns 401, so I checked against the branches. None of the three new commits is on box-integration-development, and dev has no enableApplicationLogs, boxGatewayLogsNotice or gatewaysByTargetName. They are review fixes for this standalone partner of aws/agentcore-l3-cdk-constructs#470, not dev ports. No later plan PR covers the items below.

L3 #470 and the pin. aws/agentcore-l3-cdk-constructs#470 is still open (head 57b08a4b). Once this branch has the current box-integration, the pin in src/assets/cdk/package.json is 1.1.0 (from the v1.x sync, #2858), not 1.0.2. But 1.1.0 does not contain #470, so the merge-order point from our last review still applies. The description should say 1.1.0 instead of 1.0.2.

Earlier comments: addressed

  • Our identifierOf ordering comment, and tejaskash's. Addressed in 3b54f984. The lookup counts the gateways that have each target name, exactly as createGatewayOutputs does in L3 #470 at 57b08a4b. It then asks for only the one export name, GatewayTarget-<gateway>:<target>-Id or GatewayTarget-<target>-Id, with no fallback. The colon gets through stackExportName ([^a-zA-Z0-9:-]) and matches the L3's exportName. The three hyphen examples (ours, and both of tejaskash's) are now test cases.
  • tejaskash's "target of an undeployed gateway takes another gateway's id". Addressed. Targets of a gateway without a Gateway-<name>-Arn export are reported local-only.
  • Our test nit. Addressed. The tests use boxGatewaySpec(...) names, and the "shared in spec, only unqualified in stack" case is pinned. It now expects no id instead of a fallback.
  • tejaskash's comment nits and the zod-rejects-a-string test. Addressed in 3b54f984 and 14cf2109. The tests are now a single test.each.
  • The ensureBoxGateway doc comment from our last review. Gone, because #2853 removed ensureBoxGateway.

Blocking

  1. CI: verify / Linux fails with error: Script not found "test:package" (step "Smoke test npm installation with host TypeScript versions"). The workflow from #2858 runs bun run test:package, and this branch's package.json does not have the script yet. Please merge (or rebase onto) the current box-integration.
  2. After that merge, add runtime in a Box project turns on APPLICATION_LOGS with no notice (inline at manager.tsx:628). #2859 brought add runtime back for Box projects, and its addBoxRuntime writes boxGatewaySpec(name), which now carries enableApplicationLogs: true. The new notice (6a48a181) is given only by create. The PR description's "Only create writes a Box gateway" paragraph relies on #2853 refusing a second runtime, and #2859 has since undone that. tejaskash asked for exactly this case to be covered. Please give the same notice from addBoxRuntime, add a test for it, and update the description.

Reviewed and fine

  • Silent failures. The new lookup gives no id instead of a wrong id. In one case a target is shown local-only even though it is deployed: when a second gateway takes an existing target name and has not been deployed yet. That is the safe direction, and the description says so.
  • Comments. The new identifierOf comment, the gateway-not-deployed comment, the boxGatewaySpec doc and boxGatewayLogsNotice are accurate. The 90-day retention matches RetentionDays.THREE_MONTHS in L3 #470.
  • New types. None. The local-only stub child has the same shape that resolve returns for a target with no id.
  • Tests. Seven test.each cases cover the lookup, and a create warning test covers the notice. No Windows-unsafe patterns (no hard-coded / paths, no splitting on : for paths, no POSIX file modes, no sh, no empty env).

Non-blocking

  • Nit (inline at cdk.test.ts:1584). No case now has a _ in a gateway name, so the _ to - change for the qualified <gateway>:<target> export is not tested.
  • Nit. The notice test checks only that the warning is present. A negative case would pin that a non-Box create gives no notice.

CI (head 239df187)

  • verify / Linux: fail, with Script not found "test:package" (blocking item 1).
  • verify / Windows, Analyze, CodeQL and the CodeBuild agentcore-e2e check: pass. e2e was skipped.
  • verify / macOS: still pending when I posted (about 9 minutes after the run started). The known flaky 5 s macOS screen-test timeouts and the Windows transactionSearch EFAULT test on the base are non-blocking if either shows up.

Decision: COMMENT. Two blocking items: the CI failure, which a merge of box-integration fixes, and the missing logs notice on add runtime once #2859 is in.

Comment thread src/core/project/manager.tsx Resolved
Comment thread src/core/project/backends/cdk.test.ts Resolved
Sai Abhishek added 3 commits November 19, 2026 18:55
`box-integration` has two new PRs. The CI workflow of the base runs
`bun run test:package`, and the branch did not have that script. Also,
`add runtime` writes a Box gateway again. The merge has no conflict.
…ds its logs

`add runtime` in a Box project writes a new Box gateway with
`boxGatewaySpec`, thus with `enableApplicationLogs: true`. Before this
change, only `create` told the user that the gateway sends its
`APPLICATION_LOGS`, which can hold the request and response bodies of
its calls.

After this change, `boxGatewayLogsWarnings` gives the warning for each
Box gateway with `enableApplicationLogs: true` in a list. `create` gives
it for the Box gateways of the new project. `addBoxRuntime` gives it for
the Box gateway that it writes. These are the two commands that write a
new Box gateway.

Tests: in `manager.box.test.ts`, `add runtime` gives the warning for
its new gateway only. Each `create --template` test makes sure that a
Box template gives the warning and that a different template does not.
Without the warning of `add runtime`, 1 test shows an error. Without
the warning of `create`, 3 tests show an error. With no warning from
`boxGatewayLogsWarnings`, 4 tests show an error.
…in its name

No target id test had a gateway name with an underscore. Thus no test
examined the change from `_` to `-` in the export name
`GatewayTarget-<gateway>:<target>-Id`. After this change, a test has the gateways
`my_tools` and `other` with the target `search`. Without the change
from `_` to `-` in `stackExportName`, 2 tests show an error.

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of #2860 at fd93daaf (since our COMMENT at 239df187)

What changed. This was a merge, not a rebase. There are three new commits:

  • 7c2b49fa merges box-integration at 1405932a (#2858 and #2859).
  • aff8f148 adds the logs notice to add runtime.
  • fd93daaf adds the _ gateway-name test.

The merge base is now the current box-integration head (1405932a). 7c2b49fa is a clean auto-merge: replaying it gives a tree identical to the commit. Against box-integration, the PR touches only its own eight files. The only lines it removes are the old identifierOf lookup, the old addBoxRuntime push (now split into two lines) and a reworded doc comment. Nothing from #2858 or #2859 is lost. That includes the per-runtime .box/<name>/ profile, boxValidation.ts, add runtime in Box projects and addBoxRuntime. All must-survive fixes from #2845 through #2857 are unchanged, since none of those files differ except the eight above.

Plan check. The squash plan doc (https://pippin.amazon.dev/docs/XFRmP1pP9L90nl/box-integration-squash-and-pr-plan-v2) still returns 401, so I checked against the branches. box-integration-development still has no enableApplicationLogs or boxGatewayLogs*. These are review fixes for this standalone partner PR, not dev ports.

Earlier comments: addressed

  • Blocking 1, CI Script not found "test:package". Addressed by the merge of box-integration. verify / Linux now passes.
  • Blocking 2, the missing notice on add runtime (inline at manager.tsx:628). Addressed in aff8f148:
    • boxGatewayLogsWarnings is shared by create and addBoxRuntime. addBoxRuntime passes only the gateway it writes, so the existing Box gateway does not get a second notice.
    • The new test "add runtime says that the new Box gateway sends its logs, and how to stop them" checks for exactly one notice, for search-box-egress.
    • These are the only two writers of a Box gateway. templates/project.ts:140 is used by create, manager.tsx:2445 only computes the name, and project.ts:176 prints a schema message.
  • Nit: no _ to - test for the qualified name (inline at cdk.test.ts:1584). Addressed in fd93daaf. my_tools and other share search, and the lookup finds GatewayTarget-my-tools:search-Id. The fixture now sanitizes the Gateway-<name>-Arn export the same way.
  • Nit: no negative case for the notice. Addressed. Each create --template case now asserts warnings.includes(notice) === (projectType === "box").
  • Description. Addressed. It now says the pin is 1.1.0, drops "Only create writes a Box gateway", and explains that one Box gateway can have logs while another does not.
  • tejaskash's earlier items were addressed in 3b54f984/14cf2109, as noted in our last review.

Reviewed and fine

  • Silent failures. None new. The notice is yielded inside the try that discards the staged paths, so a failed box scaffold gives no notice.
  • Comments. The reworded boxGatewayLogsNotice doc and the new boxGatewayLogsWarnings doc ("create and add runtime") are accurate.
  • New types. None exported. boxGatewayLogsWarnings takes an inline structural type for the gateway (see the nit below).
  • Windows safety. The new tests have no hard-coded paths, no splitting on : for paths, no file modes, no sh and no empty env.

Non-blocking

  • Nit (inline at manager.tsx:2149). In addBoxRuntime, the notice is yielded before addResource parses and writes agentcore.json (manager.tsx:1071-1076). If that write fails, the user sees "sends its APPLICATION_LOGS" followed by an error, for a gateway that was never written. The error is visible, so nothing fails silently. Yielding the notice after the spec write, as create does after reading the project back, would make the two commands consistent.
  • Nit. boxGatewayLogsWarnings could take readonly AgentCoreGateway[] (the schema's inferred type) instead of the inline { name; boundRuntime?; enableApplicationLogs? }, so it stays in step with the schema.

Note: L3 merge order

aws/agentcore-l3-cdk-constructs#470 is still open (head 57b08a4b, CHANGES_REQUESTED). The @aws/agentcore-cdk pin on box-integration is 1.1.0, which does not contain #470. Until #470 is merged and released, and the pin is raised:

  • a new Box project (enableApplicationLogs: true) fails at synth against the strict L3 schema;
  • shared target names show as local-only.

So, as the description says, merge #470 first or at the same time, then raise the pin.

CI (head fd93daaf)

  • verify / Linux, verify / Windows, Analyze, CodeQL and CodeBuild agentcore-e2e: pass. e2e: skipped.
  • verify / macOS: still pending when I posted (about 10 minutes into the run). The known flaky 5 s macOS screen-test timeouts and the Windows transactionSearch EFAULT test on the base are non-blocking if either shows up.

Decision: APPROVE. Both blocking items from our last review are fixed, and only nits remain. The L3 #470 merge order is a note, not a blocker for this PR.

Comment thread src/core/project/manager.tsx Resolved
Sai Abhishek added 2 commits November 20, 2026 09:50
`box-integration` has three new changes: PR 5
([aws#2866](aws#2866)),
the pin of box 0.1.11-mquang.preview.9
([aws#2867](aws#2867)),
and `--containment`
([aws#2854](aws#2854)).
Two files had a merge conflict.

In `create` in `manager.tsx`, `box-integration` gives
`defaultLogTargetNotices`, and this branch gives `boxGatewayLogsWarnings`.
The merge keeps the two.

In the imports of `manager.boxNetwork.test.ts`, `box-integration` removes
`renderRuntimeBoxProfile`, and this branch adds `boxGatewayLogsNotice`.
The merge keeps only `boxGatewayLogsNotice`.

A test of `box-integration` makes sure that `add runtime` gives no
`warning` before the write of agentcore.json. The name of the test is "a
failed write of agentcore.json gives no notice of the default log
target". `addBoxRuntime` gave the logs `warning` before that write, thus
that test showed an error after the merge. The merge moves the logs
`warning` of `add runtime` to after the write, with the
`defaultLogTargetNotices` of `box-integration`. `create` also gives each
`warning` after the write.
…e.json stops with an error

A comment of Leo on this pull request
(aws#2860 (comment))
tells that `add runtime` gave the logs `warning` of the new Box gateway
before the write of agentcore.json. When that write stopped with an
error, the user saw the `warning` for a gateway that agentcore.json did
not have. `create` gives its `warning` only after the write.

The merge before this commit moves the `warning` of `add runtime` to
after the write. This commit adds a test for that sequence. The test
gives `addResource` a JSON writer that refuses the write of
agentcore.json, thus the test does not use file modes, and root gets the
same result. `refusingSpecWrites` holds that writer. The test of the
default log target from `box-integration` also uses it.

Tests: in `manager.box.test.ts`, the new test makes sure that the add
wrote the box profile of the runtime, and then gave no logs `warning`.
It also makes sure that agentcore.json did not change. With the
`warning` in `addBoxRuntime`, the new test and the test of the default
log target show an error. With the `warning` in `addResource`
immediately before the write, the two tests show an error. With no
`warning` from `add runtime`, the test that `add runtime` gives the
`warning` shows an error.
@SaiAbhishek98

Copy link
Copy Markdown
Author

This branch has a merge of box-integration, with PR 5, the box preview.9 pin, and --containment; there is no rebase and no force-push.
The two merge conflicts were small: create gives defaultLogTargetNotices and then the Box gateway logs warning, and the network test does not import renderRuntimeBoxProfile again.
For the comment of Leo, add runtime gives the logs warning only after the write of agentcore.json, the same as create. A test with a JSON writer that refuses that write makes sure of it.

@leo237 leo237 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of #2860 at b05116c8 (since our approval at fd93daaf)

Scope. Of the 36 commits in fd93daaf...b05116c8, the PR's own new work is the merge d9c52306 and the test commit b05116c8. The rest are box-integration commits (#2854, #2862, #2865, #2866, #2867 and others) that were reviewed separately, so I did not re-review them.

The merge d9c52306. It brings in box-integration at e5a5ddf5 (#2854), which is the current base head, so the branch is up to date. I compared the PR's net diff against 1405932a at fd93daaf with its net diff against e5a5ddf5 at b05116c8:

  • git range-diff shows the five PR commits unchanged (=).
  • cdk.ts, cdk.test.ts, gateway.ts, gateway.test.ts, project.ts and manager.boxNetwork.test.ts differ only in hunk offsets and import context.
  • In manager.tsx, the merge moves one thing. The add runtime warning is no longer yielded in addBoxRuntime, after writeBoxProfile. It is now yielded in addResource after this.json.write(agentCoreSpecPath, ...), next to defaultLogTargetNotices from box-integration. The filter is agentCoreGateways.filter(({ boundRuntime }) => boundRuntime === added). Because of this move, the addBoxRuntime push is now unchanged from base. The create warning (isBoxProject → boxGatewayLogsWarnings) stays where it was.
  • The lines the PR removes from base are the same set as before. The only differences are the moved addBoxRuntime line, the runtimes.filter(... input.resourceConfig.name) line (now through added) and the inline JSON writer that became refusingSpecWrites. Nothing from base is dropped.

Must-survive fixes. Against box-integration, the PR still touches only its own eight files (cdk.ts/cdk.test.ts, manager.tsx, manager.box.test.ts, manager.boxNetwork.test.ts, gateway.ts/gateway.test.ts, project.ts). In manager.tsx, the only lines it removes are the ones listed above. So none of these is touched:

  • boxProfileCredentials / ENV_LOCAL_RELATIVE_PATH, writesBedrockRoute/tomlKey, Dockerfile curl --retry 3/tar --no-same-owner, xray grants
  • runtimeRunsInBox/assertBoxRuntimesHaveBoxVersion, ${{ inputs.gateway.url }}/${{ inputs.aws.region }}, per-runtime .box/<name>/
  • dev secrets, boxStartFolder, .venv/bin/python, EnvLocalFile.upsert, publishInstall
  • runtimeProfile/*, ffi shim removal, BOX_OTHER_MACHINE_HINT
  • the box pin 0.1.11-mquang.preview.9 (no SHA256SUMS.txt, no refuseOldShippedNames)
  • #2854 --containment

ENV_LOCAL_RELATIVE_PATH and the envFile?.rollback() cleanup in addResource are still in place.

b05116c8. It adds refusingSpecWrites, which refuses the agentcore.json write through an injected ReadWriteJson rather than file modes, so it also works as root on Linux CI. The default-log-target test now uses it as well. The new test checks three things:

  • add reached writing box profile <.box/search/local/profile.toml>.
  • No boxGatewayLogsNotice was yielded.
  • agentcore.json is unchanged.

The paths go through join, the test spawns nothing and uses no POSIX modes. The comments ("After the write, so a failed write gives no notice ..." and the boxGatewayLogsWarnings doc naming create and add runtime) match the code.

Earlier comments

  • Our nit on the order of the add runtime notice (r4638058352). Addressed. The notice now comes after the spec write, and b05116c8 tests that order. The author first planned this for PR 5, but it landed here.
  • Everything else from our earlier reviews was already addressed at fd93daaf.

Blocking

None.

Non-blocking

  • The new test's warning assertion is partly covered by the sibling test just above it, which already checks for no warning of any kind on the same failed add runtime. What the new test adds is the box-profile-written check, which shows the failure happens after scaffolding, and the spec-unchanged check. It is fine to keep both. See the inline comment.
  • Dependency, already known, status update. aws/agentcore-l3-cdk-constructs#470 is still open, not merged. Its head has moved to 2f01972e. This PR still needs #470 merged and released and a CDK pin bump past 1.1.0 before the :-qualified export names and the gateway enableApplicationLogs/enableTraces fields work end to end.

CI

All checks pass at b05116c8: verify / Linux, verify / Windows, verify / macOS, CodeQL/Analyze and CodeBuild e2e. The GitHub e2e job is skipped, as is usual for this repo.

Comment thread src/core/project/manager.box.test.ts Resolved

@tejaskash tejaskash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this addresses everything from my review: the lookup now picks one export name from the shared-name count with no fallback, a target under a gateway that isn't deployed shows as not deployed, and create and add runtime say when logs are on. The pair with #470 agrees on names, types, defaults and export names.

Please merge this together with or after aws/agentcore-l3-cdk-constructs#470, not before. And one sentence for the release note: add runtime and export harness also turn logs on for the new Box gateway, so an older Box project that adds a runtime ends up with one gateway logging and one not.

@SaiAbhishek98
SaiAbhishek98 merged commit f98cfd6 into aws:box-integration Nov 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants