Skip to content

fix(box): Address the review of the host map and the gateway targets - #2877

Merged
SaiAbhishek98 merged 53 commits into
aws:box-integrationfrom
SaiAbhishek98:sa/review-fixes-host-map
Nov 24, 2026
Merged

SaiAbhishek98 merged 53 commits into
aws:box-integrationfrom
SaiAbhishek98:sa/review-fixes-host-map

Conversation

@SaiAbhishek98

Copy link
Copy Markdown

Description

The report "Box integration: review of merged PRs" (2026-11-19) found defects in
aws/agentcore-cli#2847, which reads a box profile
and finds its hosts, and in aws/agentcore-cli#2849,
which writes the Box gateway targets from those hosts. The reviewer examined box-integration at
1f3ae974. This PR examines each item again at f98cfd68, after
aws/agentcore-cli#2866 and the PRs that came
after it.

The defects have three effects on the user:

  • Some stop a correct build: a rule that Box accepts, two names of one key, and a user rule
    whose @id Box also writes.
  • One removes a host and gives no failure: two path conditions in one permit.
  • One changes a target of the user: build removes a user target whose name starts with
    egress-.

Each correction is in a different commit, with a test that gives an error before the correction, and a
mutation proof. The table gives each item.

Review item Status Commit Test
aws/agentcore-cli#2847: two path conditions make a host unreachable Corrected c6bb00b7 Keep a host reachable when two path tests of one permit hold on one path hostMap.test.ts "finds a host reachable when two path patterns of one permit hold on one path" (and 3 more)
aws/agentcore-cli#2847: an action test gives UNKNOWN_ATTRIBUTE Corrected acd14196 Accept a field that an action test keeps from the action hostMap.test.ts "an attribute that an action test keeps from the action, as Box reads it" (6 tests)
aws/agentcore-cli#2847: an IP limit on a connection is not in enforcedByBox Corrected daeec2ad Name a connection permit that limits the address among the rules Box applies hostMap.test.ts "names a connection permit that limits the address, and not one that allows any"
aws/agentcore-cli#2847: build accepts port 65536 Corrected ec299b77 Refuse a rule that names a port out of the range 1 to 65535 network.test.ts "fails each rule that names port %d, which is not a port" (65536, 0, -1)
aws/agentcore-cli#2847: error text gives mquang-amazon/box-releases Corrected before the report, by 26f1a2dc none Each message reads BOX_RELEASE.repo from boxRelease.json
aws/agentcore-cli#2847: casts, a second isTable, the uv sync hint, and banners Corrected f93f4e74 Name the right folder in the uv sync hint, and remove the casts of the profile parser boxProfileResolver.test.ts "the uv sync hint, when Box refuses a missing .venv under a write grant" (5 tests)
aws/agentcore-cli#2849: a Runtime route has the @id of a user rule Corrected ddd14081 Give a Runtime route a free name when a rule of the policy has its route rule's @id gateway.test.ts "names no route so that box adds a rule with the @id of a rule of the policy" (2 tests), and one test through buildBoxNetwork
aws/agentcore-cli#2849: a reserved variable and its alias are two keys Corrected 47acc2f6 Take one API key credential for its own variable and one other variable network.test.ts "takes one credential for its own variable and for one other variable, which build copies to it"; boxNetworkSource.test.ts "takes the credential of another runtime for the credential's own variable"
aws/agentcore-cli#2849: build removes a user egress-* target Corrected 8942a802 Own only the gateway targets that build recorded, and keep a user's egress- target manager.boxNetwork.test.ts "owns only the targets it records, after it takes its old egress- targets once" (and 9 more)
aws/agentcore-cli#2849: a host with no credential gets no target, and only a step Corrected (from box-integration-development) d0f95235 Warn for a host that gets no gateway target, and give a model-provider route its credential manager.boxNetwork.test.ts "writes the target of a model-provider route once its key is set, as the warning says" (and 6 more)
aws/agentcore-cli#2849: small items Corrected, but 2 items stay 662b2eaa Refuse two box runtimes in one folder in the schema, and remove casts and copies project.test.ts "Box runtimes and the folder build stages box in" (3 tests)

Decisions that the diff does not show

  • Item 1. The host map keeps its sample requests. When the policy lets no sample request
    through, the host map finds a path that the path tests of a permit let through together, and
    that no forbid denies when build can read all of its conditions. The result is accurate for like, ==, and !=. After 4096 search
    steps, the search stops, and the host stays reachable. Then build gives a warning that names
    the rule.
  • Items 2 and 3. Box 0.1.11-preview.10 rejects the two examples of the report for different
    causes. Box rejects a rule that reads context.input in two action families, and ip() accepts
    only a literal. The tests use the shapes that Box accepts: an action test in one family, and
    context.input.ip4 like "10.*".
  • Item 7. Box 0.1.11-preview.10 rejected [egress.egress-api-b-example-com] adjacent to the
    user rule route_egress-api-b-example-com_request, with exit 1. Box accepts the new name
    egress-api-b-example-com-2 adjacent to that rule, with exit 0.
  • Item 9. build records its targets in agentcore/box-gateway-targets.json, and not in a
    field of agentcore.json. The L3 schema of agentcore.json is strict. Thus a new field stops
    synth until the L3 accepts the field. build changes and removes only the targets in the record.
    • The record has no gateway that a CLI from before this change built. For such a gateway,
      build records each egress- target with the same shape that build writes. It does this
      one time.
    • build keeps an egress- target of a different shape as a target of the user. Thus a target
      that build wrote and the user then changed is a target of the user.
    • This is a design decision. Tell me if it is correct, or which different design to use.
  • Item 10. The credential planner of
    aws/agentcore-cli#2845 did not add a
    credential for a model-provider route that agentcore create writes with no key, such as
    [egress.openai] with env://OPENAI_API_KEY. On AgentCore Runtime, the gateway target of that
    route sends the key of its credential. Thus the OpenAI, Anthropic, and Gemini routes did not
    get a target. Now the planner adds the credential openai when OPENAI_API_KEY has a value.
    This is the rule of box-integration-development. This change replaces two tests of aws/agentcore-cli#2845. Varun, examine this item, because it changes your planner.

Checks that continuous integration cannot do

  • Box 0.1.11-preview.10 for macOS (SHA-256 examined against SHA256SUMS.txt) accepted or rejected
    each policy shape that the tests of items 2, 3, 4, and 7 use.
  • The uv sync hint gave the correct folder for two errors from Box: a project path with spaces,
    and a long path that Box breaks in a word.

Follow-ups that this PR does not do

  • On the first build, an entry that reads AGENTCORE_CREDENTIAL_GITHUB can get a different
    credential name, before the credential github is in agentcore.json. The next build writes
    its target. For this correction, the model must use the planner. Thus it is a different change.
  • The box model is on the ProjectBackend input of all backends, and boxNetworkSource.ts imports
    DEFAULT_EGRESS_BEDROCK_REGION from src/handlers/. For the two changes, the Box gateway names
    must move out of shortcuts.ts, which is an item of
    aws/agentcore-cli#2789.
  • README.md and docs/box-local-testing.md give the release repository as text. The move of the
    releases changes them.

Related Issue

The report on the merged Box PRs. There is no issue for it.

None.

Documentation PR

This PR changes one paragraph of docs/box-local-testing.md: which gateway targets build changes.

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: 5869 pass, 7 skip, 0 fail, in 5876 tests. Before this change: 5829 pass, 7 skip, 0 fail, in 5836 tests.
  • 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 the end-to-end tests. No change is in deploy,
    and each changed path has unit tests and command-flow tests.
  • I ran bun run typecheck
  • I ran bun run lint:check
  • I ran bun run format:check
  • I ran bun run audit
  • I ran bun run secrets:check
  • I ran bun run build, and bun run test:package
  • If I modified src/assets/, I updated affected snapshots with bun test <test-file> --update-snapshots and committed them
  • If I re-recorded fixtures or golden files, every change beyond account identifiers is explained
    by this PR
  • This PR does not change command.md (the release workflow regenerates it)

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

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 10 commits November 20, 2026 11:20
…d on one path

The host map decides each host on sample requests. A sample path comes
from one path test at a time. A permit with two path tests, such as
`path like "/v1/*"` and `path like "*/items"`, got no sample that passes
both. The host was then unreachable, with no failure, and build gave it
no gateway target, but Box allows GET /v1/items.

When no sample request is allowed, the host map now searches for a path
that the path tests of a permit allow together and that no forbid
surely denies (pathSolver.ts). The search is exact for `like`, `==`,
and `!=`. When the search is too large (more than 4096 states), the host
stays reachable, the permit goes in `uncheckedBy` and `enforcedByBox`,
and build gives a warning that names the rule.

Tests: hostMap.test.ts "finds a host reachable when two path patterns of
one permit hold on one path", "finds a path of a permit that a forbid of
one path leaves open", "finds no path when the path patterns of a permit
never hold together", "keeps a host reachable, and names the permit,
when its path tests are too many to check"; network.test.ts "names a
permit whose path tests build cannot check together, and keeps its
host". The random-rule property test still passes. Mutations: no
search, a search that ignores the forbids, and no state limit each
make a test fail.
Box reads a rule as Cedar types it: it does not read the right operand
of `||` after an action test that holds, the right operand of `&&`
after one that does not, the other branch of `if`, or a later `when`
after an action test that is false. So box 0.1.11-preview.10 accepts
`permit (principal, action == Box::Action::"net:connect", resource)
when { context.input.host == "a" && (action == Box::Action::"net:connect"
|| context.input.method == "GET") }`. The host map read every operand,
refused the rule with UNKNOWN_ATTRIBUTE, and build stopped.

checkAttributes now skips each operand that an action test keeps from
the action (actionValue), and clausesFor stops at a condition that an
action test makes false. A field that no action test keeps from the
action is still refused.

The review's own example puts http:request and net:connect in one rule.
Box 0.1.11-preview.10 refuses that rule for another cause (it reads
context.input under two action families), so the tests use the forms
that box accepts.

Tests: hostMap.test.ts "an attribute that an action test keeps from the
action, as Box reads it" (6 tests: `||`, `&&` with `!=`, `if`, a request
rule that reads ip4, a later `when`, and the refusal of an unguarded
field). Mutations: no `&&`/`||` stop, both `if` branches read, and every
condition read each make a test fail.
…rules Box applies

A host's enforcedByBox named the request permits that limit a host and
the forbids, but no connection permit. A permit that allows connections
to a host only at some addresses (`context.input.ip4 like "10.*"`) is a
limit that Box applies and the gateway does not. Build gave no warning
for it.

The host map now names each connection permit of a reachable host whose
every clause there limits the address or has a condition build cannot
read. A connection permit with a clause that allows any address is not
named.

The review's example used `ip(context.input.ip4).isInRange(...)`. Box
0.1.11-preview.10 refuses that form (ip() takes only a literal, and ip4
is a string), so the test uses the form that Box writes itself.

Tests: hostMap.test.ts "names a connection permit that limits the
address, and not one that allows any". Mutations: no connection permits
named, and every connection permit named, each make a test fail.
The host map took the port that a rule fixes (`context.input.port ==
65536`, `== 0`, or `== -1`) with no check. Box accepts such a rule, which
never holds, but build made a host of `host:65536` and wrote a gateway
target for an endpoint that is not a URL.

The host map now refuses each rule that fixes a port that is not an
integer from 1 to 65535, with the new failure code INVALID_PORT, at the
rule's line. A destination of an [egress] entry already had this check
(parseDestination).

Tests: network.test.ts "fails each rule that names port %d, which is
not a port" (65536, 0, and -1, for a connection and a request rule).
Mutations: an upper bound of 65536 and a lower bound of 0 each make a
test fail.
…asts of the profile parser

Box 0.1.11-preview.10 wraps its error at 80 columns. It wraps at a space
or inside a word, and starts each next line with 12 spaces. The uv sync
hint took the venv path from one line, up to the last space. For a
project path with a space, or a path that Box wrapped, the hint named a
wrong folder, such as "Run 'uv sync' in agent" or "in /agent".

The hint now joins the lines of each Box error in each way (a space or
no space at each wrap, up to 8 wraps). It names the folder only when one
way gives a folder that is on disk. It quotes a folder that has a space.
When no way, or more than one way, gives a folder, the error says "Fix
what Box reports".

The profile parser and the telemetry reader now use the shared
Date-aware isTable of runtimeProfile/projectPaths.ts, TomlError for the
place of a TOML syntax error, and type predicates in place of casts.
The section banner comments of hostMap.ts and dogwood.ts are removed.

Tests: boxProfileResolver.test.ts "the uv sync hint, when Box refuses a
missing .venv under a write grant" (5 tests: one line, a wrap at a space
in "my agent", a wrap before "/agent", a wrap inside a word, and a path
of no folder). A run of box 0.1.11-preview.10 on a project in
"/tmp/rf/venv test/proj with space" and on a long path gave the right
folder. profileParser.test.ts "places a TOML syntax error at its line
and column" pins the TomlError place. Mutations: no space at a wrap, no
check on disk, and no quotes each make a test fail.
…has its route rule's @id

Box adds the rules route_<name>_connect and route_<name>_request for
each [egress.<name>] route, and refuses a profile in which another rule
has one of those @ids. The AgentCore Runtime profile names some routes
after their gateway target: each other host of an entry
(`egress-models-two`), a host that only a rule names, and an entry whose
name a target of another host has (`egress-api`). A rule of the user's
policy with the @id `route_egress-api_request` is valid locally, but
box 0.1.11-preview.10 refused the Runtime profile: "box writes a rule
with the id ... so give your rule another id".

The gateway rule now gives each such route the first free name of
`<name>`, `<name>-2`, `<name>-3`, and so on: a name for which no rule of
the local policy, other than the route rules that Box adds itself, has
the @id route_<name>_connect or route_<name>_request, and that no other
route has. The Box network model gives the derivation these @ids
(RuntimeProfileContext.ruleIds). The route still sends its calls to the
same gateway target.

Tests: gateway.test.ts "names no route so that box adds a rule with the
@id of a rule of the policy" (an entry whose route takes the name of its
target, and another host of an entry past a name that another route
has), and "give a route a free name when a rule of the policy has the
@id of its route rule" through buildBoxNetwork. Box 0.1.11-preview.10
refused [egress.egress-api-b-example-com] beside the rule
route_egress-api-b-example-com_request (exit 1), and accepts
[egress.egress-api-b-example-com-2] beside it (exit 0). Mutations: no
check of the rule ids, no check of the other routes' names, and no rule
ids from the model each make a test fail.
…her variable

`env://GITHUB_TOKEN` and `env://AGENTCORE_CREDENTIAL_GITHUB` both resolve
to the API key credential `github`. The Box network model compared the
two variable names, found them different, and failed the build and the
deploy with API_KEY_CREDENTIAL_SHARED. The same comparison across two
runtimes (sharedKeyFailures) failed in the same way.

But the two names give one key: build copies the key of
`GITHUB_TOKEN` to `AGENTCORE_CREDENTIAL_GITHUB`, the credential's own
variable (`seed` in planBoxProfileCredentials), and deploy reads it from
there. Both checks now skip an entry that reads the credential's own
variable. Two entries that read two other variables for one credential
still fail, because the credential can hold only one of the two keys.

Not changed: on the first build, before the credential `github` is in
agentcore.json, an entry that reads AGENTCORE_CREDENTIAL_GITHUB names
the credential after its own entry. Its target is then not written
until the next build.

Tests: network.test.ts "takes one credential for its own variable and
for one other variable, which build copies to it" (in both orders; it
replaces the test that pinned the failure); boxNetworkSource.test.ts
"takes the credential of another runtime for the credential's own
variable". network.test.ts "fails a server that takes the API key
credential of an [egress] entry for another variable" still pins the
real conflict. Mutations: raw names in the model, raw names across
runtimes, and no conflict at all each make a test fail.
…el-provider route its credential

A host whose target sends an API key that no credential of
agentcore.json holds got no gateway target. Build said so only as a
step ("not adding gateway target ..."), not as a warning, and the agent
could not reach the host on AgentCore Runtime. For a model-provider
route that `agentcore create` writes with no key ([egress.openai] with
env://OPENAI_API_KEY, and the same for Anthropic and Gemini), the
credential planner skipped the route with no message. Thus "set the
key and build again" did not work for these routes: build never added
their credential, so their target never came.

This change ports the rule of box-integration-development: a
model-provider route is a route like any other. On AgentCore Runtime its
gateway target sends the key of its credential, so the planner declares
the credential `openai` and stores the key of OPENAI_API_KEY under
AGENTCORE_CREDENTIAL_OPENAI, when that key is set. The planner also
records, for each route that gets no credential, why and what to do
(BoxCredentialPlan.unprovisioned). Build gives a warning for each host
with no target (unsentTargetWarnings): the host, the entry, that the
agent cannot reach it on AgentCore Runtime, and the planner's cause and
fix. The step stays only when build removes a target that agentcore.json
had.

Tests: manager.boxNetwork.test.ts "writes no target for an env:// route
whose key build cannot find, and says what to set", "stages no Runtime
[mcp] server for an HTTP MCP server whose key build cannot find", and
"writes the target of a model-provider route once its key is set, as
the warning says" (the fix of the warning works for OpenAI);
boxNetworkWriters.test.ts "unsentTargetWarnings" (3 tests);
boxProfileCredentials.test.ts "adds a credential for a model-provider
route create writes, from the provider's variable" and "adds a
credential for a route that uses a model-provider name or variable in
another way" (these replace the two tests that pinned the skip).
Mutations: the provider skip put back, no warnings, and no cause for an
unset key each make a test fail.
…nd remove casts and copies

Four smaller items of the review of the Box gateway targets:

- Two box runtimes that stage box in one folder (two CodeZip runtimes
  with one code folder, or a container runtime whose build context is
  the code folder of another) made staging stop with a programmer error:
  "Box network writers 'runtime profile' and 'runtime profile' both
  write {...}/.box-dist/profile.toml". ProjectSpecSchema now refuses
  them, with the two runtimes and the folder, however the path is
  written (`./app/agent` and `app/agent/`).
- network.ts imported boxGatewayAgentCoreHost from
  src/handlers/project/shortcuts.ts. The function is now in
  boxNetwork/egress.ts, beside the other AWS endpoint names, and
  shortcuts.ts imports it from there.
- boxNetworkSource.ts read an IAM policy document through `as` casts.
  It now parses the document and each Allow statement with zod, and
  uses the shared isTable. The other casts there are gone.
- boxCodeZip.ts and boxContainer.ts each had a copy of the step that
  writes the Runtime profile into the staged folder and into
  .box/<name>/aws/. Both now use stagedRuntimeProfiles in
  boxStaging.ts, in the same order as before.

Not done here: the box model is still on the generic ProjectBackend
input (backends/types.ts `boxNetworks`), and boxNetworkSource.ts still
imports DEFAULT_EGRESS_BEDROCK_REGION from src/handlers/. Both need the
Box gateway constants out of shortcuts.ts, which is an item of
[aws#2789](aws#2789).

Tests: project.test.ts "Box runtimes and the folder build stages box
in" (3 tests); boxNetworkSource.test.ts "counts the actions of an Allow
statement in each form IAM takes, and of no other". The staging,
network, and manager suites pass with no change. Mutations: no folder
rule, no path normalization, and any Effect counted each make a test
fail.
…a user's egress- target

Build took each gateway target whose name starts with `egress-` as its
own, by the name alone (isManagedTarget, writeGatewayTargets, and the
gateway rule of the Runtime profile). So it changed or removed a target
that a user added with that name, and stopped on one with another shape
(MANAGED_TARGET_CHANGED).

Build now records, in agentcore/box-gateway-targets.json, the targets
that it writes for each Box gateway, by the gateway's name. It owns only
the targets in that record: it adds, rewrites, and removes them, and it
keeps each other target, whatever its name. MANAGED_TARGET_CHANGED now
applies only to a recorded target, and it says to remove the name from
the record to keep the target. The Box network model gives the writers
and the Runtime profile one set of the targets build owns
(BoxNetwork.managedTargets).

A project that an older CLI built has no record of its gateway. For
such a gateway, build takes as its own each `egress-` target that has
exactly the shape build writes (a CUSTOM passthrough target to an
https:// host, with one of the outbound auths build writes), once, and
then writes the record. It keeps an `egress-` target of another shape
as the user's. A target that build wrote and the user then changed is
thus the user's.

The record is a file beside agentcore.json and not a field in it: the
L3 schema of agentcore.json is strict, so a new field stops synth until
the L3 takes it. A malformed record stops build, names the file, and
says to remove it.

Tests: network.test.ts "the targets build owns" (4 tests);
boxNetworkWriters.test.ts "keeps a user's egress- target that the record
does not name, and records the targets it writes" and "records no file
for a project with no box runtime"; boxNetworkSource.test.ts "the
record of the targets build writes" (3 tests); manager.boxNetwork.test.ts
"owns only the targets it records, after it takes its old egress-
targets once", which also checks the route of the Runtime profile.
manager.test.ts expects the new step "writing
agentcore/box-gateway-targets.json". docs/box-local-testing.md says the
new rule. Mutations: the record not read, every egress- target taken
in an old project, and no owned set for the Runtime profile each make a
test fail.
@SaiAbhishek98
SaiAbhishek98 requested review from a team, leo237 and vvargu November 20, 2026 20:37
@codecov-commenter

codecov-commenter commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.48914% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.89%. Comparing base (7cc8f75) to head (0692c03).
⚠️ Report is 11 commits behind head on box-integration.

Files with missing lines Patch % Lines
src/core/project/boxGatewayTargets.ts 96.47% 3 Missing ⚠️
src/core/project/boxNetwork/pathSolver.ts 99.12% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           box-integration    #2877      +/-   ##
===================================================
+ Coverage            96.87%   96.89%   +0.02%     
===================================================
  Files                  774      776       +2     
  Lines                68750    69352     +602     
===================================================
+ Hits                 66599    67202     +603     
+ Misses                2151     2150       -1     

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

Thanks for this — careful work. Each fix is its own commit with a test that fails first, and the PR body says what you checked against Box 0.1.11-preview.10. I read all 11 commits against box-integration (the branch is up to date with base).

Blocking: none. The one CI failure on 8942a80 (CodeQL js/incomplete-url-substring-sanitization at manager.boxNetwork.test.ts:394) is fixed by c065a0a, which compares the host exactly. The bot's thread is now outdated but still unresolved, and the ruleset requires every thread to be resolved, so please resolve it once Analyze/CodeQL pass again on the new head.

What I checked, and found correct

  • pathSolver.ts: the BFS over the product of the like automata is correct for Cedar like. * matches any run of characters, including none, and matching is case-sensitive. One stand-in character for every character the patterns do not name is enough. The visited set makes the search finish. At the 4096 bound, the search stops undecided and lets the host through, not drops it. decide then keeps the host reachable, and puts the permit in uncheckedBy and enforcedByBox. buildBoxNetwork warns with the rule's place. Tests exist for the 13-pattern case and for that warning (network.test.ts:1069). A path that a forbid has unreadable conditions for is still taken as reachable. That matches how sample requests worked before. Each path the solver finds is run through consider() again, so the solver cannot add a request that the policy does not allow.
  • conditions.ts: the short-circuit in checkAttributes/actionValue (and || / && / if, and stopping at a later when that an action test makes false) matches Cedar's evaluation order. The tests cover each form, and one negative case.
  • INVALID_PORT, the limitsConnection IP case, the free -2 route names (routeKeys skips both a policy @id and the key of another route), the reserved-variable alias (in the model and in sharedKeyFailures), the warnings for a host with no target, and the move of stagedRuntimeProfiles: each looks correct and has a test. The boxCodeZip/boxContainer steps keep the same order.
  • Target record: a missing file uses the old egress- + build-shape rule once. A file that is not valid JSON, or does not match the schema, stops with a ProjectStateError that names the file and says to remove it, and a test covers this. Build rewrites the record from all box runtimes each time, so a gateway that has gone falls out of it.
  • All the must-survive fixes I checked are still in place (ENV_LOCAL_RELATIVE_PATH, writesBedrockRoute/tomlKey, runtimeRunsInBox/assertBoxRuntimesHaveBoxVersion, boxStartFolder, .venv/bin/python, upsert, publishInstall, BOX_OTHER_MACHINE_HINT, the 0.1.11-preview.10 pin, --no-same-owner, --containment, enableApplicationLogs/enableTraces). verify passes on Linux and Windows. The new tests use temp folders and no unsafe patterns.

Non-blocking

  • Back-merge to box-integration-development. None of these fixes are on dev yet (findPath, BOX_GATEWAY_TARGETS_FILE, INVALID_PORT, routeKeys, unsentTargetWarnings, boxFolderOf, the alias rule). Only d0f9523's planner rule was already there. Dev still takes ownership from the egress- prefix, so the record design has to land on dev too, or the next phased squash brings the old behavior back.
  • Item 9 design (you asked). The record file seems right to me, given that the L3 schema is strict. Two suggestions, inline: (a) on the one-time migration, a target named egress-* whose shape differs is now kept as the user's with no message. Before, it was a MANAGED_TARGET_CHANGED failure. A one-time step such as "keeping 'egress-x' as your target: its shape is not one build writes" would make that visible. (b) The docs should say to commit agentcore/box-gateway-targets.json. A clone without it falls back to the heuristic.
  • pathSolver has no direct unit tests. It is tested only through hostMap, which covers like in a permit and == in a forbid. Small table tests for findPath/pathTest would pin !=, negated like, present, == in a permit, and the freeChar fallback when § is a literal.
  • Schema refinement (project.ts): it is correct, and the error message is clear. Note that it now stops every command for a project that already has two box runtimes in one folder. That project could not stage anyway, so it is fine. On a case-insensitive file system, App and app still pass.
  • Follow-ups / "2 items stay". The PR lists the follow-ups (first-build AGENTCORE_CREDENTIAL_* naming; the box model on ProjectBackend plus the DEFAULT_EGRESS_BEDROCK_REGION import, which depend on #2789; the release repository text in the docs), but there is no issue for them. Please file one or link it, so they are not lost. None of them blocks this PR.
  • CI: I posted while verify (Linux/Windows/macOS) and Analyze were still running on c065a0a. The only change since 8942a80 is that one test line. On 8942a80, Linux, Windows, Analyze, and CodeBuild e2e passed, and macOS was still pending. Please merge only after they pass. Nit: c065a0a uses w.split(":", 1)[0]. That works for this host, but it would fail for a host:port authority. w.startsWith("api.openai.com:") would hold for both.

Comment thread src/core/project/boxNetwork/network.ts Resolved
Comment thread docs/box-local-testing.md 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 for the thorough pass, the per-item commits with a failing test each made this easy to check. Twelve of the items are fixed and each test fails when its fix is reverted. Requesting changes for the regression in conditions.ts and the egress- first-build case (inline), plus a few smaller ones.

Also still open and not claimed here, fine as follow-ups: Dockerfile text matching (backends/boxStaging.ts:38, backends/boxContainer.ts:26, :30, :38), the box model on the generic ProjectBackend interface (backends/types.ts:14), boxNetworkSource.ts:17 importing DEFAULT_EGRESS_BEDROCK_REGION from handlers, and build and deploy rewriting files on every run, which now includes agentcore/box-gateway-targets.json.

Comment thread src/core/project/boxNetwork/network.ts Resolved
Comment thread src/core/project/boxNetworkSource.ts Resolved
Comment thread src/core/project/boxNetworkWriters.ts Resolved
Comment thread src/core/project/boxNetworkWriters.ts Resolved
Comment thread src/core/project/boxNetwork/network.ts Resolved
…n, for the review comment on conditions.ts line 130

@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 the three commits since my approval at c065a0a (2d3ef4a, 40116bd, 0628b15). The new code looks right. I'm leaving a comment rather than approving again only because of the merge state.

Blocking (merge state, not code)

  • The branch is one commit behind box-integration (e2ac9d7, #2870), and that commit conflicts with this PR in docs/box-local-testing.md. While the PR conflicts, no checks run on 0628b15 (0 check runs, status pending), so none of verify, Analyze, or CodeQL has run on the new head. Please rebase or merge box-integration, fix the conflict in the doc, and merge once CI is green.

Addressed

  • pathSolver tests (2d3ef4a). pathTest has a table for like, !(like), ==, !(==), !=, !(!=), has, and !(has). findPath has tests for != and a negated like in a permit, a forbid, no path, the 4096-state bound, and the free character. The free-character test is useful: never("/§*") and never("//*") make the expected result /\uE000, so a solver that fell back to § would fail it. On the non-string !=: your reply (Box rejects path != 5 at load, and the condition reader makes no path test from a number) is enough for me.
  • Migration warning (40116bd). It fires only when the record does not name the gateway (recorded === undefined), the target is named egress-*, and unmanagedShape returns a reason. That is exactly the set that isManagedTarget leaves to the user. A target whose shape matches gets no warning and build adopts it. The writer records every Box gateway, with an empty list if it has no targets, so the next build has a record and the warning does not repeat. The message says what to do, and both the positive and the negative case are tested.
  • Docs (0628b15). The path matches BOX_GATEWAY_TARGETS_FILE, and the doc says what a clone without the file does. This text is the hunk that now conflicts with #2870, so please keep it when you resolve the conflict.
  • The CodeQL bot thread is now resolved.

Still open (non-blocking, from my earlier review)

  • Back-merge to box-integration-development. Dev still has no pathSolver.ts and no BOX_GATEWAY_TARGETS_FILE, and it still takes ownership from the egress- prefix.
  • The listed follow-ups ("2 items stay") still have no issue. Please file one or link it.
  • Nit: w.split(":", 1)[0] vs w.startsWith("api.openai.com:") in manager.boxNetwork.test.ts.

Other

  • tejaskash's 7 review threads are still unresolved. The ruleset requires every thread to be resolved, and the conditions.ts:130 thread (a temporal or guardrails when before a host when) is a correctness claim, so it should be answered before merge.

Sai Abhishek added 6 commits November 20, 2026 13:49
…ate and add runtime, for the review comment on network.ts line 304
…times read, for the review comment on boxNetworkSource.ts line 168
…is build adds, for the review comment on boxNetworkWriters.ts line 341
…nd the warnings from the written spec, for the review comment on boxNetworkWriters.ts line 214
…for the review comment on conditions.ts line 307

@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 at eddef5f (since our approval at 9180136).

What changed. The only new commit is eddef5f, a merge of box-integration that brings in #2878 and #2886. No PR code changed beyond resolving the conflicts. The PR has no conflicts with its base now (merge base is 2f9422d, the tip of box-integration).

How the merge was resolved (checked with git show --remerge-diff eddef5f). There were four conflicted files, and each was resolved correctly:

  • backends/boxCodeZip.ts: takes #2886's single await box() for the pinned release in place of the per-version builds map, and keeps this PR's stagedRuntimeProfiles / writeProfile(stage). Nothing from the removed per-version code is left behind.
  • backends/boxContainer.ts: takes boxReleaseEnv(BOX_RELEASE) in place of releaseFor(runtime.box?.version), and keeps writeProfile(stage) and the stagedRuntimeProfiles import. The unused runtimes[index] lookup is gone.
  • manager.boxNetwork.test.ts: keeps both import sets (BOX_RELEASE and FS_RECORD_FILES/EnvLocalFile).
  • docs/box-local-testing.md: keeps this PR's record-file paragraph and the model-provider sentence. The base side was only a reflow of the same bullets, so no base content was dropped. Nit: that section keeps the old wrapping, and one line of the Failures bullet now runs past the column width. Re-run the formatter if the docs check flags it.

Earlier notes. None were addressed in this push, and I don't expect them to be, since it is a merge only. All of them stay non-blocking and I'm not repeating them inline:

  • The stale // comment above the commitSpec JSDoc (now manager.tsx:1420-1421).
  • The boxRouteKeyHeldElsewhere JSDoc still has the model-provider sentence, which belongs on planBoxProfileCredentials.
  • The record is still written with a plain, non-atomic write (pre-existing).
  • The record still does not cover #2887's egress-gateway-<name> targets. #2887 is not merged and there is no egress-gateway code in this PR.

Review areas.

  1. Tests: no new logic, so no new tests are needed. The two record-restore tests are unchanged.
  2. Silent failures: none introduced.
  3. Comments: the new stagedRuntimeProfiles JSDoc is accurate.
  4. New types: none.
  5. General: the resolution is minimal and correct.

FYI (not blocking): #2887 (head fa87fb5) and #2889 (head 84e0efa) haven't changed and still conflict with this head (manager.tsx, boxNetworkWriters.ts, network.ts, manager.boxNetwork.test.ts, docs, and others). Whichever merges second will need a rebase.

CI: when posted, verify / macOS passed, e2e was skipped, and verify / Linux, verify / Windows and Analyze were still pending. Approval assumes CI passes.

Squash plan for context: https://pippin.amazon.dev/docs/XFRmP1pP9L90nl/box-integration-squash-and-pr-plan-v2

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

Comment, not a new approval. The write-failure follow-up from our approval at eb8673a8 is fixed. Before merge, the branch needs current box-integration (11 files conflict after #2887 and the v1.x merge #2902), and these should be handled:

  1. The #2887 gateway targets need to be in the record when you merge. box-integration now writes egress-gateway-<name> targets (src/core/project/boxNetwork/projectGateways.ts:33-47) and owns them by the egress- prefix, which this PR replaces with the record (managedTargetsOf, recordOf). If the merge does not add them to managedTargets, the next build treats them as the user's and never updates or removes them. Add them, and one test that builds twice with a called gateway removed in between.
  2. A user's egress-* target can be deleted (src/core/project/boxNetworkWriters.ts:281-284). When one runtime of a multi-runtime project loses its box field for a while, readBoxNetworks() leaves it out and the record is replaced without its gateway. When box comes back, the gateway is treated as legacy and adopts shape-compatible user egress-* targets, and a later build deletes those that are not in the profile (reproduced with an unowned egress-mine). Keep the records of gateways outside the current models, and remove entries only when their gateway is removed.
  3. A rotated key can be deployed stale (src/core/project/boxNetwork/network.ts:437-440). [egress.github] reading AGENTCORE_CREDENTIAL_GITHUB and [mcp.github] reading GITHUB_TOKEN are now accepted for one github credential, but envRoutesOf() still dedupes by route name and drops the MCP alias. The planner then skips that route, so a rotated GITHUB_TOKEN is never copied and deploy uses the old stored key with no warning. Keep distinct (route, variable) pairs within each network.
  4. Smaller: manager.tsx:1780 reads and patches agentcore.json after the record write and outside the try at :1788, so a failed read leaves the stale record the fix meant to prevent. Move the read and the patch above replaceRecord.

Sai Abhishek added 3 commits November 24, 2026 09:26

@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 at 4d165b2 (since my approval at eddef5f).

What changed. There are two new commits. cf76c2c merges box-integration (#2887 and the v1.x merge #2902). 4d165b2 puts the #2887 gateway targets in the record. I checked the merge with git show --remerge-diff cf76c2c. Thirteen files conflicted, and each one keeps both sides. BoxNetwork has both projectGateways and managedTargets. The kept count in hostTargets uses the record-aware isManaged, and TOO_MANY_TARGETS also counts the gateways of the project. The writeGatewayTargets JSDoc is #2887's version, which mentions gateways. Nothing from either side was dropped.

The egress-gateway-<name> targets and the record: resolved.

  • hostTargets adds the target of each gateway of the project to managed (network.ts:624-626), so recordOf lists it.
  • A later build removes it: when the gateway gets CUSTOM_JWT (new test), when the gateway gets boundRuntime, and when the gateway is gone from agentcore.json (existing tests). In those cases it is owned through the record.
  • A user target that has the gateway target's name now fails with TARGET_NAME_COLLISION instead of being taken over (new test in network.test.ts).
  • remove gateway now checks the record when the record names the Box gateway (manager.tsx:1387-1404).

Still open from the previous review (blocking). None of tejaskash's items 2-4 changed in this push, and I found no reply on them. box-integration-development has no record code, so no later phase fixes them.

  1. A user's egress-* target can still be deleted. recordOf (boxNetworkWriters.ts:282-291) writes entries only for the networks of this build, and replaceRecord (manager.tsx:1904) replaces the whole file. So the entry of a runtime that has lost box for a while is dropped. When box comes back, that gateway falls back to the egress- rule. Keep the entries of gateways outside the current models, and drop an entry only when its gateway is removed.
  2. A rotated key can still be deployed stale. envRoutesOf (network.ts:316-326) still dedupes by route name only, so [mcp.github] reading GITHUB_TOKEN loses its pair when [egress.github] reads AGENTCORE_CREDENTIAL_GITHUB. uniqueRoutes in the writers already dedupes by (route, variable). Do the same within each network.
  3. manager.tsx:1904-1911: replaceRecord runs before this.json.read(specPath), and that read is outside the try at :1917. A failed read leaves the new record with the old agentcore.json. Move the read and the patch above replaceRecord, or into the try.

New finding.

  • The record check in remove gateway has no test. I replaced the owns record condition with true, and all 2405 tests in src/core/project/ still pass. Add a test where the Box gateway's record entry does not list a user egress- target that has passthrough.gateway: "<removed>", and check that remove keeps it.
  • Follow-up (non-blocking): isBuildOwnedTarget and BOX_EGRESS_TARGET_PREFIX (project.ts:39-59) still decide ownership by the prefix alone. Their JSDoc ("Build manages every target whose name has it, and no other") is out of date now that the record decides. The schema refine at project.ts:234 also skips any egress- target on a Box gateway. So a user's egress- target that the record leaves out, and whose passthrough.gateway names a gateway that was removed, passes the schema. The comment at manager.tsx:1385-1386 says such a target "stays, and fails", but here it stays and does not fail. Either check the record there too, or reword the comment.

Review areas. 1) Tests: the new gateway-target logic has tests, but the remove-path record branch has none (above). 2) Silent failures: items 1 and 2 above. 3) Comments: the prefix JSDoc above. The new comments in hostTargets and manager.tsx are accurate. 4) New types: none. 5) General: the merge resolution is correct.

Checks. Locally at 4d165b2, bun run typecheck passes and bun test passes (6495 pass, 9 skip, 0 fail). CI: Analyze, CodeQL, and verify on Linux, Windows, and macOS pass; e2e is skipped.

Sai Abhishek added 3 commits November 24, 2026 09:41
… in a build, for Tejas's review item on boxNetworkWriters.ts
…l planner, for Tejas's review item on network.ts
@SaiAbhishek98

Copy link
Copy Markdown
Author

This comment answers the four items of your comment of 2026-11-24.

  1. The targets of the gateways that the Box gateway sends calls to. 4d165b24 puts each egress-gateway-<name> target in managedTargets and in the record. da17faf5 adds the test that you asked for: build, remove the called gateway with remove gateway, build again, and examine that the target and its record entry are gone. The test gives an error with the code before 4d165b2.
  2. A user's egress-* target that build could delete. 0e554e83 keeps the record entry of each Box gateway that has no model in a build, and removes an entry only when agentcore.json has no gateway with that name. Build and deploy now stop before this point when a runtime of a Box project has no box.version (assertBoxRuntimesHaveBoxVersion), so a full build cannot get to your steps. Thus the test is in boxNetworkWriters.test.ts: the record keeps the entry of a gateway with no model, and drops the entry of a gateway that is gone.
  3. A changed key that deploy could provision as the previous key. 017b5a44 keeps each different pair of route and variable in a network. A new test in manager.boxCredentials.test.ts has [egress.github] with AGENTCORE_CREDENTIAL_GITHUB and [mcp.github] with GITHUB_TOKEN. It changes GITHUB_TOKEN, and examines that build keeps the new key in .env.local.
  4. The read of agentcore.json after the record write. 4417bd31 reads and patches agentcore.json, and examines its schema, before build writes the record. A new test in manager.boxNetwork.test.ts makes that read stop with an error, and examines that the record and agentcore.json stay as they were.

@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 at 4417bd3 (since my review at 4d165b2).

Fixed (checked by mutation; each mutation was reverted):

  • Item 2 (a user's egress-* target): recordOf now keeps the entry of each gateway that has no model in this build, and drops an entry only when agentcore.json no longer has its gateway. If I drop the kept entries, or keep entries whose gateway is gone, the new boxNetworkWriters test fails. Build has no runtime filter, and assertBoxRuntimesHaveBoxVersion stops a Box runtime that has no box.version, so a partial build cannot drop an entry. Stale entries are not kept forever: an entry goes when its gateway goes, and its targets are still removed once the model comes back.
  • Item 3 (rotated key): envRoutesOf now dedupes by route and variable. If I revert to route-only, the new test fails (ghp_old instead of ghp_new). I also checked the planner directly: two routes for one new credential add the credential once, so there are no duplicates.
  • Item 4 (record written before the agentcore.json read): the read, patch, and schema check now run before replaceRecord. If I write the record before the read, the new read-failure test fails.

Still blocking: the record branch of remove gateway has no test. da17faf tests that a build-owned target goes away, but a later build removes that target anyway. If I replace the record check in owns (manager.tsx:1393) with true, all tests in manager.boxNetwork, manager.box, manager, and remove.screen still pass (357 pass). The code itself is right. I checked with a throwaway test: build, then add a user target egress-mine with passthrough: { gateway: "tools" } that the record does not list, then remove gateway tools. egress-mine stays. Please add that as a test. It's about 10 lines next to "lets remove gateway remove the gateway after a build…", and it fails under the true mutation.

Follow-ups (non-blocking, unchanged from my last review):

  • nit: the JSDoc of BOX_EGRESS_TARGET_PREFIX and isBuildOwnedTarget (projectSchemas/project.ts:39-48) still says the prefix alone decides ownership.
  • The comment at manager.tsx:1385-1386 says the user's target "stays, and fails". The probe above shows that remove gateway succeeds, and the schema refine at project.ts:234 skips every egress- target on a Box gateway. Reword the comment, or check the record there too.
  • New, low: when two variables of one credential hold different keys ([egress.github] reads env://GH_A and [mcp.github] reads env://GITHUB_TOKEN, neither reserved), the planner stores the first route's key without a warning (seed returns early on entries.some(...)). This did not get worse in this push, but a rotated key in the second variable is still ignored in that case. A warning would help.
  • The schema-failure path of item 4 has no test. If I write the record before the !parsed.success throw, everything still passes. The read-failure test covers the ordering.

Checks: locally at 4417bd3, bun run typecheck passes and bun test passes (6499 pass, 9 skip, 0 fail). CI: Analyze, CodeQL, and verify on Linux, Windows, and macOS pass. e2e is skipped.

…w-fixes-host-map

# Conflicts:
#	src/core/project/boxNetwork/network.ts
#	src/core/project/boxNetworkSource.test.ts
#	src/core/project/boxNetworkWriters.test.ts
#	src/core/project/boxNetworkWriters.ts
#	src/core/project/manager.boxNetwork.test.ts
#	src/handlers/project/shortcuts.ts
@SaiAbhishek98

Copy link
Copy Markdown
Author

Merge commit a4b249d3 merges box-integration with aws/agentcore-cli#2889, which removes the agentcore Memory target from the Box gateway. The record has only the managed targets that the gateway has after the write, thus the Memory host gets no target and no record entry. The Memory host function is agentCoreDataPlaneHost in src/core/project/boxNetwork/egress.ts, and three tests in manager.boxNetwork.test.ts do not find an agentcore target.

@SaiAbhishek98
SaiAbhishek98 requested a review from leo237 November 24, 2026 20:05

@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 at a4b249d. The only change since 4417bd3 is the merge of box-integration, which brings in #2889.

The merge resolution is sound. I checked it with git show --remerge-diff a4b249d, and both sides' behavior survived:

  • From this PR: the record, recordOf / managedTargets, the kept entries for gateways that have no model, the dedupe by route+variable, and the unsent-target warning. The manager.boxNetwork test keeps this PR's warning, not #2889's step message.
  • From #2889: the direct route to the AgentCore host, and no gateway target for a host sent direct. The removal step for that host is kept. agentCoreDataPlaneHost now lives in egress.ts and is re-exported from shortcuts.ts. The agentcore target and BOX_GATEWAY_AGENTCORE_TARGET_NAME are gone, and the expected target lists were updated to match.
  • Where the two sides meet: a direct host's managed target is removed from the spec before recordOf reads it, so the record never lists it. Nothing of the user's is affected.

bun run typecheck is clean. bun test gives 6503 pass, 0 fail, 9 skip. CI is green.

One blocker remains: the record branch of owns in remove gateway (manager.tsx:1391-1394) still has no test. I replaced the record check with true again, and all 5055 tests in src/core/project, src/cli, and src/handlers still pass. A test needs a user egress- target with passthrough.gateway that is not in the record, and must check that it survives remove gateway.

The low items from the last review remain as follow-ups: the stale JSDoc in project.ts, the "stays, and fails" comment, the second variable for one credential being ignored silently, and the missing test for the schema-failure path.

@SaiAbhishek98

Copy link
Copy Markdown
Author

These commits correct each item in your inspection of a4b249d.

The item that stops the merge

  • The record branch of owns in remove gateway has a test: 1f305257. After a build, the user adds egress-mine with passthrough.gateway: "tools". The record does not include it. remove gateway tools removes egress-gateway-tools and keeps egress-mine. When I replace the record check with true, the test stops with an error, because egress-mine goes too.

Items from the earlier inspections

  • The JSDoc of BOX_EGRESS_TARGET_PREFIX and isBuildOwnedTarget says that the record shows which targets build owns. It also says that the prefix rule applies only when the record has no entry for the gateway: a78f8ebf.
  • The comment in remove gateway says what occurs. A target of the user that names the removed gateway stays. The schema does not examine an egress- target on a Box gateway. Thus, the next deploy stops at synth with the project has no gateway: 4f23dab9.
  • Two variables of one credential with different keys: build shows a warning. The warning names the two variables, and it says that deploy provisions the key of the first variable. Build does not stop, because the routes are correct and only the second key is not used. Two tests examine a different key and the same key: 4857ff92.
  • The schema-failure path has a test. The raw read of agentcore.json gets a name that the schema refuses. Build throws ProjectStateError, and agentcore.json and the record do not change. When I write the record before the schema check, the test stops with an error: bd61b5c9.

Small items from 2026-11-23

  • The incorrect line comment above the JSDoc of commitSpec is removed: 9ab33623.
  • The model-provider sentence is on planBoxProfileCredentials, not on boxRouteKeyHeldElsewhere: 1a51a441.
  • FS_RECORD_FILES.write writes to a different file in the same directory, and then gives it the name of the record. If the rename gives an error, it removes that file. Two new tests in boxGatewayTargets.test.ts examine the two paths: 0692c031.

Checks: bun test gives 6509 pass, 9 skip, 0 fail. Typecheck, lint, the format check, and the build have no errors.

@SaiAbhishek98
SaiAbhishek98 requested a review from leo237 November 24, 2026 23:30

@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 at 0692c03 (since my comment at a4b249d). Approving.

Fixed (checked by mutation; each mutation was reverted):

  • The blocker (the record branch of owns in remove gateway): when I replace the record check with true, the new test in 1f30525 ("lets remove gateway keep an egress- target of the user…") fails, because egress-mine gets removed. With the real code it passes.
  • The schema-failure path: when I move the record write in applyBoxNetwork above the patch and schema check, the new test in bd61b5c fails, and so does the earlier read-failure test.
  • The JSDoc of BOX_EGRESS_TARGET_PREFIX and isBuildOwnedTarget is now correct.
  • The comment in remove gateway is now correct. The schema's passthrough check skips isBuildOwnedTarget targets, so the user's target is not refused. The deploy then stops in the CDK library at gateway-targets.ts:63 ("the project has no gateway …") on box-integration of agentcore-l3-cdk-constructs.
  • 0692c03 (the record write through a temporary file): the temporary file is in the record's own directory, so the rename is atomic. A failure removes the temporary file and throws again. renameSync onto an existing file replaces it on Windows too, and nothing else depends on the platform. The tests cover both paths, and Windows CI passes.

Non-blocking follow-up (4857ff9, two variables of one credential): the warning works on a first build, but on the next build the stored key flips to the other variable's key, with no warning. seed returns early on value === stored without setting entries/seededFrom. So once .env.local holds GH_A's key, the GITHUB_TOKEN route finds no earlier entry. It then takes the "updating" path and stores ghp_rotated. The build after that switches back to GH_A's key and gives the warning again. I reproduced this with planBoxProfileCredentials and two routes, GH_A: ghp_a and GITHUB_TOKEN: ghp_rotated:

  • with envLocal: {AGENTCORE_CREDENTIAL_GITHUB: "ghp_a"}, the result is an entry ghp_rotated, the message "updating …", and no warning;
  • with envLocal holding ghp_rotated, the result is an entry ghp_a and the warning.

So the warning's claim that "deploy provisions the key in GH_A for both" holds only on alternate builds. One fix: record the first route that resolves each credential's key, including on the value === stored return, and check against that. Then add a test that runs the planner a second time with .env.local already seeded. This alternation was already there before 4857ff9, so it does not stop the merge.

Nits on 0692c03:

  • If rmSync(partial) throws in the catch, its error replaces the original one.
  • A process killed between the write and the rename leaves box-gateway-targets.json.<pid>.tmp in agentcore/, where it could be committed.

Checks: bun run typecheck passes. bun test gives 6509 pass, 9 skip, 0 fail. CI is green: verify on Linux, Windows, and macOS, plus CodeQL. e2e is skipped.

@SaiAbhishek98
SaiAbhishek98 merged commit 4235b7b into aws:box-integration Nov 24, 2026
6 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.

5 participants