Skip to content

fix(box): Show the cause and the correct step when build stops for a third-party telemetry target that it does not carry - #2919

Open
SaiAbhishek98 wants to merge 8 commits into
aws:box-integrationfrom
SaiAbhishek98:sa/box-3p-codezip-stop-message
Open

SaiAbhishek98 wants to merge 8 commits into
aws:box-integrationfrom
SaiAbhishek98:sa/box-3p-codezip-stop-message

Conversation

@SaiAbhishek98

Copy link
Copy Markdown

Description

This pull request is on top of aws/agentcore-cli#2917. Review only the last commit, cf42b555. The other commits are the commits of #2917. After #2917 merges, I rebase this branch onto box-integration, and then the diff shows only this change.

Problem. For a CodeZip runtime, agentcore build stops for a langfuse, langsmith, or otlp telemetry target. The stop message tells the customer to read the warning for that target. Build does not show that warning. Thus, the customer cannot find the cause, or the change that removes the stop.

Before:

[telemetry.langfuse] kind is "langfuse", and build cannot carry this target to AgentCore Runtime: the warning for [telemetry.langfuse] gives the reason. Correct that, remove [telemetry.langfuse], or change its kind to "cloudwatch_logs" or "cloudwatch_traces".

After:

[telemetry.langfuse] kind is "langfuse", and build cannot carry it to AgentCore Runtime: Box reads its key on AgentCore Runtime with the AWS CLI, which a CodeZip runtime does not have. Use a container runtime, remove [telemetry.langfuse], or change its kind to "cloudwatch_logs" or "cloudwatch_traces".

Solution. The Box network model gives each telemetry target that build does not put in the Runtime profile, with its cause and its correct step. The check that stops build (notCloudWatch in refusals.ts) shows this cause and this step in the stop message. The four other causes also show their own text: a value that build cannot move to the Runtime profile, a secret.ref that is not env:// or secret://, a target name that cannot be the name of an environment variable, and a deploy variable that a different target reads.

The behaviour does not change. Build stops for the same targets as before. Only the text changes.

Related Issue

No issue. This change is part of the Box on AgentCore integration.

Documentation PR

Not applicable. The change is in the text of a stop message only.

Type of Change

  • Bug fix

Testing

  • I ran bun test
  • I ran the relevant end-to-end tests with bun run test:e2e: not applicable, because build stops before deploy for these targets
  • I ran bun run typecheck
  • I ran bun run lint:check
  • I ran bun run format:check
  • I ran bun run build

The tests that check the text:

  • network.test.ts, "stops build with the reason the model leaves a target out, as the stop prints it": the CodeZip cause, the Secrets Manager cause, and a value that build cannot move.
  • refusals.test.ts, "states the reason and the step the Box network model gives when it leaves the target out", and "names no warning when the model gives no reason".
  • manager.boxNetwork.test.ts: the warning text that this change rewrites.

Checklist


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

Sai Abhishek added 8 commits November 24, 2026 17:33
… the Runtime

This commit holds five commits of box-integration-development, resolved against
box-integration: 7ad00c3, 212d17f, 96cc734, 3ad5f5c, and 71801df.

Deploy writes the key of each third-party telemetry target (otlp, langfuse, langsmith)
into one AWS Secrets Manager secret for each runtime, agentcore/<project>/<runtime>/box,
outside the stack. The Runtime profile gets plugins = ["@box/aws-secrets-manager"] and
an aws-secretsmanager:// reference for each target. The execution role gets
secretsmanager:GetSecretValue on that secret only. The container image installs the
AWS CLI after a signature check, because the plugin runs aws.
…er, and remove the AGENTCORE_BOX_SECRETS_MANAGER switch
…arn that its VPC has no path to the host, and ask the L3 for an AWS Secrets Manager endpoint
…emetry build test

The step message names ENV_LOCAL_RELATIVE_PATH, which has a backslash on Windows. The test now
expects that constant, as the other tests in this file do.
…me kind have different secret fields and Runtime profile refs
…third-party telemetry target that it does not carry

## Problem

For a CodeZip runtime, `agentcore build` stops for a `langfuse`, `langsmith`, or `otlp` telemetry
target. The stop message tells the customer to read the warning for that target. Build does not
show that warning. Thus, the customer cannot find the cause, or the change that removes the stop.

## Solution

The Box network model gives each telemetry target that build does not put in the Runtime profile,
with its cause and its correct step. The check that stops build (`notCloudWatch` in
`refusals.ts`) shows this cause and this step in the stop message. For a CodeZip runtime, the
message is:

    [telemetry.langfuse] kind is "langfuse", and build cannot carry it to AgentCore Runtime: Box
    reads its key on AgentCore Runtime with the AWS CLI, which a CodeZip runtime does not have. Use
    a container runtime, remove [telemetry.langfuse], or change its kind to "cloudwatch_logs" or
    "cloudwatch_traces".

The four other causes also show their own text: a value that build cannot move to the Runtime
profile, a `secret.ref` that is not `env://` or `secret://`, a target name that cannot be the
name of an environment variable, and a deploy variable that a different target reads.

## Tests

- `network.test.ts`, "stops build with the reason the model leaves a target out, as the stop
  prints it": the CodeZip cause, the Secrets Manager cause, and a value that build cannot move.
  "no stop for a target that the model carries" makes sure that build does not stop for a target
  in the Runtime profile.
- `refusals.test.ts`, "states the reason and the step the Box network model gives when it leaves
  the target out", and "names no warning when the model gives no reason".
- `manager.boxNetwork.test.ts`: the warning text that this change rewrites.
- Typecheck, lint, format, and the full `bun test` suite have no errors.

No deploy test: build stops before deploy for these targets.

@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.

Reviewed cf42b55 only, as the description asks. Apart from the commit message, its patch is the same as 52e61a1, which I reviewed and approved on #2917. There I checked that every left-out target reaches the stop with its cause, that the fixes for the CodeZip, ref, name, and collision causes are correct, and that mutations of the cause-plumbing fail tests. Those 599 touched tests passed, along with typecheck and oxlint.

The same two nits from that review apply here, inline. Neither blocks.

if (uncopied.length > 0) {
leftOut.push({
name,
reason: `Box resolves its \`${uncopied[0]}\` to a value build cannot copy`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: this is the only cause with no fix, but there is a step: give the key a string, a list of strings, or a table of strings (what copiedValue accepts). Something like fix: `Give \`${uncopied[0]}\` a string, a list of strings, or a table of strings` would do. Then the test title at network.test.ts:1718 ("has no step but to remove it") and the fix doc comment ("absent means no such step") should change too.

]);
});

test("a target with a value build cannot copy, which has no step but to remove it", () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: the PR comment says each case goes through buildBoxNetwork, but this block covers 3 of the 5 causes. The bad target name (telemetry.ts) and the variable collision (network.ts) are checked only through their warnings. Two more stopOf cases would also pin their "Rename the target, remove ..." text.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.76715% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.90%. Comparing base (4235b7b) to head (cf42b55).

Files with missing lines Patch % Lines
src/core/project/backends/cdk/telemetrySecrets.ts 93.43% 13 Missing ⚠️
src/core/project/boxNetwork/network.ts 98.63% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           box-integration    #2919    +/-   ##
=================================================
  Coverage            96.89%   96.90%            
=================================================
  Files                  776      778     +2     
  Lines                69346    69954   +608     
=================================================
+ Hits                 67194    67788   +594     
- Misses                2152     2166    +14     

☔ 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.

This branch has not been deployed

No deployments
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.

3 participants