Registry Mirror
Skip to content

Conversation

@isadeks

@isadeks isadeks commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #747, #804, #805. Supersedes #799 and #800 — both carry no unique content (#800 shares an earlier tip of this branch, #799's docs are folded in here so the branch is not self-contradictory).

Status: the findings from the most recent review round are addressed, main is merged in, and every required check is green at b75e4fa2 — the "changes requested" verdict predates that. Suites: 4499 CDK, 948 CLI, 1782 agent; mise run build clean.

What lands

#747 — the geo flip. bedrockGeoRegion is global in cdk.json. A global. inference profile is granted and invoked on every substrate.

#804 — doctor probes the profile, not the catalog. The old check asked "is this model published in this Region", which passes on a stack whose geography has no profile. It now resolves the <geo>.<model> profile the agent will actually invoke, and separately checks that every granted model has one.

#805 — --model is validated. repo onboard --model accepted any string and wrote it to the RepoTable, failing later at turn 0 with an error naming no model. Five classes are now rejected up front: bare ids, wrong geography, ungranted models, a bare <geo>. prefix, and doubled prefixes.

Plus four defects found while verifying this branch (detail below): a granted model with no inference profile, a context value that widened an IAM grant to a wildcard, a required prop that nothing read, and a documented command that could not work.

The central fix

The main model was never injected. The stack set only ANTHROPIC_DEFAULT_HAIKU_MODEL, so the main model came from a Python literal that a geography change does not touch — a deploy could grant one geography while the agent asked for another, and every task without a per-repo override died at turn 0 with AccessDenied. Both models now derive from the resolved geography, and agentPlatformConfig.anthropicModel is required so a substrate wired without it fails to compile.

Defects found while verifying, and fixed here

Each passed every check the platform had, then failed at turn 0 — or in the last case, never ran at all.

  • claude-opus-4-20250514-v1:0 was granted with no inference profile in any geography. Every admission check reads the grant list, so the CLI's --model guard and workflow admission both accepted it; the IAM policy carried a grant for an ARN that cannot exist.
  • bedrockModels: ["*"] synthed into inference-profile/global.* — the account-wide grant the per-model scoping exists to prevent, reached through a context value rather than a reviewable policy edit.
  • anthropicModel was declared, passed by the stack, and never read. Only MicroVM depends on that transport; the other two substrates inject the model into their own env, so every synth assertion passed while MicroVM fell back to a global.-prefixed literal — correct only on a global deploy.
  • The docs prescribed a command that could not work. -c bedrockModels='[…]' supplies a string, not an array; the resolver now parses the string form, so the documented command works and both delivery shapes behave identically. --context-file is worse and is called out as unusable: accepted, exit 0, silently ignored.

Two tests were wrong rather than missing, which is how the third defect shipped: an orchestrator test titled "seven forwarded identifiers" ran against an eight-field interface, and its fixture omitted the prop — a required prop can be omitted in a test object literal with no compile error.

Live verification

Deployed to a dev stack and verified by artifact, not exit code.

  • AgentCore runtime and both ECS task definitions carry ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL, both geo-derived.
  • A real task's own session role invoked global.anthropic.claude-opus-5 (5x) and global Haiku (1x) — no us. traffic. Worth splitting the invocation log by caller if reproducing: unsplit it also shows operator calls.
  • A non-global deploy (-c bedrockGeoRegion=us) flipped every artifact and inverted the CLI guard — global. becomes the rejected value. Restored to global afterwards.
  • The granted-model check found the profile-less model on the live stack unprompted, naming it and exiting non-zero; after the fix, "All 4 granted model(s) resolve".
  • The doctor's denial branch was exercised under a role deliberately missing bedrock:GetInferenceProfile: warn, not fail, exit 0.

Three things a reviewer should know

lambda-microvm cannot be deployed yet, so its fix is synth-verified only. That substrate is still in progress, and its synthesized template does not currently fit under CloudFormation's 1 MB limit — the deploy stops at changeset creation. Nothing to act on here; noting it so the MicroVM change in b016d3ec is not read as live-tested. It is mutation-verified instead: reverting the orchestrator emit, or emitting the auxiliary model under the main name, each fail the suite.

e449c7e6 adds a template-size budget with general value independent of MicroVM. CloudFormation hard-fails at 1 MB, and that failure lands after synth succeeds and every asset is pushed, names no resource, and leaves stack status showing the previous deploy's success. The guard measures the pretty-printed template — the shape the CLI actually uploads, so indentation counts — and fails the build at 950 KB, while ECS, the largest substrate that deploys today, currently synthesizes at 864,947 bytes. Treat it as a trend guard rather than a prediction of the exact bytes CloudFormation receives: the test harness leaves asset hashes and account/region tokens symbolic.

Non-blocking findings are now tracked in #892. Every remaining nit from the review rounds — the Blueprint agent.modelId write that skips the validation repo onboard --model now applies, the two stale doctor comment blocks, the denied/absent shared remedy, the and-vs-either detail, the restated GEOS literal, the stale blueprint.test.ts rationale, the test_sdk_smoke.py exit-0-after-raise, inferenceProfileId's two unvalidated strings, and the (default us) doc row — is enumerated there with its file, why it matters, and what to do. #846 covers the geography-blind workflow admission. Nothing in this branch points at a stale issue number.

One test-only commit worth a sentence

b75e4fa2 touches no product code. The server suite's autouse reset fixture cleared the spawned-pipeline registry without joining it, so a pipeline thread could outlive the test that started it: the stubs were then undone and the thread went on to run a real pipeline — task-state writes, a heartbeat, a clone — inside whichever test ran next. It now joins instead, which is what stopped one pre-install seam-guard assertion from failing on CI while every local run passed.

Closes #747. Final step of the #740 stack; the plumbing landed in #746.

Sets `bedrockGeoRegion` to `global` in cdk/cdk.json (the file had no context block
before) and moves the four default strings that name a geography with it: the agent
ANTHROPIC_MODEL fallback, TaskConfig.anthropic_model, the CLI's platform-default
mirror, and the agent-side ANTHROPIC_DEFAULT_HAIKU_MODEL fallback. Adds the
`global.` forms of Opus 5 and Haiku 4.5 to the workflow model allow-list.

A `global.` profile routes to any supported commercial Region, which gives better
throughput and resilience under burst — worth having for tasks that run for hours.
The tradeoff is data residency: a deployer with a residency requirement sets
`bedrockGeoRegion=us` (or eu/apac) instead, which is exactly why #746 made this a
context key rather than a second hardcode.

Verified against the synthesized template rather than assumed: all 10
inference-profile ARNs become `global.`, none remain `us.`, and the 20
foundation-model ARNs are unchanged because that half of the grant was already
geo-agnostic. `ANTHROPIC_DEFAULT_HAIKU_MODEL` picks up the prefix on its own from
the context key, as #746 intended. Rollback rehearsed: `-c bedrockGeoRegion=us`
synths cleanly and reverts all 10 ARNs, so recovery is one context value.

Two things the issue's scope table did not anticipate, both caught by existing
guards rather than by reading:

The agent-side haiku fallback in config.py is a SEPARATE value from the env var the
stack injects. The issue said the haiku model needs no edit because #746 derives its
prefix — true of the deployed env var, but a run with no env set reaches the Python
literal, so leaving it would have made local and deployed runs use different
geographies. The docs-parity contract test caught the inconsistency.

The allow-list pairing invariant was written as bare-vs-`us.`, so it read
`global.anthropic.…` as a bare id and demanded a nonsensical `us.global.anthropic.…`
pairing. Generalized to the geo prefixes the list actually uses, keeping the real
invariant (no prefixed entry without its bare form, no bare entry admitted in zero
geographies) and confirmed still failing against an orphaned entry.

Both prefixes stay in the allow-list deliberately. It has to accept whatever
geography a deployment is configured for, and dropping the `us.` forms would reject
a residency-constrained deployer's workflows at admission.

Docs: the global-vs-geo tradeoff and the documented defaults move together, since
the #742 drift test enforces them. Also corrects statements that asserted a `us.`
prefix as a rule rather than as the then-current default. Starlight mirrors
regenerated.

Not yet done, and required before merge per the issue's acceptance criteria: deploy
and an agentcore smoke test proving a task completes end to end on the global
profile, plus a `platform doctor` access probe.
Regression this branch introduced. The check derives its bare foundation-model id
from the platform default by stripping the inference-profile prefix, but the strip
matched `us|eu|apac` only. Moving the default to a `global.` profile made it
silently do nothing, so `GetFoundationModel` was handed a profile id it cannot
resolve.

Confirmed against the live API rather than reasoned about:

  anthropic.claude-opus-5         → 200
  global.anthropic.claude-opus-5  → ResourceNotFoundException

So the one Bedrock check `doctor` performs would have reported a false failure on
every deploy of this branch — and the check exists precisely to catch model-access
problems before a task fails at turn 0.

Lists all seven geographies the CDK models, longest-first so `us-gov` is stripped
as `us-gov` rather than leaving a stray `-gov.`. Mirrored rather than imported,
matching how the CLI already mirrors PLATFORM_REPO_DEFAULTS — it is a separate
package and does not depend on CDK.

The guard asserts the queried id for EVERY geography, so a future default on any
of them cannot reopen the hole, and it was confirmed to fail against the
`us|eu|apac` version.

Worth noting for the follow-up work: the check still only probes the FOUNDATION
MODEL catalog, never the inference profile the deployment is configured for. A
stack granted profiles its account cannot invoke still reports healthy. Fixing
that is a behaviour change to what doctor checks, so it is left to its own issue
rather than folded in here.
…an unusable --model

Closes #804. Closes #805.

Both issues are the same failure shape: a model or geography that cannot work is
accepted silently, and the only symptom is every task dying at turn 0 with an
AccessDenied that names nothing.

#804 — doctor's Bedrock check called GetFoundationModel on the bare model id, which
answers "is this model published in this Region". That is not what decides whether
tasks run: the agent invokes a `<geo>.<model>` cross-Region PROFILE, and the IAM
grant is scoped to profile ARNs. A stack configured for a geography with no profile,
or whose entitlements the account lacks, passed the check and then failed
everything. Observed while verifying the geo switch: doctor reported
anthropic.claude-sonnet-4-6 visible in us-east-1 while the deployment was configured
for global.anthropic.claude-opus-5 — a different model, and a geography it never
looked at.

Adds a second check that resolves the actual profile via GetInferenceProfile. Both
are kept because their remedies differ: a missing catalog entry means the model is
unavailable here at all, a missing profile means the geography is wrong for this
model or Region. The new check says "resolves" rather than "is invocable", because
resolving a profile does not prove a task can call it — only InvokeModel would, and
doctor does not spend a token to find out.

The geography comes from a new BedrockGeoRegion stack output, mirroring the existing
ComputeSubstrate output that the CLI already reads to refuse a mismatched
--compute-type. On a stack that predates the output the check WARNS rather than
defaulting to `us`: passing would report a verification that never happened.

#805 — `repo onboard --model` wrote any string to the RepoTable unchecked. Now
rejected at the boundary: a bare foundation-model id (Bedrock refuses those for
on-demand invocation, so it is always wrong), and a geography the stack does not
grant. Each error carries the fix — the profile form to use, or the redeploy that
would grant the geography asked for.

Deliberately NOT checking membership in the granted model set. The CLI cannot read
`bedrockModels` today, and a guess presented as validation is worse than no check;
the profile check above covers the reachable part. Noted in the code.

Verified by mutation, not just by green tests: probing the bare id instead of the
profile, defaulting a missing geography to `us`, dropping either --model rule, and
dropping a geography from the prefix list each fail.

One comment corrected in the process. I had written that the geo list must be
longest-first so `us-gov` is not read as `us`. Reordering it did not fail any test,
and it should not have: the match requires `<geo>` followed by a literal `.`, so
`us.` cannot match `us-gov.…` at all. The comment now says ordering is for
readability and the test asserts the behaviour rather than the ordering.
@isadeks
isadeks requested review from a team as code owners August 27, 2026 14:14
@isadeks

This comment has been minimized.

@isadeks

This comment has been minimized.

Addresses all six review findings on the geo switch. The first was a real defect,
not a documentation error.

FINDING 1 — the one-line rollback was false. `synth -c bedrockGeoRegion=us` granted
`us.` profiles while the agent still asked for `global.anthropic.claude-opus-5`,
because the stack injected only the AUXILIARY model into the runtime env and never
the main one. The main model came from a Python literal that a geography change does
not touch, so every task with no per-repo override would fail at turn 0 with
AccessDenied. My own PR body half-knew this — the prose said "roll back context and
defaults together" while the summary claimed one line.

Fixed by removing the divergence rather than re-syncing literals: both models are
now injected from the resolved geography, via one shared helper, on BOTH substrates
(the ECS task definitions set neither var either, so an ECS task had the same
mismatch). Verified by synthesizing both geographies: grants, AgentCore env and ECS
env now agree in each, so the rollback genuinely is one context value.

Also fixes the fifth stale default the review found, TaskConfig.haiku_model, which I
had missed entirely while counting four.

FINDING 2 — the generalized allow-list invariant was too weak in both directions. It
only proved entries were paired WITHIN the list, which is satisfiable while wrong:
three granted models had no `global.` form (a workflow pinning one was rejected at
admission), and the reviewer's invented pair passed all 22 tests despite being
granted nothing. Replaced with parity against DEFAULT_BEDROCK_MODEL_IDS across the
deployable geographies, in both directions, and confirmed the reviewer's exact
mutation now fails.

FINDING 3 — the `--model` guard let through a well-formed but ungranted model. My
justification for that was wrong: I claimed the CLI cannot read `bedrockModels`, but
`get-template` recovers the granted set from the profile ARNs using credentials the
CLI already needs. Added a `BedrockModelIds` output — a documented contract rather
than a regex over CloudFormation — and the guard now rejects an ungranted model,
listing what the stack does grant. Also fixes the reverse-compatibility bug: with no
geography exported, the bare-id error no longer prescribes `us.`, which a
default-global stack does not grant.

FINDING 4 — doctor's profile check is relabelled "visible" and its detail states that
resolution happens under operator credentials and does not prove the workload role
can invoke. The narrow wording was already accurate, but a PASS feeding "All checks
passed" still read as readiness.

FINDINGS 5-6 — carries #799's documentation so this branch is not self-contradictory,
corrects the onboarding and troubleshooting skills that recommended `us.` overrides
this branch would now reject (and still called Sonnet 4.6 the default), and fixes the
stale "default us" wording in the new output description.

One test rewritten rather than re-pinned: the agent's haiku-default test asserted
`startswith("us.")` when its stated intent was "must be a profile, not a bare id". It
now asserts a geo prefix, so it tests the property instead of a geography that is a
deploy-time choice.
…ect false comments

Second review round. Two findings were already fixed by the previous commit
(TaskConfig's geography, and the comment claiming bedrockGeoRegion kept both models
aligned — it now does, because both are injected from it). The rest are addressed
here.

FINDING 1 — a Blueprint that drops `agent.modelId` left the old `model_id` live in
DynamoDB, because the update only ever SET fields and never REMOVEd them. The repo
kept overriding the platform default with nothing in the Blueprint source saying so,
and after a geography change that surviving override named a profile the stack no
longer granted: every task on that repo failed at turn 0 while the source looked
clean. Extended the REMOVE clause the asset refs already used — same mechanism, same
reason — and guarded both directions, since removing it unconditionally would break a
legitimate override.

FINDING 2 — the SDK smoke diagnostic was unreliable in four ways, each of which made
it say something untrue. It defaulted to a model and geography the platform no longer
uses (so it silently probed the wrong thing — now it requires ANTHROPIC_MODEL rather
than guessing); it printed a hardcoded SDK version four minors stale (removed, since
it already reads the real one); it printed FAIL and exited 0, so every caller that
checked the status read a failure as success; and its PASS attributed the cause to
"threading" when all it establishes is that the SDK/CLI/Bedrock path works.

FINDING 3 — the documentation drift guard had blind spots that let the review mutate a
documented default to `us-gov.anthropic.claude-stale-test` with every test still
green. Its geography pattern omitted us-gov, jp and au; it read only config.py, so
models.py could drift freely; and it never looked at the operator skills, which is
where an operator actually copies a value from. All three closed, and each is now
confirmed to fail against a deliberately introduced drift.

FINDING 4 — the skills recommended `us.` overrides this branch would now reject, and
still called Sonnet 4.6 the default. Corrected, with a note that the prefix must match
the deployment's geography rather than being a fixed string.

FINDING 5 — comments asserting things that are not true: that the two guarded
mistakes produce the same error (a bare id raises ValidationException from Bedrock, a
wrong geography raises AccessDenied from IAM — a real distinction when reading a
failure), and that `us` is "the default" when the shipped cdk.json sets `global`.

FINDING 6 — the geography list existed twice in the CLI, which is exactly how the
strip bug happened; doctor now imports the one list. Also: agent README said Node 20
while the Dockerfile installs 24, the interactive-agents doc cited an SDK pin four
minors stale, and the Blueprint header described its update path as PutItem when it
is an UpdateItem.

One existing test was rewritten rather than re-pinned. It asserted the update
expression contained no "REMOVE" at all, to mean "asset refs are not dropped" — a
blanket claim that coupled it to an unrelated field and failed for the wrong reason as
soon as `model_id` was legitimately removed. It now checks the REMOVE clause per
column. The first attempt at that split on the word and swept in
ExpressionAttributeNames, which matched every column; scoped to the expression.
@isadeks
isadeks marked this pull request as draft August 27, 2026 16:53
@isadeks isadeks changed the title fix(cli): check the inference profile doctor will invoke, and reject an unusable --model feat(cdk): switch to the global Bedrock geo, with doctor and --model validation Aug 27, 2026
@isadeks
isadeks marked this pull request as ready for review August 27, 2026 17:37
@isadeks

isadeks commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Status — all findings below are resolved as of e449c7e6. This was a self-review of a2550be5; the verdict line is kept for the record, not as the current state. Every blocking finding was reproduced before fixing and each fix is mutation-verified. What landed since, plus four further defects found while verifying, is summarized in the PR description. Earlier progress comments are collapsed as outdated.


Review — third round

Verdict: request changes. The central fix is right and the divergence it removes was real, but the failure class this PR exists to eliminate — "a model or geography that cannot work is accepted silently" — is still live in three places this change either created or left behind. Separately the headline fix has no test coverage on either substrate, and the shipped cdk.json value the thesis rests on is read by no test at all.

Two things worth saying first, because they're the strongest part of the change. The FINDING 1 fix in a2550be5 is the right shape — the divergence was removed rather than the literals re-synced. And the least-privilege risk checks out: diffing synthesized templates for us vs global gives 10 changed lines, all inference-profile/us.… → inference-profile/global.…; 41 Bedrock statements identical, 10 foundation-model/… ARNs byte-for-byte unchanged, no statement gained a wildcard (the single Resource: "*" is the pre-existing ModelInvocationLogging custom resource), and AgentSessionRole mirrors the runtime exactly. ADR-002 bootstrap coverage is correctly untouched — the only template additions are two CfnOutputs, no new CFN resource type; cdk/test/bootstrap passes 6 suites / 111 tests. Starlight mirror is in sync (sync-starlight.mjs exits 0, no tree change).


Blocking

B1 — doctor's new check fails a healthy stack, and the correct idiom is 94 lines above it

cli/src/platform-doctor.ts:468 — message.includes('AccessDenied') never matches a real denial. Verified against live Bedrock with a deliberately under-privileged 15-minute STS federation token:

err.name    = AccessDeniedException
err.message = User: arn:…:federated-user/… is not authorized to perform:
              bedrock:GetInferenceProfile on resource: …/global.anthropic.claude-opus-5
message.includes('AccessDenied')                                  → false   ⇒ fail
/AccessDenied|Unauthorized|not authorized/i.test(`${name} ${msg}`) → true    ⇒ warn

The identifier lives only in err.name. bedrock:GetInferenceProfile is a new API action this PR introduces and it appears in no policy under cdk/bootstrap/policies/. So an operator on a least-privilege role gets fail → doctorChecksPassed (:565) false → commands/platform.ts:129 → exit 1, printing "tasks would fail at turn 0 with AccessDenied" for a perfectly healthy stack — while docs/abca-plugin/skills/deploy/SKILL.md:88 tells operators to confirm everything is green before proceeding.

Fix: reuse the idiom already at platform-doctor.ts:372-374, and apply it at :401 too (the pre-existing checkBedrockModel has the identical weak predicate). No test covers the branch — forcing it to always 'fail' survives 770/770.

B2 — the new Blueprint REMOVE deletes an operator's --model pin on every deploy

cdk/src/constructs/blueprint.ts:503-517. clearedOverrideFields pushes model_id whenever the Blueprint declares no agent.modelId, and onUpdate's parameters embed ':now': { S: new Date().toISOString() } computed at synth (:385) — so the resource properties differ on every synth and CloudFormation issues an Update on every cdk deploy. Synthesized proof:

"UpdateExpression":"SET #status = :active, #updated = :now REMOVE #mcp_servers, #cedar_policy_modules, #skills, #model_id"

cli/src/repo-onboard.ts:94-95 deliberately does the opposite (carries the value forward), and its comment says swallowing an error there "would silently wipe the existing blueprint overrides" — the Blueprint now does to the CLI exactly what the CLI refuses to do to the Blueprint. ADR-017 sanctions both writers on the same row, and this PR's own troubleshoot/SKILL.md:115 prescribes the CLI as the quick fix for a wrong model. Worst case is this very upgrade: a deployer who pinned us. per repo loses the pin and gets the default flipped to global. in one deploy.

Second half: the comment states a general principle while only 1 of 13 SET-only columns is handled. runtime_arn, github_token_secret_arn, system_prompt_overrides, egress_allowlist, cedar_policies, approval_gate_cap, build_command, lint_command, max_turns, max_budget_usd, poll_interval_ms, compute_type all still survive being dropped.

Fix: gate the clear on an explicit signal (modelId: null meaning "clear") or extend to every SET-only column and document Blueprint as authoritative-and-destructive; either way Annotations.addWarning when a field is being removed.

B3 — the third compute substrate still has the exact divergence this PR removes

cdk/src/constructs/lambda-microvm-compute.ts:436 declares imageEnvironmentVariables, consumed at :924 — and no caller ever sets it (agent.ts:912 passes only vpc, agentSessionRole, ...microvmImageInputs). lambda-microvm-strategy.ts injects no env either; it passes only the task payload. So on a lambda-microvm deploy the platform default model still comes from the Python literal, untouched by bedrockGeoRegion. With -c bedrockGeoRegion=us — the documented residency path — grants are us. while the agent asks for global.anthropic.claude-opus-5: every task with no per-repo override fails at turn 0 with AccessDenied.

That is FINDING 1 unfixed on substrate three, while stacks/agent.ts:495 and ecs-agent-cluster.ts:383 both say "BOTH substrates" and "makes that divergence unrepresentable". ADR-021 makes lambda-microvm a real deployable substrate (assertComputeSubstrateDeployed accepts it, doctor probes it).

Fix: set both vars there from inferenceProfileId(...). If parity is genuinely deferred (the construct comment says P2), file it and correct every "both substrates" claim to name the exception.

B4 — the headline fix is unguarded; so is the shipped geography

Mutations run on a clean tree:

Mutation Result
Delete ANTHROPIC_MODEL: from stacks/agent.ts:500 SURVIVED — 234/234 pass
Delete both env vars from ecs-agent-cluster.ts:389-391 SURVIVED — 195/195 pass
Delete the "context" block from cdk/cdk.json SURVIVED — 275/275 pass
Set cdk.json geo to "eu" SURVIVED — 275/275 pass
Delete the BedrockModelIds CfnOutput SURVIVED — 111/111 pass
Typo both new output names in commands/repo.ts:182-183 SURVIVED — 770/770 pass, eslint clean

cdk/test asserts ANTHROPIC_DEFAULT_HAIKU_MODEL in three places (stacks/agent.test.ts:183, 421, 483, including the describe.each(['global','eu','apac']) sweep) and ANTHROPIC_MODEL in zero. ecs-agent-cluster.test.ts isn't touched at all, though it already has a bedrockGeoRegion harness param (:37) and a geo sweep (:472) asserting only IAM ARNs — adding the env assertion is two lines.

Nothing anywhere reads cdk/cdk.json, so the suite exercises the code default us while every deployment ships global; stacks/agent.test.ts:96 even pins Value: 'us'. The repo onboard wiring is the sharpest one: typo both output names and the geography and grant checks silently become no-ops with CI green — contrast platform-doctor.ts, where the same typo fails 3 tests because the doctor tests stub on the literal output name.

B5 — the new --model guard has input holes

cli/src/model-id.ts:78, 99-100, verified by executing the real function:

Input Result
'global.' (prefix, nothing after) passes silently
'global.us.anthropic.claude-opus-5' (double prefix) passes silently
'global.anthropic.claude-opus-5 ' (trailing space) passes silently
deployedGeo: '' passes silently
'Global.anthropic…', ' global.…' throws, misdiagnosed as "bare foundation-model id"

bare = modelId.slice(geo.length + 1) yields '', and the grant check is skipped when the granted set is absent or empty — which is the state of every stack deployed before this PR (backgroundagent-dev exports neither new output), so both new checks degrade to no-ops there and --model 'global.' is written straight into RepoTable.

Related, same path: an untrimmed bedrockModels entry (resolveBedrockModelIds validates trim().length but stores untrimmed) makes the exact-match grant check falsely reject a granted model, listing the model it just refused.

Fix: trim(), require a non-empty bare, case-normalize the prefix compare, and .map(s => s.trim()) on both the resolver and the split(',').

B6 — the canonical model-configuration reference contradicts this PR

These are false, not merely stale:

  1. docs/guides/DEVELOPER_GUIDE.md:126 (mirror Model-configuration.md:12) — "A Python literal only — there is no CDK prop or environment knob in front of it today." This PR added that knob (agent.ts:500, ecs-agent-cluster.ts:389). Same claim at docs/design/REPO_ONBOARDING.md:123, a line this PR edited without fixing the parenthetical.
  2. DEVELOPER_GUIDE.md:125 and :173 (mirrors :11, :59) — "default us" / "It defaults to us", while cdk.json ships global. A residency-constrained reader concludes no action is needed and gets global. This PR corrected exactly this wording in three code comments; the canonical doc kept it.
  3. DEVELOPER_GUIDE.md:175 (mirror :61) — "One value drives … both grant sites and the layer-3 ANTHROPIC_DEFAULT_HAIKU_MODEL env var" omits ANTHROPIC_MODEL, the whole point of the change.
  4. DEVELOPER_GUIDE.md:203 (mirror :89) — the cost row was relabelled us.anthropic.claude-opus-5 → global.anthropic.claude-opus-5 while keeping the same 37,584 tokens / $0.188020, in a table whose purpose is an apples-to-apples comparison against a us. row. That attributes a measurement to a profile it wasn't taken on. Revert the cell, or note both rows were measured on us..
  5. cli/src/model-id.ts:62-64 — "Deliberately does NOT check membership in the granted model set: the CLI has no way to read bedrockModels today", 34 lines above the code that does exactly that.
  6. docs/guides/DEPLOYMENT_GUIDE.md never mentions bedrockGeoRegion. For a default flip with compliance implications, add the cross-reference plus an explicit "set -c bedrockGeoRegion=<geo> before upgrading if you have a data-residency requirement". There's no CHANGELOG in the repo, so this is the only place it can land.

B7 — an eu/apac/jp/au/us-gov deployment has every model-pinning workflow rejected at admission

cdk/src/handlers/shared/workflows.ts:109-112 claims the allow-list "has to accept whatever geography a deployment is configured for" — it carries bare, us. and global. only, while resolveBedrockGeoRegion accepts all seven and -c bedrockGeoRegion=eu synths and deploys today. The new parity test can't see it: DEPLOYABLE_GEOS is hardcoded to ['us','global'] (workflows.test.ts:313) with a comment claiming the others are things "nobody can deploy against today", which isn't accurate.

Either generate the list from DEFAULT_BEDROCK_MODEL_IDS × BEDROCK_GEO_REGIONS — the two new tests now enforce it as an exact cross-product in both directions, so it is fully derivable — or state plainly in the comment which five geographies are uncovered. Note also that parity is enforced against the default grant only, so a -c bedrockModels addition is granted but not admitted.


Non-blocking

  • global.anthropic.claude-opus-4-20250514-v1:0 has no live inference profile — ResourceNotFoundException in both us-east-1 and us-west-2. The comment says "the grant covers them", but a grant on an ARN no profile backs isn't invocable. Its us. twin is equally dead, so this mirrors an existing hole rather than opening a class. Drop both, or add a contract test that resolves each allow-listed profile.
  • resolveBedrockModelIds accepts a wildcard. -c bedrockModels='["anthropic.claude-*"]' synthesizes inference-profile/global.anthropic.claude-* and foundation-model/anthropic.claude-*, silently converting the "no Resource: '*'" property into a wildcard grant. Pre-existing, but the new output now publishes it and the new exact-match guard falsely rejects on such a stack. Add a charset guard beside the existing geo-prefix rejection.
  • The Blueprint path — canonical per REPO_ONBOARDING.md:20 — has no model validation at all. blueprint.ts:97 registers validations for repo format, egress, gate cap, budget and three ref kinds, but nothing for agent.modelId. resolveBedrockGeoRegion/resolveBedrockModelIds are in the same package. The stated rationale ("fail where the operator can still fix it") argues for it more strongly at synth than in the CLI.
  • cli/src/commands/repo.ts:159 — --model <model-id> 'Foundation model ID override'. The new guard rejects exactly that. Reword to the inference-profile form with an example.
  • --model '' is a silent no-op that keeps the old override (model-id.ts:78 early-returns, repo-onboard.ts:94 falls through to existing). Reject it, or add a way to clear.
  • test_sdk_smoke.py still exits 0 on a real failure. ok = counts["assistant"] > 0 and counts["result"] > 0 counts messages, never ResultMessage.is_error/subtype — which runner.py:749 does read. A ThrottlingException mid-turn prints "PASS — Rules OUT the SDK/CLI/Bedrock path" and exits 0, alongside Errors: [...]. Same lie, one level down. Also system=1, assistant=1, result=0 (CLI killed after the assistant message) matches no branch: no verdict printed, bare exit 1. counts["other"] is never consulted.
  • BEDROCK_GEO_PREFIXES is a hand-copy whose only guard is tautological — model-id.test.ts:114 iterates the constant it is validating. When CDK adds a geography, geoPrefixOf returns undefined, a valid model is rejected as "a bare foundation-model id", and GEO_PREFIX_RE stops stripping: the original /^(us|eu|apac)\./ bug one layer up. Assert against Object.values(CrossRegionInferenceProfileRegion).
  • PLATFORM_REPO_DEFAULTS.model_id is a compile-time literal for a deploy-time choice. repo-display.ts:140 prints it as the effective model, so on a -c bedrockGeoRegion=us deploy repo show reports global.anthropic.claude-opus-5 while the stack injects us.. Now that BedrockGeoRegion is an output, derive the displayed prefix from it the way the substrate gate already does.
  • The default model is now hardcoded in five places across three languages (config.py, models.py, bedrock-models.ts, repo-display.ts, workflows.ts) plus the geography in cdk.json. contracts/constants.md says of itself: "single source of truth for numeric/textual constants that must agree across Python, TypeScript and tests. Hard-coding the same value in three places is how the APPROVAL_GATE_CAP triplication crept in; this file replaces that pattern." This PR added a third grep-based drift guard instead. Best follow-up; too big for this PR.
  • Comment accuracy, quick fixes: blueprint.ts:219 overstates the REMOVE as covering "the per-repo overrides"; agent.ts:930-945 orphans ComputeSubstrate's ADR-021 comment above BedrockModelIds and attaches the geography paragraph to the wrong output (platform-doctor never reads BedrockModelIds); model-id.ts:30 says "longest-first" for a list where apac follows us/eu; model-id.ts:32 describes a second geo list that no longer exists; workflows.ts:75 header still says "the us.-prefixed form"; workflows.ts:106 says the key "defaults to global" (the code default is us); bedrock-models.ts:92-96 says the default lives in code "rather than in cdk.json", which this PR falsifies; bedrock-models.ts:201 and :135 keep the old wording; runner.py:143 still says "(us. prefix)"; models.py:163 says a deployed task never reaches the default (true via build_config regardless of env, and false on lambda-microvm); test_sdk_smoke.py:5 and :132 still draw the threading conclusion the PASS branch just stopped drawing; docs/design/REPO_ONBOARDING.md:82 still describes the construct as writing via PutItem, the claim corrected in blueprint.ts.
  • Docs still advertising the old model set: onboard-repo/SKILL.md:80, 119, 147, 156 say the default is Sonnet 4.6 and that the stack wires only "Sonnet 4.6, Opus 4, Haiku 4.5" — and :121 cites Opus 4.8 as the ungranted example when it is granted; troubleshoot/SKILL.md:114 says the same three words above recommending Opus 5. Copy-pasteable us. Blueprint snippets remain at DEVELOPER_GUIDE.md:79, QUICK_START.mdx:548, Repository-preparation.md:51, agent/README.md:150, 190. The new skills guard scans only two SKILL.md files, and its CLAIMS_DEFAULT filter skips bash/JSON examples — extend it or fix the files.
  • blueprint.ts:509, 514 — props? optional with props ? … : [] restores the old buggy behaviour with no type error; one call site each, make it required. cli/README.md:191 doesn't list the new doctor check. DEVELOPER_GUIDE.md:127 cites config.py:569 for the haiku fallback, now at :573 (shifted by this PR's own added comment). getStackOutput issues one DescribeStacks per output — repo onboard now makes 6 and doctor 8; listStackOutputs already returns them all in one call.

Tests

Baselines on a clean tree: CDK 275/275 (6 suites), CLI 770/770 (57 suites), agent 1583. cdk/test/bootstrap 6 suites / 111 tests / 1 snapshot. No new CDK test re-enables bundling or re-synths per test.

Genuinely mutation-resistant: the Blueprint REMOVE (both directions), the allow-list parity (both directions), the skills-geography guard, the models.py↔config.py parity, and repo-display's pre-existing tie to config.py. Unguarded: everything in B4, the doctor warn branch, and the newly exported inferenceProfileId/PLATFORM_DEFAULT_* (an arg-order swap in inferenceProfileId fails 5 tests — all via the aux var only).

Process

#747 is assigned to @scottschreckengaust rather than the implementer, and none of #747/#804/#805 carries the "Starting implementation." comment ADR-003 requires. Please reassign or leave a coordinating comment on #747 before merge. Minor: the branch names 804/805 but not #747, the behaviour-change issue, and the PR has no area/type/priority labels.

…destructive clear

Third review round. Six blocking findings, all reproduced before fixing.

B1 — doctor's new check failed a HEALTHY stack. `message.includes('AccessDenied')`
never matches a real denial: the identifier lives only in `err.name`
(`AccessDeniedException`), while the message reads "User: … is not authorized to
perform: …". Confirmed against live Bedrock with a deny-scoped federation token — the
old predicate yields fail, the new one warn. Since `bedrock:GetInferenceProfile` is an
action this PR introduces and no bootstrap policy grants it, an operator on a
least-privilege role got a non-zero doctor exit telling them a working stack was
broken. Fixed with the name-and-message idiom already 94 lines above, and applied to
the pre-existing catalog check which had the identical hole.

B2 — REVERTED my own fix. Clearing `model_id` when a Blueprint declares no
`agent.modelId` looked symmetric with the asset refs, but onUpdate runs on EVERY deploy
(its parameters embed a synth-time timestamp) and `bgagent repo onboard --model` is a
sanctioned co-writer of that row which deliberately carries the value forward. So the
clear deleted an operator's CLI pin on every unrelated redeploy — and the
troubleshooting guide prescribes that pin as the fix for a wrong model. Worst case was
this very upgrade: lose the pin AND get the default flipped in one deploy. The
underlying gap is real but wider than one column (12 other SET-only fields survive
being dropped) and needs an explicit clear signal plus a warning, not a silent delete.
Guarded so it cannot return quietly.

B3 — the third substrate still had the exact divergence this PR removes.
`lambda-microvm-compute.ts` declares `imageEnvironmentVariables` and no caller set it,
so a microvm deploy read the Python literals regardless of geography: with
`-c bedrockGeoRegion=us` — the documented residency path — grants were `us.` while the
agent asked for `global.`. Both vars now injected there too, verified by synthesizing
that substrate at `us` and seeing env and grants agree. The "BOTH substrates" comments
were true of two of three.

B4 — the headline fix had NO test. Deleting `ANTHROPIC_MODEL` from the runtime env
survived the whole suite; so did deleting both vars from the ECS task defs, deleting
cdk.json's context block, setting it to another geography, and typoing both new output
names. Added assertions to the existing per-geography sweeps (both substrates, both ECS
task definitions), a guard that reads the shipped cdk.json rather than only the code
default, and a test that the `repo onboard` output names are exactly right — a typo
there silently degraded both new checks to no-ops. Every one of those mutations now
fails.

B5 — input holes in the `--model` guard, all reachable on any stack deployed before
this change, where the granted-set check is skipped: `'global.'` (prefix, no model),
a double prefix, and a trailing space all passed and were written to the RepoTable.
Also the guard validated a TRIMMED copy while the caller wrote the raw value, and an
untrimmed `bedrockModels` entry made the exact-match check falsely reject a model it
had just listed. Trimmed at both ends, empty bare id and double prefix rejected, and an
empty `deployedGeo` now treated as unknown rather than as matching anything.

B6 — canonical docs contradicted the change. "A Python literal only — there is no CDK
prop or environment knob" is what this PR falsified; "defaults to `us`" omitted that
cdk.json ships `global`, which is exactly backwards for a residency reader; the
one-value sentence omitted `ANTHROPIC_MODEL`, the whole point. Also reverted a cost-table
cell relabelled `us.` → `global.` without re-measuring — it attributed a measurement to
a profile it was not taken on. Added the deployment-guide cross-reference with an
explicit "set the geography before upgrading if you have a residency requirement",
since there is no CHANGELOG for it to land in.

B7 — five of seven geographies had every model-pinning workflow rejected at admission.
The allow-list carried bare/`us.`/`global.` only while `resolveBedrockGeoRegion` accepts
all seven, and my parity test could not see it because DEPLOYABLE_GEOS was hardcoded to
the two — with a comment claiming the others were undeployable, which was not accurate.
The allow-list is now generated from DEFAULT_BEDROCK_MODEL_IDS × BEDROCK_GEO_REGIONS, so
there is nothing to keep in sync, and the test derives the same list.

Plus the doc drift the review catalogued: skills advertising Sonnet 4.6 as default and
Opus 4.8 as ungranted, copy-pasteable `us.` snippets, and the REPO_ONBOARDING PutItem
claim.
@isadeks isadeks added enhancement New feature or request infra-cdk CDK stacks/constructs, bootstrap, deploy topology, tags, IAM wiring, teardown agent-runtime Python agent container: pipeline, runner, hooks, prompts, tools, Dockerfile documentation Improvements or additions to documentation labels Aug 27, 2026
@isadeks

This comment has been minimized.

…o lambda-microvm

`main` landed the Lambda MicroVMs P2 work (#733), which independently fixed the
auxiliary model's geography — a `haikuInferenceProfileId` helper plus delivery through
the orchestrator's `agentPlatformConfig`. That overlapped this branch's `bedrock-models`
helper and the runtime env block.

Resolved toward main's shape rather than mine where it was better sourced: its helper
interpolates the model id from the same constant the grant list uses, and its
`platform_config` path already carries a model to the MicroVM guest. This branch keeps
what main does not have — the MAIN model, on every substrate.

main's own comment on `haikuInferenceProfileId` records that `config.py`'s main-model
default "is correct on the default geography and a pre-existing gap on any other …
left alone here rather than fixed in a conflict resolution". That gap is what this
branch closes, so the two fit together rather than duplicating.

Concretely: dropped this branch's `imageEnvironmentVariables` block on the MicroVM
construct in favour of extending `agentPlatformConfig` with `anthropicModel`, so both
models reach the guest by the one mechanism main established for the auxiliary one. The
prop is required rather than optional, so a future substrate wired without it fails to
compile instead of silently reading the Python literal — which is how this class of bug
kept recurring.

Verified per substrate, not assumed: synthesizing lambda-microvm at
`-c bedrockGeoRegion=us` gives 15 `us.` grants, 0 `global.`, and both env vars `us.` —
grants and agent agree. The same check at `global` agrees on `global.`.

Suites after the merge: 4280 cdk, 789 cli, 1583 agent.
@isadeks

This comment has been minimized.

…ants

Two defects in the Bedrock grant list, both of which passed every check the
platform had.

`anthropic.claude-opus-4-20250514-v1:0` was granted but has no cross-Region
inference profile in any geography — `GetInferenceProfile` returns not-found for
both its `global.` and `us.` forms while every other granted model resolves. It
was therefore granted and un-invocable, and invisibly so: every admission check
reads the same grant list, so `repo onboard --model` accepted it and workflow
admission accepted it, then the task died at turn 0. The IAM policy also carried
a grant for a profile ARN that cannot exist. Removed, with Opus 4.8 taking its
place in the docs that recommended it.

`bedrockModels: ['*']` synthed clean and produced `inference-profile/<geo>.*`:
the account-wide grant the per-model resource scoping exists to avoid, reached
through a context value rather than a reviewable policy edit. Entries containing
`*` or `?` are now rejected, with the message naming the consequence rather than
just calling the value invalid.

`platform doctor` gains a check over the WHOLE granted set rather than only the
platform default — the defect above sat on a non-default model, so a check of the
default could never have found it. A genuine not-found fails and names the
offending model; a denial warns, since a least-privilege operator role says
nothing about whether the profile exists.

The exact-set grant pins in both substrate tests are the removal's review
surface: they fail if a grant is added, dropped, or re-prefixed, so re-adding a
profile-less model cannot pass silently. Verified by mutation — deleting the
wildcard guard, weakening it to `?`-only, gutting its message, re-adding the dead
model, and five separate breaks of the doctor check each fail the suite.

Operator docs corrected while here: they named the dead model as granted, said
Opus 4.8 would 403 when it is granted, gave Sonnet 4.6 as the default when it is
Opus 5, and prescribed hand-editing agent.ts when the grant list is context-driven.
@isadeks

This comment has been minimized.

…k as written

The `cdk deploy -c bedrockModels='[…]'` form in the previous commit fails at
synth. `-c` supplies each value as a string, and `bedrockModels` must be an array,
so the validator rejects it: "must be a non-empty array of foundation-model IDs;
got \"[\\\"anthropic.claude-opus-5\\\"]\"". Repeating `-c` does not build an array
either, and `--context-file` is accepted silently but has no effect on the value —
that one is the more dangerous of the two, since it exits 0 while the template
still carries the default grant list.

Setting it in the `context` block of `cdk.json` is the form that works, verified by
reading the granted profile ARNs back out of the synthed template: two entries in,
two grants out, against four for every other form.

Scalar context keys are unaffected — `-c bedrockGeoRegion=us` works, and the
deployment-geography examples elsewhere in these docs stay as they are.

While correcting it, state the third constraint the previous text omitted: patterns
are rejected, because these ids form the resource half of the IAM grant. Also point
at `platform doctor` for the profile-less-model case rather than leaving the
operator to check each id by hand.
@isadeks

This comment has been minimized.

…ys, and drop inert plumbing

Two blockers plus the fix-now list. Net 95 insertions / 207 deletions — most of this
removes or corrects prose rather than adding it.

**Blocker 1 — the guide recommended a model the default deploy cannot invoke.**
`DEVELOPER_GUIDE.md` gave `us.anthropic.claude-sonnet-4-6` as the per-repo Blueprint
example while `cdk.json` ships `bedrockGeoRegion: global`. Following it produced exactly
the turn-0 `AccessDenied` this PR exists to prevent. The bullet now states the rule —
prefix from the stack's `BedrockGeoRegion` output — and names no literal, because a
literal there is what went stale. `QUICK_START.mdx` likewise stopped telling operators to
hand-edit `grantInvoke` in `agent.ts`; that list is `bedrockModels` context now.

The docs-parity guard added earlier in this PR caught the first attempt at this fix: an
illustrative id on the same line as the word "default" reads as a default claim. Working
as intended.

**Blocker 2 — the template-size test claimed ECS protection and measured AgentCore.**
It ran in the default `describe`, whose `new App()` passes no `compute_type`. Moved to
the existing ECS `describe` and reused its already-synthesized template, so there is no
extra synth: 894,261 bytes measured versus 858,062 for the default — ECS is the substrate
deployments use and the one nearer the ceiling. Verified it still fires by tightening the
budget.

**Doctor: the last two binary classifiers.** `checkLambdaMicrovmAvailability` and
`checkBedrockModel` still routed every non-denial — throttling, 5xx, expired credentials —
into `fail` with a directive remedy. All four checks now share one `classifyProbeFailure`
helper (`denied` / `absent` / `unverified`), which removes the third and fourth copies of
that regex rather than adding them. `absent` is the only definite negative, so it is the
only one that fails. One existing test asserted the old behaviour for a rejection of the
literal string `service unavailable`; updated, since a transient error must not carry
"check the Region".

**Stale guidance.** The troubleshoot skill still listed Opus 4 as granted — this PR
removed it — and `BEDROCK_COST_ATTRIBUTION.md` still counted "six invokables". Both now
point at the derived list instead of restating it.

**False comment.** `model-id.test.ts` still claimed the geography list is written
longest-first; `apac` follows `us`. The source comment was corrected earlier, the test's
was not.

**Dangling anchors.** `USER_GUIDE.md` linked to `DEVELOPER_GUIDE.md#repository-onboarding`
and `PROMPT_GUIDE.md#repo-level-customization`; neither heading exists. Retargeted to
`#repository-preparation` and `#repo-level-instructions`. Both predate this PR — I could
not find a dangling link it introduced.

**Misplaced output comments.** Two comment blocks sat above `BedrockModelIds`; the first
described `BedrockGeoRegion`, which had none. Both deleted — the `description` fields
already say what each output is — and replaced with one line naming the consumers.

**Inert plumbing removed.** `clearedOverrideFields` returned `[]` unconditionally and was
spread through two call sites and a 16-line comment. Gone, along with the `props`
parameter both callers no longer need; the reasoning it carried is one sentence on the
class doc.

Deferred with tracked issues: #846 (geography-scoped workflow admission — needs the
resolved geography plumbed into a runtime handler) and #847 (one `DescribeStacks` instead
of nine, and `repo show` deriving its default geography).

Suites: 4364 CDK, 830 CLI, 1775 agent. Classifier mutation-verified in both directions.
@isadeks

isadeks commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Both blockers were valid. Addressed in e6464b0b, along with the fix-now list — net 95 insertions / 207 deletions, since most of it removes or corrects prose rather than adding it.

Blocker 1 — the guide recommended a model the default deploy cannot invoke

Confirmed: DEVELOPER_GUIDE.md:219 gave us.anthropic.claude-sonnet-4-6 as the per-repo Blueprint example while cdk.json ships bedrockGeoRegion: global. Following it produced the exact turn-0 AccessDenied this PR exists to prevent.

The bullet now states the rule — prefix from the stack's BedrockGeoRegion output — and names no literal, because a literal there is what went stale in the first place. Also removed the neighbouring instruction in QUICK_START.mdx to hand-edit grantInvoke in agent.ts; that list is bedrockModels context now.

Worth noting: the docs-parity guard added earlier in this PR caught my first attempt at this fix — an illustrative id on the same line as the word "default" reads as a default claim. Guard working as intended.

Blocker 2 — the size test measured the wrong substrate

Confirmed: it ran in the default describe, whose new App() passes no compute_type, so it synthesized AgentCore. Moved into the existing ECS describe and reused its already-synthesized template, so no extra synth as you noted:

substrate pretty bytes
default (AgentCore) 858,062
compute_type=ecs 894,261

ECS is both the substrate deployments use and the one nearer the ceiling. Verified the assertion still fires by tightening the budget.

Fix-now list

  • Doctor's remaining transient misclassification. checkLambdaMicrovmAvailability and checkBedrockModel still used the binary form. All four checks now share one classifyProbeFailure (denied / absent / unverified), which removes the third and fourth copies of that regex rather than adding them; absent is the only definite negative, so the only one that fails. Mutation-verified both directions. One existing test asserted the old behaviour for a rejection of the literal string service unavailable — updated, since a transient error must not carry a "check the Region" remedy.
  • Stale Opus 4 guidance. The troubleshoot skill still listed Opus 4 as granted — this PR removed it — and BEDROCK_COST_ATTRIBUTION.md still counted "six invokables". Both now point at the derived list rather than restating it.
  • False "longest-first" comment. Still present in model-id.test.ts (apac follows us). The source comment was corrected earlier; the test's was missed.
  • Misplaced output comments. Two blocks sat above BedrockModelIds, the first describing BedrockGeoRegion, which had none. Both deleted — the description fields already say what each output is — leaving one line naming the consumers.
  • Inert clearedOverrideFields. Removed, along with the props parameter both callers no longer needed. The reasoning it carried is one sentence on the class doc.

Dangling link — I could not find one this PR introduced. Every relative link and anchor it adds resolves (#model-configuration exists; the Starlight site-absolute routes are real pages). What I did find, in a file this PR touches, are two genuinely broken anchors that predate it: DEVELOPER_GUIDE.md#repository-onboarding and PROMPT_GUIDE.md#repo-level-customization. Retargeted to #repository-preparation and #repo-level-instructions. If you meant a different one, point me at it and I will fix that too.

Deferred with tracked issues

Both bodies were written from re-read code and every file:line citation verified against the branch after posting.

Suites: 4364 CDK, 830 CLI, 1775 agent.

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

Verdict: Request changes

Re-review at e6464b0b against my prior review at c2d6dc0d. Both blockers from c2d6dc0d are verified fixed, and four of the seven nits are fixed — the doc that prescribed a us. pin on a global deploy now names the BedrockGeoRegion output, the template-size guard now measures the ECS template it was always about, and the inert clearedOverrideFields plumbing is gone. The delta commit is a good commit except for one thing it does not mention: it deletes six pre-existing regression tests. That, plus two invariants this PR asserts everywhere but its own default path, is what holds it.

Method disclosure. I ran no suite: no mise run build, no jest/pytest/tsc, no cdk synth, no installs (the review worktree has no node_modules/.venv). Every claim below is static reading of the tree at e6464b0b plus read-only git/gh. All CI checks on this PR currently pass — which is consistent with Blocking 1, because deleting a test never turns CI red.


Prior blockers / open threads

Prior item Status Evidence at e6464b0b
Blocker 1 (c2d6dc0d) — DEVELOPER_GUIDE.md:219 prescribed a us. Blueprint pin the shipped global default cannot invoke Fixed docs/guides/DEVELOPER_GUIDE.md:219 now reads "Prefix it with the geography the stack grants, read from its BedrockGeoRegion output; a us. prefix on a global deployment is granted nothing and fails at turn 0." Mirror regenerated.
Blocker 2 (c2d6dc0d) — the template-budget guard measured the agentcore template while its rationale was about ecs Fixed Test relocated into the ECS describe (cdk/test/stacks/agent.test.ts:940), reusing that block's beforeAll template — no extra synth. One residual: the old comment's "ecs … synthesizes at 992,111 bytes" is gone and the new comment says only "~34 KB larger than the default"; since CI is green the ECS template must in fact be under the 950,000 budget, so the earlier figure appears to have been wrong. Worth stating the measured number so the 5% margin claim is checkable.
N1 troubleshoot SKILL.md still listed Opus 4 as granted Fixed docs/abca-plugin/skills/troubleshoot/SKILL.md:114 and DEPLOYMENT_GUIDE.md:139 now read "Sonnet 4.6, Opus 4.8, Opus 5, Haiku 4.5".
N2 falsified "longest-first" claim migrated into cli/test/model-id.test.ts Fixed The test comment now says "The list is NOT sorted by length (apac follows us), which is why this is asserted behaviourally."
N3 two new output comments ordered inversely; ComputeSubstrate paragraph dangling Partly fixed / regressed The BedrockModelIds/BedrockGeoRegion ordering is fixed, but the ComputeSubstrate rationale (cdk/src/stacks/agent.ts:980-986) is now worse: the delta appended "Both outputs are consumed by platform doctor…" to it and inserted BedrockModelIds (:989) and BedrockGeoRegion (:995) between it and ComputeSubstrate (:1002), which now has no comment at all. See inline.
N4 checkBedrockModel kept the binary classifier Fixed (behaviour) cli/src/platform-doctor.ts:442 now uses statusFor(classifyProbeFailure(err)). Two residuals: the comment explaining the matching was left behind in a function that no longer does any, and no test exercises the new error path — see inline.
N5 inert clearedOverrideFields / vacuous test Fixed Function and the props? threading are gone from cdk/src/constructs/blueprint.ts.
N6 / @ayushtr-aws thread on workflows.ts:89 — allowlist now admits all 7 geographies Not fixed, deferred to #846 — accepted as non-blocking, but the doc block above the constant still describes the deleted hand-maintained literal and is now false on four counts. See inline.
N7 dangling {@link haikuInferenceProfileId} Fixed Function still exists at bedrock-models.ts:137; link resolves.

No unresolved thread from another reviewer is left unaddressed except #846 (accepted).


Vision alignment

Fits the vision (VISION.md — bounded blast radius, reviewable outcomes, fire-and-forget default) and ADR-021's one-agent-many-substrates rule. One resolved geography now drives every grant and both injected model env vars on all three substrates; BedrockGeoRegion/BedrockModelIds become documented CfnOutput contracts instead of something a client regexes out of a template; --model is rejected before it reaches the RepoTable; the bedrockModels wildcard rejection tightens IAM rather than loosening it. Model config correctly stays in CDK context rather than CFN parameters, because grantInvoke resolves at synth (#740/#741). Bootstrap (ADR-002) untouched.

Where it does not finish the job is symmetry: the PR adds a guard at every boundary a repo or workflow can name a model, and none at the boundary where the platform names its own (Blocking 2).


Blocking issues

1. cdk/test/stacks/agent.test.ts:48 — the delta commit deletes six pre-existing regression tests; its message says it moved one.

git diff c2d6dc0d..HEAD -- cdk/test/stacks/agent.test.ts removes 138 lines from the default describe('AgentStack'). One is the intentional relocation. The other six are gone from the whole repo — verified with git grep at both origin/main and HEAD across all of cdk/:

Deleted test Replacement at HEAD
creates exactly 21 DynamoDB tables none (the only stack-wide table-drift guard)
creates TaskApprovalsTable with user_id-status-index GSI partial — construct-level only (cdk/test/constructs/task-approvals-table.test.ts), no stack-level assertion
outputs TaskApprovalsTableName none — no other reference to that output in cdk/test/
the orchestrator carries the platform_config transport env on EVERY compute type none
the forwarded identifiers are the SAME stack values the AgentCore runtime gets none
outputs ComputeSubstrate=agentcore on the default (no-gate) deploy none — only the ecs (:952) and lambda-microvm (:1046) variants survive, so the default, most-deployed path lost the assertion the CLI onboarding gate reads

The two orchestrator-env guards are the ADR-021 sub-decision-3 guards that a MicroVM agent and an AgentCore agent read the same approvals table, nudges table, artifacts buckets and session role. This PR's own new comment at cdk/src/constructs/task-orchestrator.ts:511-518 explains that the anthropicModel prop was declared-but-never-read and "every synth assertion still passed" — the parity guard is precisely the thing that class of bug needs, and this PR should have extended it with ANTHROPIC_MODEL, not removed it.

Risk: a dropped table, a renamed TaskApprovalsTableName output (CLI/Cedar HITL consumers), an orchestrator env rename that diverges from the AgentCore runtime, or a stack that stops reporting agentcore all now ship with a fully green suite.

Fix: restore the six from git show origin/main:cdk/test/stacks/agent.test.ts (none of them touches Bedrock model ids, so they should pass as-is), keep the template-budget relocation, and add ANTHROPIC_MODEL to both orchestrator-env key lists. If any deletion was deliberate, say so in the commit message and name the replacement coverage.

2. cdk/src/stacks/agent.ts:535 — nothing checks that the platform default model is in the deploy's own grant list, and the three new doctor checks all pass when it is not.

ANTHROPIC_MODEL / ANTHROPIC_DEFAULT_HAIKU_MODEL are injected on all three substrates from the hardcoded constants PLATFORM_DEFAULT_MODEL_ID / PLATFORM_DEFAULT_AUX_MODEL_ID (agent.ts:535-536, ecs-agent-cluster.ts:389-391, agent.ts:1102/1108 for the MicroVM platform_config). resolveBedrockModelIds (bedrock-models.ts:152-213) validates shape, geo prefixes and wildcards — but never membership of the platform defaults.

Failure chain: cdk deploy -c bedrockModels='["anthropic.claude-sonnet-4-6"]' — a documented, code-change-free override (onboard-repo/SKILL.md:136, DEVELOPER_GUIDE.md:125) — synthesizes cleanly with IAM scoped to Sonnet profiles only, while every substrate is told ANTHROPIC_MODEL=global.anthropic.claude-opus-5. Every task with no per-repo pin dies at turn 0 with an AccessDenied naming no cause. bgagent platform doctor gives false assurance on all three checks: bedrock_model and bedrock_inference_profile probe the CLI's own PLATFORM_REPO_DEFAULTS.model_id, not the stack's resolved default, and bedrock_granted_model_profiles only asks whether each granted profile exists — never whether the model the agent is told to invoke is granted. The existing test DEFAULT_BEDROCK_MODEL_IDS covers the agent runtime default checks the constant list, not a resolved override.

Note this is new with this PR: before it, the stack did not inject ANTHROPIC_MODEL at all (per bedrock-model-constants.ts:129-133), so narrowing the grant list and editing the Python literal worked. bedrock-model-constants.ts:104 already writes down half the relationship ("A model can be granted without being a default"); the inverse is the one that breaks a deploy.

Fix: assert it at synth — in resolveBedrockModelIds or once in AgentStack, throw when PLATFORM_DEFAULT_MODEL_ID or PLATFORM_DEFAULT_AUX_MODEL_ID is absent from the resolved list, naming the missing model and the bedrockModels key. Add a test with a narrowing context. Consider also having checkBedrockInferenceProfile probe the stack's exported default rather than the CLI literal.

3. Two operator-facing surfaces contradict this PR's own code. Same class as blocker 1 of my c2d6dc0d review, which was accepted as blocking.

  • docs/abca-plugin/skills/onboard-repo/SKILL.md:137-139 (added by the delta) states that bedrockModels "takes an array, and that rules out the command-line form — -c supplies each value as a string, so -c bedrockModels='["anthropic.claude-opus-5"]' is rejected at synth". This PR's own resolver JSON-parses exactly that form so both behave identically (cdk/src/constructs/bedrock-models.ts:203-212, with a test the PR adds: "parses a JSON-string override (the -c key=value CLI form)"), the resolver's JSDoc documents -c bedrockModels='[…]' as the way, and this PR's new CliError (cli/src/model-id.ts:129) hands the operator that exact remedy. So a guided-onboarding user blocked by the new CLI rejection is told the CLI's own remedy does not work, and is steered instead to a hand-edit of cdk.json that — per Blocking 2 — silently un-grants the platform default if they omit an entry.
  • docs/guides/DEVELOPER_GUIDE.md:221, in the section the file itself calls "the canonical reference", still says a platform-wide model change is "the bedrockModels context plus the layer-2 call sites above", and layer 2's Where cell names only agent/src/config.py:563 / models.py:157. After this PR the stack injects ANTHROPIC_MODEL on every substrate, so editing those literals has zero effect on any deployed task — the operator concludes the change shipped while every task still runs Opus 5 (or fails at turn 0 if they also narrowed the grant). The model-default-docs-parity guard cannot catch this: it compares the documented value to the Python literal.

Fix: delete the "that rules out the command-line form … has no effect on it" sentence and replace it with the working -c form (keep the "this REPLACES the default list" warning on the cdk.json example); name PLATFORM_DEFAULT_MODEL_ID (cdk/src/handlers/shared/bedrock-model-constants.ts) as the primary source in the layer-2 Where cell, the ANTHROPIC_MODEL Who sets it cell, and the platform-wide recipe at :221; regenerate the Starlight mirror.


Non-blocking suggestions / nits

  • cli/src/platform-doctor.ts:516 and :611 (MAJOR) — the delta's commit message says "All four checks now share one classifyProbeFailure helper … which removes the third and fourth copies of that regex". In the code only two of four call it; checkBedrockInferenceProfile (:515-524) and checkGrantedModelProfiles (:610-618) still hand-roll both regex literals, so there are now three copies. A future correction applied to the helper silently misses the two probes whose fail remedy is the destructive one ("remove it from the bedrockModels context"). Route both through classifyProbeFailure and switch on the returned bucket, keeping only the per-site detail strings local.
  • cli/src/platform-doctor.ts:442 (MAJOR — test coverage) — the delta's headline behaviour change for bedrock_model (transient → warn + "did not complete", not fail + "Enable model access in the Bedrock console") is unpinned: the only bedrock_model test asserts the pass path (cli/test/platform-doctor.test.ts:231) and GetFoundationModelCommand is only ever mocked to resolve. Reverting just that call site leaves the CLI suite green. Its two siblings each have explicit Throttling/ResourceNotFound cases, so the omission looks accidental — add the same it.each shape.
  • cdk/src/handlers/shared/workflows.ts:74-88 (MAJOR — comment drift) — the doc block still describes the hand-maintained literal the PR replaced, and is false on four counts: "accepting both the bare id and the us.-prefixed … form" (it is now bare + all seven geographies), "a SEPARATE, hand-maintained list from the IAM grant source" (it is now derived from it), "add it here too" (there is no list here to add to; the edit point is handlers/shared/bedrock-model-constants.ts), and "consolidating it with bedrock-models.ts is tracked separately" (done in this commit — and that module is now a re-export shim, so the pointer sends a maintainer to the wrong file). Please also state plainly that admission is deliberately geography-blind today with turn-0 AccessDenied as the fallback, and put the #846 reference inline where main's warning used to be.
  • cdk/test/handlers/shared/workflows.test.ts:340 — the allow-list admits nothing that is not granted builds grantedForms from the same flatMap over the same two constants, so it can only fail if the one-line derivation is edited, and it certifies as "granted" six geographies the deploy grants nothing for. Rename it to state the real invariant (admission is geography-agnostic; #846) so it stops reading as a grant-parity proof.
  • cli/src/model-id.ts:36 (MAJOR — drift) — BEDROCK_GEO_PREFIXES is a third hand-maintained copy of the geography list, and unlike the CDK copy it has no forcing function: cli/test/model-id.test.ts:152 "recognizes every geography the CDK models" loops over BEDROCK_GEO_PREFIXES itself, so it can never fail. When the alpha enum gains a geography the CDK literal is forced to update (cdk/test/constructs/bedrock-models.test.ts:60-67) and the CLI silently lags: on a -c bedrockGeoRegion=<new> deploy, geoPrefixOf returns undefined, assertModelIdUsable rejects a correctly-formed granted model as "a bare foundation-model id" and suggests <new>.<new>.anthropic.…, and GEO_PREFIX_RE stops stripping so bedrock_model fails on a healthy stack. That is the exact two-copies bug this file's own header describes. Either promote the list into contracts/constants.json (the repo already validates that both ways) or add a text-read parity test like cdk/test/contracts/model-default-docs-parity.test.ts does for agent/src/models.py.
  • cdk/src/stacks/agent.ts:987 — N3, partly regressed; see the table above and the inline comment.
  • cdk/src/constructs/bedrock-models.ts:66-68 — GEO_REGION_ENUM_VALUES is documented as "the allow-list resolveBedrockGeoRegion validates against", but that function validates against GEO_REGIONS (:121) — the dependency-free literal. GEO_REGION_ENUM_VALUES is referenced once, at :89, feeding GEO_ALTERNATION/GEO_PREFIX_RE. A maintainer widening the validated geography set edits the constant the comment names and changes only the prefix-rejection regex. The second half of the sentence is correct, which makes the wrong half convincing.
  • cli/src/model-id.ts:32-34 — "platform-doctor builds a REGEX from a similar list … same reasoning recorded there" — it is the same list (platform-doctor.ts:48 imports BEDROCK_GEO_PREFIXES from here, and its comment says "the ONE geography list … Two copies is how this broke"), and no ordering reasoning is recorded there. A maintainer chasing this may conclude a second list needs syncing.
  • cli/src/model-id.ts:64-70 — the doc narrates an unmerged intermediate revision of itself ("An earlier version did not, on the reasoning that … which was wrong"). Post-merge that resolves only in branch history; the load-bearing fact is already stated in the next sentence.
  • contracts/constants.json:35 — anthropic_model is additive to a fail-closed, unversioned wire allowlist: agent/src/server.py:1267-1275 refuses the whole platform_config block on any unrecognised key, and the guest's copy of constants.json is baked into the MicroVM snapshot, which a plain cdk deploy does not rebuild (lambda-microvm-compute.ts pins baseImageArn/baseImageVersion). An operator who deploys this PR without re-packaging gets every MicroVM session rejected at start, not merely a missing model default. The same is true of the pre-existing anthropic_default_haiku_model, so this is precedent rather than a new pattern, and the substrate is still in development — but please either document the snapshot-rebuild requirement in the deploy guide or send the default on agent_payload (server.py:540-542 already reads anthropic_model off /run input, which is backward compatible).
  • cdk/src/constructs/blueprint.ts:319 — props.agent.modelId is still written to the RepoTable verbatim with no synth-time validation, while the sibling writer (repo onboard --model) now rejects bare ids, double prefixes, ungranted models and geography mismatches — and agent.maxBudgetUsd in the same construct is validated at synth. resolveBedrockGeoRegion(this.node)/resolveBedrockModelIds(this.node) are both in scope. This was "strongly recommended" in my last review; still worth a follow-up issue if not this PR.
  • cli/src/platform-doctor.ts:580 — "Stack does not export BedrockModelIds and BedrockGeoRegion" fires when either is missing, so on a partially-updated stack the detail states a half-false fact. Interpolate the actually-missing name(s).
  • agent/scripts/diagnostics/test_sdk_smoke.py:123 — ok is computed from message counts and ignores the errors list, so a run that streams a result and then raises prints PASS and exits 0 with the exception below the verdict. ok = … and not errors, print errors above the verdict, and try/finally: await client.disconnect().
  • cdk/test/constructs/blueprint.test.ts:430 — the rationale added to onUpdate SETs the three asset columns… ("this blueprint declares no agent.modelId, so it legitimately removes model_id") is stale now that clearedOverrideFields is deleted, and it contradicts the test ten lines below. The original blanket expect(serialized).not.toContain('REMOVE') was strictly stronger.
  • cdk/src/constructs/blueprint.ts:499 — buildRemoveClause/buildRemoveNames are left with a purely cosmetic delta against main (a renamed local plus an intermediate variable). Reverting the bodies would leave only the class-doc change and make the real edit legible in blame.
  • cdk/src/handlers/shared/bedrock-model-constants.ts:135 — inferenceProfileId(geoRegion, bareModelId) takes two interchangeable unvalidated strings, so the one function that owns the bare/prefixed distinction cannot enforce it (inferenceProfileId('global', 'us.anthropic…') returns global.us.anthropic…). Callers are correct today; a BEDROCK_GEO_REGIONS.some(...) throw would make that structural.

Documentation

Updated and mirror-synced: DEVELOPER_GUIDE.md (model-configuration section, new geography subsection), DEPLOYMENT_GUIDE.md (residency tradeoff + cost table), QUICK_START.mdx, USER_GUIDE.md, BEDROCK_COST_ATTRIBUTION.md, REGISTRY.md, and the onboard-repo / troubleshoot plugin skills. Starlight mirrors are regenerated for every edited source (spot-checked developer-guide/Model-configuration.md, getting-started/Deployment-guide.md, architecture/Bedrock-cost-attribution.md for row parity), and the retargeted #repository-preparation / #repo-level-instructions anchors both exist.

Missing: the two contradictions in Blocking 3 (and their mirrors); the layer-1 row at DEVELOPER_GUIDE.md:125 still says "(default us)" where every other artefact this PR touched uses the precise "global in the shipped cdk.json, us absent any context"; the ANTHROPIC_MODEL Who sets it row (:135) still credits only the ECS strategy and your shell. #747's residency-tradeoff acceptance criterion is satisfied, so no ADR is owed.


Tests & CI

Test work here is otherwise unusually mutation-aware, and I want that on the record: the global value in cdk.json is pinned, the agent's Python fallback is pinned, ANTHROPIC_MODEL injection is pinned per-geography for AgentCore, both ECS task defs and the MicroVM platform_config (with a deliberately non-global fixture so a dropped value cannot pass on the agent's own fallback), the opus-4 grant removal is pinned by exact-set assertions on both substrates, and the new cdk/test/handlers/shared/runtime-bundle-boundary.test.ts esbuilds the real handler entry and asserts zero aws-cdk-lib references — the gate whose absence let my first blocker land. Almost everything I traced fails on revert.

The exceptions are Blocking 1 (six guards removed, nothing added in their place) and three unpinned behaviours: checkBedrockModel's new three-way classifier, the platform-default-∈-grant invariant (which does not exist yet), and the two new workflows.test.ts cases that rebuild the production derivation and so pass by construction. Two notes for #366: the relocated template-budget test correctly reuses the ECS beforeAll template (no extra synth), but runtime-bundle-boundary.test.ts runs two real esbuild.buildSync bundles under a 60 s timeout — justified, worth capping to one entry if it shows up in CI wall-clock.

Bootstrap synth coverage (ADR-002): pass, no updates needed. The PR adds only two CfnOutputs (well under the 200-output limit) and no new CloudFormation resource type, so no bootstrap-template or synth-coverage change is implied. The 1 MB template-budget guard is the relevant ceiling and now measures the ECS substrate.

CI: all checks currently pass. I did not execute any suite locally (no node_modules/.venv in the review worktree, and installing would pollute shared state), so nothing above is corroborated by execution — and note that a green suite is exactly what Blocking 1 predicts.


Review agents run

Six lenses folded in: code-review, silent-failure, tests, types, comments, security-governance-docs. None omitted or failed. I triaged every BLOCKER/MAJOR against the tree at e6464b0b and dropped or downgraded what I could not reproduce — notably the contracts/constants.json "not in required" claim (the sibling aux-model key has the same shape, so it is precedent, not a new gap) and the workflow-allowlist fan-out (real, but already accepted as deferred to #846). Governance is clean: #747/#804/#805 all carry approved, the branch name follows the convention, blocking dependency #746 is closed, and deferrals are tracked in #846/#847. Limitation restated: no suite, synth, or build was executed — static reading only; CI is green.


Human heuristics

  • Proportionality — concern. 55 files for a geography flip is defensible (three substrates plus 20 generated mirrors), but two hunks carry no reviewable change: blueprint.ts:499's cosmetic rename, and the six deleted tests in agent.test.ts that are unrelated to Bedrock and undisclosed in the commit message.
  • Coherence — concern. Three copies of the geography list (cli/src/model-id.ts:36, bedrock-model-constants.ts:121, the alpha enum) with a guard on only two of the three edges, and three copies of the probe classifier (platform-doctor.ts:79, :516, :611) after a commit that says it removed two of them.
  • Clarity — concern. The direction of travel is right (the new comments explain why, and bedrock-model-constants.ts's header is a model of it), but the load-bearing pointers are stale: workflows.ts:74-88 points at a shim, bedrock-models.ts:68 names the wrong validator, platform-doctor.ts:432 explains matching in a function that does none, and agent.ts:980 documents the wrong output.
  • Appropriateness — pass. The fix lands where the failure originates: geography resolved once at synth and pushed into every substrate, validation at the CLI boundary that writes the RepoTable, IAM still per-model ARN-scoped, no CFN parameters (correct — grantInvoke resolves at synth). The one place the fix does not reach its own origin is the platform default, which is Blocking 2.

Comment thread cdk/test/stacks/agent.test.ts Resolved
Comment thread cdk/src/stacks/agent.ts Resolved
Comment thread docs/guides/DEVELOPER_GUIDE.md Resolved
Comment thread cli/src/platform-doctor.ts Resolved
Comment thread cdk/src/stacks/agent.ts Resolved
Comment thread cli/src/model-id.ts Resolved
Comment thread docs/guides/DEVELOPER_GUIDE.md Resolved
Comment thread cdk/src/constructs/bedrock-models.ts Resolved
Comment thread cli/src/model-id.ts Resolved
…efault against its own grant list

**Blocking 1 — I deleted six pre-existing tests and the commit message said "moved".**
Verified: `git diff c2d6dc0..e6464b0 -- cdk/test/stacks/agent.test.ts` removed 138 lines
from the default `describe`, of which one was the intended relocation. Root cause is worth
recording because the assertion looked adequate: the edit sliced from the size-test comment
to the next test's anchor and asserted only that the slice CONTAINED the budget test. It
did, along with six others. CI stayed green because deleting a test never turns CI red.

Restored verbatim from `origin/main`:

  creates exactly 21 DynamoDB tables                 (only stack-wide table-drift guard)
  creates TaskApprovalsTable with user_id-status-index GSI
  outputs TaskApprovalsTableName                     (no other reference in cdk/test)
  the orchestrator carries the platform_config transport env on EVERY compute type
  the forwarded identifiers are the SAME stack values the AgentCore runtime gets
  outputs ComputeSubstrate=agentcore on the default (no-gate) deploy

The two orchestrator-env guards are the ADR-021 sub-decision-3 parity checks, and the
reviewer's point that this PR should have EXTENDED rather than removed them is exactly
right: `ANTHROPIC_MODEL` is now in both key lists. That guard is the shape of thing that
catches a declared-but-never-read prop — the bug this PR's own `task-orchestrator.ts`
comment describes, which passed every synth assertion.

**Blocking 2 — the platform could name a model its own deploy does not grant.** Verified
before fixing: `-c bedrockModels='["anthropic.claude-sonnet-4-6"]'` synthesized clean,
granting only Sonnet profiles while injecting `global.anthropic.claude-opus-5` and
`global.anthropic.claude-haiku-4-5` into all three substrates. Every task with no per-repo
pin then dies at turn 0. New with this PR, because before it the stack did not inject
`ANTHROPIC_MODEL` at all.

`AgentStack` now throws at synth when either platform default is outside the resolved
grant list, naming the missing models. Asserted in the stack, NOT in
`resolveBedrockModelIds`: putting it in the resolver broke three shape tests that use
minimal fixtures, which was the signal it belonged where the two facts actually meet —
the stack both builds the grant and injects the defaults. The resolver stays a shape
validator.

One pre-existing test legitimately encoded "override replaces the defaults, so the
defaults are absent"; that end state became invalid when injection started. Its fixture
now keeps the two required defaults and drops Sonnet, so its real subject —
replace-not-append — is carried by Sonnet's absence.

**Blocking 3 — two operator surfaces contradicted the code.**

- The `-c bedrockModels='[…]'` form I documented as "rejected at synth" now WORKS: #358
  added JSON-string parsing to the resolver after I measured it. Verified again here (2
  granted profiles from a 2-model override). Corrected, keeping the replace-not-append
  warning, and noting `--context-file` is the one that is silently ignored.
- `DEVELOPER_GUIDE`'s bump recipe told operators to edit the Python literals, which now
  have no effect on any deployed task. `PLATFORM_DEFAULT_MODEL_ID` is named as the step
  that changes what runs; the literals are described as the no-env fallback they became.
  Two file pointers also still named `constructs/bedrock-models.ts`, which the values
  moved out of.

Also, since it is the same class: the onboard-repo skill claimed the default was Sonnet
4.6 in one paragraph and Opus 5 in another.

**Doctor consolidation, which my last commit message overstated.** It claimed all four
checks shared `classifyProbeFailure`; only two did, leaving THREE copies of each regex —
and the two hand-rolled ones were the checks whose `fail` remedy is destructive ("remove
it from the bedrockModels context"). Now genuinely one copy. The `bedrock_model` warn path
was also unpinned, so reverting that call site left the suite green; it now has the same
Throttling/5xx/timeout/denial/absent cases as its siblings.

Comment corrections (removals, not additions): the `workflows.ts` doc block was false on
four counts after the list became derived, and now states plainly that admission is
geography-blind with #846 inline; `bedrock-models.ts` named `GEO_REGION_ENUM_VALUES` as
what `resolveBedrockGeoRegion` validates against when it validates against
`BEDROCK_GEO_REGIONS`; `model-id.ts` claimed `platform-doctor` keeps a "similar list" when
it imports this one, and narrated an unmerged revision of itself; the two Bedrock outputs
are moved after `ComputeSubstrate` so `main`'s comment regains its subject.

Two test-quality fixes: the workflows allow-list test is renamed to state what it actually
pins (the derivation, not grant parity) since both sides come from the same `flatMap`; and
`BEDROCK_GEO_PREFIXES` now has the forcing function it lacked — a text-read parity test
against the CDK literal, mutation-verified by adding a geography CDK-side and watching the
CLI suite fail.

Suites: 4374 CDK (+10), 836 CLI (+6), 1775 agent.
@isadeks

isadeks commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

All three blockers were valid; f6abd06f addresses them plus every MAJOR nit. Two items I am declining, with reasons, at the end.

Blocking 1 — correct, mine, and the most serious thing in the PR

Six pre-existing tests, deleted, while the commit message said "moved". Root cause worth recording because the guard I used looked adequate: the edit sliced from the size-test comment to the next test's anchor and asserted only that the slice contained the budget test. It did — along with six others. Your method disclosure is the point: no suite would have caught this, and CI stayed green because deleting a test never turns CI red.

All six restored verbatim from origin/main, relocation kept. Your suggestion to extend rather than restore is the better half of the finding: ANTHROPIC_MODEL is now in both orchestrator-env key lists. That parity guard is precisely the shape that catches a declared-but-never-read prop — the bug this PR's own task-orchestrator.ts comment describes, which passed every synth assertion.

Blocking 2 — verified before fixing, and worse than a doc problem

-c bedrockModels='["anthropic.claude-sonnet-4-6"]'   → synth rc=0
GRANTED:      global.anthropic.claude-sonnet-4-6
agent TOLD:   global.anthropic.claude-opus-5, global.anthropic.claude-haiku-4-5

AgentStack now throws at synth naming the missing defaults. Verified in all three directions: narrowing override fails, complete override passes, default path passes.

I put it in the stack, not resolveBedrockModelIds — you offered both. In the resolver it broke three existing shape tests that use minimal two-model fixtures, and that was the signal: the resolver validates a list's shape and has no business knowing the platform defaults. The stack is where the two facts meet, because it both builds the grant and injects the defaults.

One pre-existing test legitimately asserted "override replaces the defaults, so defaults are absent". That end state became invalid the moment injection started — same reasoning as your "note this is new with this PR". Its fixture now keeps the two required defaults and drops Sonnet, so its real subject (replace-not-append) is carried by Sonnet's absence rather than lost.

Blocking 3 — both correct, and one of them was my measurement going stale

The -c claim I wrote was true when I measured it and is not now: #358 added JSON-string parsing to the resolver afterwards. Re-verified (2 granted profiles from a 2-model -c override) and corrected, keeping the replace-not-append warning and noting that --context-file is the form that is silently ignored.

DEVELOPER_GUIDE's bump recipe is the more consequential half — it told operators to edit the Python literals, which after this PR have no effect on any deployed task. PLATFORM_DEFAULT_MODEL_ID is now named as the step that changes what runs. Two pointers also still named constructs/bedrock-models.ts, which the values moved out of. Same class, found while there: the onboard-repo skill claimed Sonnet 4.6 as the default in one paragraph and Opus 5 in another.

MAJOR nits — all fixed

  • Doctor consolidation. You are right that my commit message overstated it: only two of four used the helper, leaving three copies of each regex, and the two hand-rolled ones were exactly the checks whose fail remedy is destructive. Now one copy; mutation-verified (9 and 5 tests die on the two ways to break the helper).
  • bedrock_model coverage. Unpinned as described — reverting that call site left the suite green. Now has the same Throttling/5xx/timeout/denied/absent cases as its siblings.
  • workflows.ts doc block. False on all four counts you listed. Rewritten to say the list is derived, that admission is deliberately geography-blind with turn-0 AccessDenied as the fallback, and feat(orchestration): scope workflow model admission to the deployed geography #846 inline.
  • workflows.test.ts:340. Renamed to state what it actually pins — the derivation, not grant parity — since both sides come from the same flatMap.
  • BEDROCK_GEO_PREFIXES forcing function. Added a text-read parity test against the CDK literal, mutation-verified by adding a geography CDK-side and watching the CLI suite fail. I did not promote the list into contracts/constants.json: that is a shared-contract restructure with its own review surface, and the cheap half closes the actual gap (no forcing function). Happy to do the promotion as a follow-up if you would rather.
  • Comment corrections, all removals: bedrock-models.ts named the wrong constant as what resolveBedrockGeoRegion validates against; model-id.ts claimed platform-doctor keeps a "similar list" when it imports this one, and narrated an unmerged revision of itself; the two Bedrock outputs moved after ComputeSubstrate so main's comment regains its subject.
  • Template budget figures. Added: 894,261 (ecs) vs 858,062 (default), with the caveat that makes them honest — in-test bytes are lower than what cdk synth writes, because Template.fromStack leaves asset hashes and account tokens symbolic. So the budget is a trend guard on the relative number, not a prediction of what CloudFormation receives. My earlier 992,111 was the CLI figure and I should not have put it next to an in-test assertion.

Declining, with reasons

contracts/constants.json:35 — the MicroVM snapshot rebuild. Real, and you identified it precisely, but I am not changing it here. Sending the default on agent_payload instead is an agent-contract change (⚠️ ask-first in AGENTS.md), and anthropic_default_haiku_model already established the pattern, so this PR is not introducing it. It is also unreachable today: #830 records that compute_type=lambda-microvm synthesizes over CloudFormation's 1 MB limit and cannot deploy at all. Documenting a rebuild step for a substrate that cannot currently be deployed would be documentation of a hypothetical. Worth its own issue once #830 clears — say the word and I will file it.

checkBedrockInferenceProfile probing the stack's exported default rather than the CLI literal. Agreed, and it is already tracked as #847 along with the repo show geography and the nine DescribeStacks calls. Leaving it there rather than growing this PR further.

Suites: 4374 CDK (+10), 836 CLI (+6), 1775 agent. Full build clean.

Conflicts with #831 (Linear OAuth Token Vault), which touched the same three files.
All three were additive on both sides; resolved as unions.

- `cdk/src/constructs/ecs-agent-cluster.ts` — imports. This branch's model constants
  plus main's `LinearIdentityVault`.

- `cdk/src/stacks/agent.ts` — the lambda-microvm `platform_config` block. Both sides
  add fields, so both are kept, but NOT verbatim: main's side calls
  `haikuInferenceProfileId(bedrockGeoRegion)`, and that helper no longer exists here —
  it was removed when the two duplicate haiku-id paths were collapsed into one. Taking
  main's line as written would not compile. Resolved to
  `inferenceProfileId(bedrockGeoRegion, PLATFORM_DEFAULT_AUX_MODEL_ID)`, which is the
  same value through the surviving helper, and the vault fields are kept unchanged.

- `cli/src/platform-doctor.ts` — three hunks: the `linear-auth-health` import, and the
  `Promise.all` destructuring plus its call list. The last two must stay positionally
  aligned, so both were extended in the same order; verified all ten names now line up
  with their outputs.

Also fixed a `{@link haikuInferenceProfileId}` in `bedrock-models.ts` left dangling by
that same helper removal — the merge is what surfaced it, since main's live call site
was the only other reference.

`yarn.lock` moves with main (+42, `@aws-sdk/client-sns` for #831's revocation alerts).

Checked for semantic drift rather than trusting a clean textual merge: the restored
"creates exactly 21 DynamoDB tables" guard is byte-identical to main's at the same line,
so #831 added no table and the merge did not take a stale side of it.

Suites after merge: 4499 CDK, 948 CLI, 1782 agent — `mise run build` clean.
…ests

`/run` and `/invocations` answer while the spawned pipeline thread is only just
starting, so that thread typically resolves `server.run_task` after the test body
has already returned. `reset_server_state` cleared the thread registry without
joining, which orphaned it: the stubs were then undone and the thread went on to
run a REAL pipeline — task-state writes, a heartbeat, a `gh repo clone` — inside
whichever test happened to be running next.

That is what failed `TestMicrovmRunHookPreInstallAwsSilence[no-config]` on CI
while every local run passed. Its captured setup output shows a pipeline for the
previous parametrization's task still going, and the two recorded seam violations
are that pipeline's `write_running` and `write_heartbeat` reaching
`aws_session.tenant_resource` — from a thread the test never started, during the
window in which the guard requires silence. Locally the orphan finished before
the next test armed the guard; a slower runner widened the overlap.

Joining at teardown makes a pipeline thread unable to outlive the test that
spawned it. Measured with a probe over the file: 2 tests previously began with a
live `pipeline-*`/`heartbeat-*` thread inherited from their predecessor, now 0.
The live threads are read from `threading.enumerate()` rather than the registry,
because one test deliberately substitutes a registry that raises when iterated
and only promises to stay clearable.
@scottschreckengaust scottschreckengaust added the v1 Version 1 label Sep 14, 2026

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

Verdict: Approve (with non-blocking nits)

Re-review at head 5640d879. All three blockers from the last CHANGES_REQUESTED (@scottschreckengaust, e6464b0b) are verified fixed in commit f6abd06f, and no new blocker survives an independent re-review. CI is green (8 pass / 1 skipping, none failing or pending), the three backing issues (#747/#804/#805) all carry approved, and the branch name follows convention. The remaining items are comment-accuracy, test-coverage, and latent-drift nits — none blocks merge.

Method disclosure. I am a review subagent and cannot spawn the nested pr-review-toolkit agents in this context, so I applied each lens by hand (see Review agents run) and read the security-sensitive surfaces (IAM grant derivation, bedrockModels context input, wildcard rejection, CLI --model gate) directly. I did not execute the suites locally (shared-worktree / tmpfs constraints); CI is the corroboration.


Vision alignment

Fits the north star (VISION.md — bounded blast radius, reviewable outcomes, fire-and-forget default) and ADR-021's one-agent-many-substrates rule. One resolved geography now drives every IAM grant AND both injected model env vars (ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL) on all three substrates, closing the fire-and-forget failure mode where a non-default bedrockGeoRegion granted one geography while the agent invoked another's profile. BedrockGeoRegion/BedrockModelIds become documented CfnOutput contracts rather than something a client regexes out of a template; --model is rejected before it reaches the RepoTable; the bedrockModels wildcard rejection and the profile-less-model removal both tighten IAM rather than loosen it. Model config correctly stays in CDK context (not CFN parameters) because grantInvoke resolves at synth. The global geo flip is a data-residency change, and #747's residency-tradeoff acceptance criterion is documented — no ADR owed.


Prior blockers — all verified fixed at 5640d879

  1. Six deleted regression tests (agent.test.ts) — restored verbatim from origin/main in f6abd06f (the stack-wide 21 DynamoDB tables drift guard, the TaskApprovalsTable GSI + output, both ADR-021 orchestrator-parity guards, and ComputeSubstrate=agentcore on the default path). The two orchestrator-env key lists were also extended with ANTHROPIC_MODEL — the exact guard shape that catches a declared-but-never-read prop. Net diff vs main shows no unrelated test deletions.
  2. Platform default not checked against its own grant list — AgentStack now throws at synth when PLATFORM_DEFAULT_MODEL_ID / PLATFORM_DEFAULT_AUX_MODEL_ID fall outside the resolved bedrockModels, naming the missing model(s) and the fix. Covered by four new tests (AgentStack platform-default / grant-list coherence). This is the boundary the PR's other guards missed — verified the failure (-c bedrockModels='["anthropic.claude-sonnet-4-6"]' synthed clean while injecting Opus 5) is now a synth error.
  3. Two operator-facing docs contradicted the code — both fixed in f6abd06f: onboard-repo/SKILL.md no longer claims the -c command-line form is "ruled out" (now: "Both forms behave identically — the resolver JSON-parses the string -c delivers"), and DEVELOPER_GUIDE.md:190 now states plainly that editing the Python literals "has no effect on any deployed task" and names PLATFORM_DEFAULT_MODEL_ID as the value to change (layer-2 row and the platform-wide recipe at :222 match). Starlight mirrors regenerated.

Blocking issues

None.


Non-blocking suggestions / nits

  1. cli/src/model-id.ts:36 (latent drift, no current defect) — BEDROCK_GEO_PREFIXES is a third hand-maintained copy of the geography list with no forcing function: cli/test/model-id.test.ts's "recognizes every geography" loops over this same constant, so it can never fail. The CDK-side literal is forced to track the alpha enum (bedrock-models.test.ts), so a future enum-added geography would leave the CLI silently lagging — on a -c bedrockGeoRegion=<new> deploy, assertModelIdUsable would reject a correctly-formed granted model. Consider a text-read parity test against the CDK/contracts source, mirroring model-default-docs-parity.test.ts.
  2. cli/src/platform-doctor.ts (three copies of the probe classifier) — checkGrantedModelProfiles and checkBedrockInferenceProfile still hand-roll the AccessDenied/not-found regex rather than routing through classifyProbeFailure, so a future correction to the helper misses the two probes whose fail remedy is destructive ("remove it from the bedrockModels context").
  3. cli/src/platform-doctor.ts:442 (coverage gap) — the new three-way warn/fail classification for checkBedrockModel is unpinned; the only test asserts the pass path, so reverting the classifier call site leaves the CLI suite green. Its siblings have Throttling/ResourceNotFound cases — add the same it.each.
  4. cli/src/platform-doctor.ts:579 (accuracy) — "Stack does not export BedrockModelIds and BedrockGeoRegion" fires when either is missing; on a partially-updated stack the detail states a half-false fact. Interpolate the actually-missing name(s).
  5. cdk/test/constructs/blueprint.test.ts:429 (stale/contradictory comment) — the rationale "this blueprint declares no agent.modelId, so it legitimately removes model_id" is false against the current behavior (non-asset overrides are carried forward, not cleared) and contradicts the very next test (onUpdate does NOT remove model_id). Comment-only; the assertion itself is correct.
  6. agent/scripts/diagnostics/test_sdk_smoke.py:123 — ok is computed from message counts and ignores the errors list, so a run that streams a result then raises prints PASS and exits 0. Suggest ok = … and not errors, print errors above the verdict.
  7. cdk/src/handlers/shared/bedrock-model-constants.ts inferenceProfileId — takes two interchangeable unvalidated strings, so the one function that owns the bare/prefixed distinction cannot enforce it. Callers are correct today; a guard would make that structural.
  8. cdk/src/constructs/blueprint.ts agent.modelId — still written to the RepoTable with no synth-time validation, while the sibling CLI writer now rejects bare/double-prefixed/ungranted/mismatched-geo ids. Worth a follow-up issue (symmetry with assertModelIdUsable).
  9. Comment drift — workflows.ts doc block and bedrock-models.ts:66-68 (GEO_REGION_ENUM_VALUES documented as the validator's allow-list, but validation is against GEO_REGIONS) point at the wrong symbols after the constants extraction. Non-load-bearing.

Documentation

Updated and mirror-synced: DEVELOPER_GUIDE.md (model-configuration layers + geography subsection), agent/README.md, onboard-repo/troubleshoot plugin skills. The model-default-docs-parity test now also guards models.py TaskConfig literals and the operator-skill geography prefixes. No ADR owed (#747 residency tradeoff is an accepted acceptance criterion, not a new tenet trade).


Tests & CI

Unusually mutation-aware: the global cdk.json value is pinned, per-geography ANTHROPIC_MODEL injection is pinned on AgentCore + both ECS task defs + the MicroVM platform_config (with a deliberately non-global fixture so a dropped value cannot pass on the agent's own global. fallback), the opus-4 grant removal is pinned by exact-set assertions on both substrates, the platform-default-∈-grant invariant now has four tests, and runtime-bundle-boundary.test.ts esbuilds the real handler entry and asserts zero aws-cdk-lib references (the gate whose absence caused the original 57 MB bundle regression). Residual coverage gaps noted in nits 2-3.

Bootstrap synth coverage (ADR-002): pass, no updates needed. The PR adds only two CfnOutputs and introduces no new CloudFormation resource type, so no bootstrap-policy, action-map, version, or golden-baseline change is implied. The 1 MB template-budget guard is the relevant ceiling and now measures the ECS substrate.

CI: all checks pass (8 pass, 1 skipping). mergeStateStatus=BLOCKED reflects the required-approval gate, not a failing check (mergeable=MERGEABLE).


Review agents run

Execution context cannot spawn nested pr-review-toolkit agents, so each lens was applied by hand and that limitation is stated here per the process requirement:

  • code-reviewer — by hand: routing correct (CDK/CLI/agent trees per AGENTS.md), L2 constructs, per-model ARN scoping preserved, no hardcoded account ids.
  • silent-failure-hunter — by hand: the doctor probe classifier (denied/absent/unverified) and the smoke-test exit-code fix are net improvements; residual ok-ignores-errors noted (nit 6).
  • type-design-analyzer — by hand: new ProbeFailure union and assertModelIdUsable arg shape are sound; inferenceProfileId's two-string signature noted (nit 7).
  • comment-analyzer — by hand: stale/contradictory comments noted (nits 5, 9).
  • pr-test-analyzer — by hand: strong mutation-awareness; coverage gaps noted (nits 2-3).
  • security-review — by hand: bedrockModels wildcard rejection closes an account-wide-grant escalation via context; geo flip and CLI gate fail closed; IAM stays per-model ARN-scoped; no secrets/network/Cedar surface touched.

Human heuristics

  • Proportionality — pass. 55 files for a geography flip is defensible (three substrates + generated mirrors); the previously-flagged cosmetic hunks and undisclosed test deletions were reverted/restored in f6abd06f.
  • Coherence — concern (non-blocking). Three copies of the geography list (CDK literal, model-id.ts, alpha enum) with a forcing function on only two edges (nit 1); a few comment pointers name the wrong symbol post-refactor (nit 9).
  • Clarity — pass. New comments explain why; bedrock-model-constants.ts's bundle-boundary header is a model of it. Minor stale pointers noted.
  • Appropriateness — pass. The fix lands where the failure originates: geography resolved once at synth and pushed into every substrate; validation at the CLI boundary that writes the RepoTable; the platform-default guard now closes the one symmetry gap the last review flagged.

Comment thread cdk/test/constructs/blueprint.test.ts Resolved
Comment thread cli/src/platform-doctor.ts Resolved
Comment thread cli/src/model-id.ts Resolved
@isadeks
isadeks added this pull request to the merge queue Sep 14, 2026
Merged via the queue into main with commit 7f3f3c0 Sep 14, 2026
11 checks passed
@isadeks
isadeks deleted the fix/804-805-doctor-and-model-validation branch September 14, 2026 19:46
ClintEastman02 pushed a commit to ClintEastman02/sample-autonomous-cloud-coding-agents that referenced this pull request Nov 24, 2026
* fix(agent): detect two more mise missing-task errors as an inert gate

is_verify_command_inert tells a build or lint command that could not
run from one that ran and failed. Of the ways mise words a task that
does not exist, it knew "no tasks defined" and "task not found:". The
wording depends on what else the repository defines. Where there is no
task at all and the name resembles one of mise's own commands (`lint`
does, `build` does not), mise says "unknown command: lint"; where other
tasks exist, it says "no task <name> found". Both were read as a failed
run. A repository without a mise lint task got a red lint baseline and
lint_passed=false on every task. A repository with mise tasks but no
`build` task got no warning that build-regression gating is off, and
build_passed=false on its tasks, which the platform takes for a failed
build in its reply to an iteration and in the release of dependent
sub-issues.

The detector accepts both wordings on mise's own error line, as it does
for "not found" since #1052. Elsewhere in the log the words are no
signal: pip says "unknown command" inside a task that ran, and mise
warns "no task <name> found, but a non-executable file exists" before
it makes that file executable and runs it. The task name is matched as
one word, so the search stays linear in the length of a line of build
output.

For a repository that configures no command and has no such mise task,
setup records the gate as inert, and the existing inert paths apply; no
message text changes. The two INERT notes reach the agent under "Setup
results" in its prompt. Lint is not run again after the agent and is
stored as passed. The post-agent gate classifies the same output as a
command that could not run, as it does for the other missing-task
signals, and no build result is stored, which the platform does not
take for a failure.

A pull request that the platform opens carries the gating-off warning
and "NOT RUN" for the build. One that exists already gets neither from
the platform, which leaves its description as it is: that is the case
when the agent opened it itself, as its prompt tells it to. The issue
expects the warning there as well; this change does not add it.

The tests feed the detector the verbatim output of mise 2026.8.4 (the
issue's) and 2026.11.6 (the version the agent image pins), and run
setup_repo for both repository shapes.

Refs #749

* docs(tooling): harden /review_prs sketch against json-string args (#670)

The Stage-2 Workflow sketch of /review_prs iterates the PR descriptors
with args.map(). When args reaches the script as a JSON-encoded string
instead of the array, a string has no .map and the script throws before
any review agent spawns. The sketch is regenerated on every run, so
every run can hit this again.

The sketch parses args when it is a string and iterates the result; an
array is used unchanged. The Stage-2 bullet that tells the script to
read args says that the script must normalize it first, and why. No
other line changes: the sketch stays an illustrative sketch.

Closes #670

* fix(agent): latch a blocked host only from network tool output (#551)

The egress detector reads the result of every tool call. When a
failed-connection signature named a host, it wrote the agent_blocked
event and also latched BLOCKED[egress_denied] as the terminal reason,
whichever tool had returned the text. A Read or a Grep of a log that
quotes "Could not resolve host: foo.com" was enough: when the task
later failed without a reason of its own, for example at the build
gate, it was reported as an egress denial, with the remedy to
allowlist a host it had never called.

The detector sets the latch only from the two results in which a
failed connection of the task itself shows: the output of a Bash
command, and the error of a WebFetch call that failed. Bash and
WebFetch are the two built-in tools through which a task opens
outbound connections. A fetch that completed has reached its host,
and what it returns is the page: content, like a file. In the pinned
CLI a fetch that cannot connect is a failed call. MCP tools are left
out on purpose: their result is text handed on from a server. Repo
setup and the fail-closed policy path set the latch as before.

The issue offers to gate the detection or the latch. This gates the
latch only, so the live agent_blocked event is still written for
every tool.

What changes for an operator: a failed task whose only egress signal
came from another tool, or from a fetched page, ends with its own
reason instead of the non-retryable egress verdict. In return, a
blocked connection that only such a result shows no longer becomes
the terminal reason; the event still names the host. In the pinned
CLI that is the case for a command that runs in the background, or
is moved there at its timeout: its output goes to a file, and a
failure that the task sees only by reading that file with the Read
tool is not latched.

The comment at the latch states what it depends on: a process runs
one task at a time, which holds because every task gets its own
compute session. Before the execution model lets tasks share a
process, the latch has to be keyed by task id.

Item 3 of the issue (no live producer for the auth_failure remedy of
a resource that is not an ARN) asks for no action.

Closes #551

* fix(setup): show preflight and build errors on the failure screen

When `mise //cdk:deploy` fails before CloudFormation starts, `bgagent
setup` lists the last error-looking lines of the output under "Cause".
mise ends a failed task with `[<task>] ERROR task failed`, which reads
as an error, while the bootstrap preflight's `bootstrap preflight:
FAIL: ...` matched none of the words searched for. The Cause was
mise's line alone, and the real message was only in setup-deploy.log.

A line that contains `fail` in any letter case counts as an error
line. That covers the preflight's `FAIL:` and the `[N%] fail: ...`
reason the CDK prints when an asset build or publish fails, which
stayed hidden behind `Failed to publish asset`. mise's closing line is
never listed, also when no line looks like an error and the last
lines of the output are shown instead: it names the task, not the
cause.

The helper is shared, so the screens of a failed `cdk diff` and of a
failed account preparation change the same way. A screen that listed
fewer than three error lines beside mise's line shows one earlier
line in its place.

The standard-bootstrap failure the issue was opened for is fixed
since #973; this is the remainder its comment narrows it to.

Closes #1020

* fix(tooling): enforce the license header on cli shebang files (#172)

cli/eslint.config.mjs switched license-header/header off for
src/bin/**, so cli/src/bin/bgagent.ts, the one file of the package
that starts with a shebang, could lose or change its header and lint
would still pass.

The override worked around the parser, not the rule. The rule accepts
a shebang above the header, but it looks for the shebang among the
comments, and only the text ESLint hands the parser has it as one.
Started from the command line without --fix, @typescript-eslint/parser
infers a single run and takes each syntax tree from the file on disk
instead, where the header looks misplaced. With the override gone and
nothing else changed, `mise //cli:eslint:check` fails with
"Superfluous new lines before license header" while the --fix lint of
the build passes.

Remove the override and set disallowAutomaticSingleRunInference, so
the check-only lint parses the text the --fix lint parses. A shebang
file is reported when its header is missing, altered or not exactly
one blank line below the shebang, and --fix puts the header back and
keeps the shebang. bgagent.ts already has that layout and is not
changed.

The option turns off the parser's single-run shortcut for the cli
check-only lint; the --fix lint never used it. The run takes about as
long as before: the difference stays within a few tenths of a second.

Two tests in cli/test/eslint-config.test.ts: a table of shebang
snippets linted as src/bin/a.ts, and a run of the check-only command
line on src/bin. The second is what lets CI see a missing parser
option, because the build lints with --fix.

Closes #172

* fix(security): default the gitleaks range scan to head, not every ref

`security:secrets:range` gave gitleaks an empty --log-opts when
GITLEAKS_RANGE was unset or empty. gitleaks does not read that as "no
range": it walks every ref of the clone, so the task failed on what
other branches hold. Measured on a developer clone: 2900 commits and
16 findings, none of them in the history of HEAD, where the sweep
scans 362 commits and finds nothing. The fallback was written in #330,
when the sweep itself was a bare `gitleaks git .`; #728 moved the
sweep to HEAD and the fallback stayed behind.

Without a range the task scans the history of HEAD, the scope of
`security:secrets`. A range that is set reaches gitleaks unchanged, so
the per-PR and merge-queue check behaves as before, and
GITLEAKS_RANGE=--all still scans every ref for whoever asks. The
default is not origin/main..HEAD: on main that range is empty, and
where origin/main is missing gitleaks scans nothing and exits 0.

New tests in cdk/test/scripts/mise-tasks.test.ts run the three
gitleaks commands with a shell function in place of the binary. They
hold the default for an unset and for an empty variable, the
pass-through of a range, and the same rule file, redaction and output
flags in the sweep, the range scan and the staged scan.

The comment on the merge-queue range in
.github/workflows/security-pr.yml follows: without a range the task
scans the history of HEAD, and it is gitleaks itself that walks every
ref when it is given an empty range.

Refs #329

* fix(cdk): give each integ run its own assertion stack

integ-runner deploys two stacks per run: the stack under test and a
second one that holds the assertions. Only the first took its name from
INTEG_STACK_NAME (`int-<sha>-<run>` in CI). IntegTest named the second
after its construct path, TaskApiSmokeDefaultTestDeployAssert413BE3D6,
so every CI run, and a local run in the same account and region,
created, updated and deleted that one stack. Integ runs are keyed per
pull request since #1047, on the ground that stack names are
run-unique: two approved runs can be in the account at the same time,
and a copy left behind by a cancelled run is what the next run meets.

The app passes IntegTest an assertion stack of its own, named
`<stack name>-assert`: `int-<sha>-<run>-assert` in CI, which keeps the
`int-` prefix that marks a stack as ephemeral, and
`backgroundagent-integ-local-assert` on the local path. The template of
the stack under test does not change, and the assertion stack holds the
same resources and outputs.

A unit test synthesizes the app in a child process, as integ-runner
does, and checks that the cloud assembly holds exactly the two stacks
named after the run, with and without INTEG_STACK_NAME. It needs no AWS
access.

Only an approved integ run can prove the deploy and the destroy of the
renamed stack on AWS. A stack named
TaskApiSmokeDefaultTestDeployAssert413BE3D6 that an earlier run left in
an account is not picked up by later runs: delete it once by hand.

The issue stays open for the offline `cdk diff` for the approver and
for a teardown that does not fail the run.

Refs #400

* fix(agent): gate the arn-pinning constants and correct stale comments

The agent checks the ARN values of a MicroVM platform_config block
against two constants read from contracts/constants.json: the keys to
check (arn_keys) and the key that anchors them (account_anchor_key).
The constants drift gate owned neither, so a literal re-declaration of
either under agent/src passed check:constants-sync and would have
stopped following the contract.

Both names are in OWNED_PYTHON_NAMES, with their value-parity rows in
agent/tests/test_constants_parity.py (the gate refuses an owned name
that test does not compare). An assignment to either that is not a
plain read of its contract key fails the gate; the gate reports 17
Python names instead of 15.

Thirteen comments and docstrings contradicted the code. They state
the facts instead: the Region is not compared because the execution
role's Secrets Manager grants are Region-scoped, not account-scoped;
a boto3 session frozen into a snapshot carries the build role's
credentials, not its region; the build role has a Logs grant, scoped
to /aws/lambda-microvms/*; and ECS is left out of the heartbeat check
as a hard constraint, not a preference. Three of them said that the
agent writes its heartbeat every 45 s on every compute backend (the
doc comment of agent_heartbeat_at in the API types and its CLI mirror,
and a test comment): on ECS it is written once at start, as
API_CONTRACT.md says. No runtime behaviour changes.

Refs #817

* test(cdk): screen real pdfs with the installed pdf-parse

The defect of #683, the v1 call shape against pdf-parse v2, was fixed
by #695, which also made the mock a PDFParse class. One ask of the
issue stayed open: a test with a real PDF, so that a later API
mismatch fails loudly. The mocked suite cannot give that. It proves
that the code matches the mock, not that the mock matches the
package.

The new test runs the real screenTextFile with the installed
pdf-parse on PDFs built in memory. Only the guardrail call is a stub.
The text of every page of a two-page PDF has to reach the guardrail,
and a 51-page PDF has to be refused by the page limit. Against the
source as it was before #695, both tests fail with "TypeError:
pdfParseFn is not a function".

The screening runs in a child process, on an esbuild bundle in the
shape of a Lambda bundle (CommonJS, pdf-parse left in node_modules),
because under Jest pdfjs cannot import() its ES module worker. Two
comments of the mocked suite said that real extraction is validated
on the live deploy. They name the new test instead.

No production code changes. The cdk suite gains about one second.

Closes #683

* docs(onboarding): say arm64 emulation does not survive a reboot

On an x86_64 host the arm64 agent image builds only under QEMU
emulation. The Quick Start and the /setup and /deploy skills tell the
deployer to register it with `docker run --privileged --rm
tonistiigi/binfmt --install arm64`, and all three presented that as a
one-time step. The registration is kernel state (binfmt_misc), not a
setting saved on disk, so it is gone after a reboot, and stopping and
starting a cloud dev box is a reboot. A host that deployed before then
fails again with `exec /bin/sh: exec format error`, and no document
said why.

The Step 3 caution and the "Common errors" row of the Quick Start
state the lifetime and the remedy: run the command again, which is
harmless to repeat because the tool leaves an existing handler as it
is. They offer a native arm64 host to readers who would rather not
register after every reboot. The /setup skill no longer says
"One-Time" or "once per host", the /deploy skill no longer says
"once", and both tell the agent to run the command again after a
restart. That is the command the skills already run, not a new one.

The text names a reboot only. The issue also names a Docker daemon
restart and proposes distribution packages for a persistent
registration; its only comment disputes both and neither could be
verified here, so neither is documented. The structural fix the issue
prefers, building the image on a native ARM64 builder, stays open.

Refs #571

* chore(project): clear the deprecation warnings the build still prints

The two warnings the issue names (ts-jest TS151002 and
GrantOnPrincipalOptions#scope) no longer appear, but the build of main
prints the same class of notice at five other sites. Each of them
becomes a break when the deprecated API is removed.

- TaskOrchestrator created its `live` alias with Version#addAlias. It
  constructs the Alias itself, under the same scope (the current
  version) and id, so the alias keeps the logical ID that deployed
  stacks hold. Function#addAlias, the other replacement the notice
  names, would move it to a new logical ID, and CloudFormation would
  try to create a second alias named `live` before it deletes the
  first. A test pins the logical ID.
- EcsAgentCluster passes containerInsightsV2: ENABLED instead of
  containerInsights: true. The cluster setting is the same, and the
  AwsSolutions-ECS4 suppression reason names the prop in use.
- Two test fixtures: Stack#addStackDependency instead of
  addDependency, its former name, and a nodejs24.x function instead of
  a nodejs20.x one, which CloudFormation Validate reports as
  deprecated.
- The docs site hands its remark plugins to
  `markdown.processor: unified({...})`. Astro 7 builds that processor
  from the legacy `markdown.remarkPlugins` key and warns.

No behaviour changes. The synthesized templates are byte-identical
except for one cdk-nag metadata string on the ECS cluster (the
suppression reason), and the built docs site is byte-identical.

The process the issue proposes, capturing the warnings of the build or
failing it on new ones, is not part of this change.

Refs #192

* docs(security): record fail-open content-screening posture as an adr

The Jira and Linear webhook processors drop advisory enrichment that
is blocked or cannot be screened (recent comments, Linear project
documents, a sub-issue's own files in a Linear epic) and do not
reject the task for it, while content that specifies the task fails
closed. That rule was written out in three suppression comments and
in no document, although vision tenet 4 asks for an ADR where a path
degrades.

ADR-026 states the rule and its threat model once, with its
requirements in EARS form as ADR-020 asks. SECURITY.md links it and
the three suppressions cite it. No behaviour changes.

The issue speaks of about four call sites. The triage it quotes
counts a fourth site that was already suppressed, and the only one
of that kind is the fallback for a failed comment fetch in
jira-attachments.ts. A failed fetch is no screening decision, so it
is outside the record and that suppression keeps its own reason.

A new ADR instead of a section in ADR-009: ADR-009 covers
development-time agents and is still proposed. ADR-025 is claimed by
two open pull requests, hence 026. Its status is accepted: the
behaviour it records has shipped. The record lists a sub-issue's own
files as a third advisory kind that the issue does not name, because
the code drops them the same way, and names that path as an exception
to the principle that attachments are never silently dropped.

Closes #793

* feat(api): include webhook_url in the create-webhook response (#57)

POST /v1/webhooks returned the webhook id and the one-time secret but
not the URL the external system has to post to. A caller had to know
the route (/webhooks/tasks), find the API URL in the CLI config and
join the two by hand, once per environment.

The 201 response carries webhook_url. The handler builds it from the
host and stage the request came in on: API Gateway serves every route
of the API there, so no template, IAM or table change is needed. The
URL belongs to the API deployment, not to the webhook, so every
webhook gets the same one and the list and revoke responses do not
repeat it. The Host header is read in any letter case. A request
without one gets a 500 before the secret or the table item is
created, rather than a malformed URL; API Gateway always sends the
header.

bgagent webhook create prints the URL and a one-line hint between
"Created:" and the secret, which stays the last line. --output json
passes the field through, and --help says the URL is the same for
every webhook and need not be fetched again. Against an API deployed
before this change the text output is unchanged and the JSON has no
webhook_url until that stack is deployed again.

With a custom domain the URL is right when the API is mapped under
the stage name (/v1), the form the API contract documents.

Closes #57

* fix(observability): notify the alerts topic from every alarm (#686)

The stack deploys its CloudWatch alarms and one SNS topic for them
(OperationalAlerts). The alarms published to the topic, except the two
Lambda error alarms: the orchestrator's OrchestratorErrorAlarm
and the screenshot processor's WebhookProcessorErrorAlarm changed
state without telling anyone, so a failing orchestrator was visible
only to someone already watching the CloudWatch console.

Pass both to operationalAlerts.addAlarmActions, next to the alarms
that were already there. Every alarm of the root stack is in that one
call, and a stack test fails on any alarm of the stack's default
template that does not list the topic. An alarm in a nested stack, or
one that only a non-default feature deploys, is outside that test.

For operators: a subscriber of the topic receives two more kinds of
notification, on the transition into ALARM only. The orchestrator
alarm needs 3 or more errors in each of two consecutive 5-minute
periods; the screenshot processor alarm needs one error in a 5-minute
period, and a fault that also exhausts the async retries notifies
twice (Errors, then DLQ depth). With no subscriber, the default,
nothing is delivered.

The deploy updates the two alarms in place and changes the description
of the OperationalAlertsTopicArn output. No resource is added or
replaced, and the topic and key policies already admit every alarm of
the account and Region.

Docs: OBSERVABILITY.md says which alarms notify and how to subscribe,
the screenshots guide says its two alarms notify, and the stack-output
table describes the topic as it is.

Closes #686

* fix(slack): resolve a pasted github link in a mention to its repo

A GitHub link in a mention was read as slash words: the host and the
first path segment became the repo. Without a channel default,
"@Shoof fix https://github.com/org/repo/issues/42" was refused with
"Repository 'github.com/org' is not onboarded"; with a default the
task started on the default, without the issue.

The command processor reads a link whole, in the three forms it can
arrive in: <url> and <url|label> as Slack delivers them, and bare
text. A GitHub link to a repo, an issue or a pull request names
owner/repo and carries the number as issue_number. It counts like
owner/repo#42: the first such reference of the message decides, it
wins over the channel default without a RepoTable read, and a linked
repo that is not onboarded gets the "not onboarded" answer instead of
a task on the default. A clone address (.../repo.git) names the repo
without the suffix. Any other link names no repo and none of its
parts is read as word/word: another site, gist.github.com included,
or a file, a branch or a workflow run on GitHub. The link that named
the repo leaves the description as the word does, label included. A
message without a link is read as before.

What users of a channel with a default repo will notice, and anyone
who names an onboarded repo after a link: the first GitHub repo,
issue or pull request link decides wherever it stands, also inside
pasted output or a diff. The task starts on the linked repo when that
one is onboarded and is refused with "Repository '<linked>' is not
onboarded" when it is not. These started on acme/api and are refused:

- default acme/api, a pasted log line "npm ERR! see
  https://github.com/npm/cli/issues/4828 for details";
- default acme/api, a pasted diff that holds
  "url: https://github.com/old/charts";
- "bump flask, see <https://github.com/pallets/flask/issues/5000> in
  acme/api".

The guide gives the way out: write the onboarded repo the task is for
before the link. Treating a link as certain, like owner/repo#42, is
the choice made here. Reading it as certain only when its repo is
onboarded would leave those three messages as they were, and would
start a task on the default when the linked repo is not onboarded.

Known limits:

- A typed repo link that Slack did not wrap (in a code span) is not
  recognised when a backtick or a closing parenthesis follows it, and
  is read with a full stop that follows it.
- A label the user wrote on the link is dropped with the link.
- A link into an issue or pull request (a comment, the files tab)
  gives the number; the place it pointed to is not passed on.
- When owner/repo stands as a word before its own issue link, the
  word decides and the number is not carried. A repo link before
  owner/repo#N of the same repo wins, and the number stays in the
  description.
- A GitHub address of two path segments that is no repo
  (/settings/tokens) is read as one and refused.

Closes #850

* fix(api): return 409 when a slug names several active workspaces (#883)

DELETE /v1/linear/workspaces/{slug} found the workspace with a filtered
scan that stopped at the first active match. When more than one active
registry row carried the slug, it removed whichever row the scan read
first and answered 200, while the other rows stayed active. When
different admins had installed the rows, the answer was 403 or 200
depending on the order of the table.

The scan reads to the end of the registry, within MAX_SCAN_PAGES, and
collects every match. More than one active row for the slug is refused
with 409 WORKSPACE_SLUG_AMBIGUOUS: nothing is written and no secret is
deleted, with or without purge=true, and the message names the
linear_workspace_id of each of those rows. The CLI prints the message
and the code as it does for any API error, so it does not change, and
neither does the success response.

For review:
- The 409 comes after the admin check. A caller who installed none of
  the rows gets the 403 that a single row gives, without the ids; the
  admin of any of the rows gets the 409.
- The caller's own row is not removed alone, because the rows share
  the secret that the slug names.
- Only active rows count. With no active row for the slug, the revoked
  row read first is removed, as it was.
- A scan that reaches the page cap with pages left answers 500 also
  when it has read an active row: the unread pages can hold a second
  one. The registry holds one row per workspace, far below the cap.
- The endpoint takes no linear_workspace_id parameter, which the issue
  leaves open. The Linear setup guide documents the code and how to
  resolve it by revoking a row by id, and the message of the 409
  refers the operator to it.

Closes #883

* fix(agent): fail closed when the registry .mcp.json could reach a commit

The registry loader writes the resolved mcp_server config, which may
hold secrets, into the clone's .mcp.json and then has git leave that
file out of commits. In two cases the config could still reach a
commit, and with it the pull request:

- The repository commits .mcp.json as a symlink. The write followed
  the link, so the config landed in the link's target, a file the
  commit guard does not cover.
- The guard did not take. When `git update-index --skip-worktree`
  failed (index.lock held, unmerged index entry) or a git call raised,
  the loader logged a warning and went on to report a successful load.

apply_mcp_assets now raises RegistryAssetLoadError in both cases, so
the task fails before the agent starts and nothing is committed:

- A symlinked .mcp.json is refused before it is read or written (the
  check the issue proposes, not O_NOFOLLOW: the error names the cause,
  and nothing is read through the link either).
- The guard no longer trusts the exit code of update-index. It reads
  the flag back with `git ls-files -v` and raises when the flag is not
  set, or when a git call fails or times out. Only skip-worktree
  counts; an entry that is merely assume-unchanged does not. A
  .mcp.json that the repository tracks, or that its .gitignore
  re-includes, in a clone with sparse checkout enabled ends in the
  same refusal, and so does a directory outside a repository.

Either mechanism of the guard (the clone's exclude file, or
skip-worktree) also keeps the agent's own edits of .mcp.json out of
its commits, and git names a .gitignore file or a sparse-checkout
definition as the cause. The loader now logs one TASK line that names
the file as platform-managed for the task, and switches off git's
advice for the skip-worktree refusal as it already does for the
ignored file. The edits themselves are still left out: #760 stays
open for the redesign that lifts that limit.

For operators: a task whose Blueprint pins a registry mcp_server now
fails at start where it used to run, when .mcp.json is a symlink, or,
where the repository tracks .mcp.json or its .gitignore re-includes
it, when index.lock is held, the entry has an unresolved merge
conflict, or sparse checkout is enabled in the clone. Where the
clone's exclude file keeps the file out (the repository has no
.mcp.json and does not re-include it), no index entry is needed and
the last three do not fail the task. docs/design/REGISTRY.md describes
the guard and these failures.

Tests that used a plain directory as the clone now run in a git
repository, as a task does (test_registry_loader.py, and the
agent_step fixture of test_pipeline.py).

Closes #758
Closes #759
Refs #760

* test(cdk): hold the deploy task to deploy.yml, test its bootstrap check

The deploy job of deploy.yml runs `npx cdk deploy` on the assembly that
build.yml synthesized, so the pipeline does nothing of what
`mise //cdk:deploy` does before it deploys unless the workflow has a
step of its own. Nothing at the task said so, and nothing failed when
the task gained a step: the bootstrap preflight that #976 made its
first command has no counterpart in the pipeline.

The comment on [tasks.deploy] says that the pipeline does not run the
task, and what the pipeline does instead for each entry in front of
`cdk deploy`. test/scripts/deploy-workflow.test.ts holds the task to a
table of its dependencies and commands, each with its step in
deploy.yml or with none.

The test fails when an entry of the task is added, removed, moved or
changed and the table does not follow. A command is compared whole,
with the argument template that ends it, because mise also runs a
default written in the template and whatever follows it. The test
fails as well when the task holds anything it does not read: another
key, a string that is not double-quoted, or a sub-table, whose header
it recognises with or without indentation, spaces and quoted keys.

It fails when a recorded step is no longer in the workflow: the
log-delivery check with --check-only in the diff job, and
`npx cdk deploy --app cdk/cdk.out` in the deploy job. And it fails
when a step of the workflow runs a preflight that the table does not
record for it. The bootstrap preflight is recorded as not run by the
pipeline, so the test holds that until the step is recorded; whether
deploy.yml gets that step is left to #127.

test/scripts/preflight-bootstrap.test.ts runs the bootstrap preflight
as the task does, as a subprocess with a fake `aws`. Its exit code is
what keeps `cdk deploy` from starting, and no test ran the script. The
suite pins exit 0 on PASS and WARN, exit 1 on FAIL and on a state the
script cannot read, the --json output, the one DescribeStacks call
with --profile and --region, and the compute backends read from the
context arguments and from cdk.json, where the last argument wins. It
also pins the bypass: ABCA_SKIP_BOOTSTRAP_PREFLIGHT=1 lets the deploy
start without a call to AWS, and the check runs when the variable is
not set or has another value.

No behaviour changes: the edit of cdk/mise.toml is comments only. Two
sentences of the same comment called the log-delivery preflight the
first command of the task; the bootstrap preflight is.

Refs #843
Refs #127

* docs(bootstrap): document bootstrap tasks, preflight and versioning

The least-privilege bootstrap shipped without the documentation that
issue #128 lists. The root AGENTS.md did not mention bootstrap, the
command list of cdk/AGENTS.md had none of the three tasks and the file
had no entry for cdk/bootstrap/, and the deployment guide had no section
on bootstrapping, although the preflight's failure message sends
operators to that guide.

AGENTS.md routes bootstrap-policy and preflight changes to
cdk/src/bootstrap/ and names what moves with them: the generated
artifacts, the golden JSON in DEPLOYMENT_ROLES.md, the hash snapshot and
the bundle version the CLI requires. cdk/AGENTS.md lists the three
tasks, both directories and the scripts the tasks run, and the mistake
of editing an artifact by hand, with the tests that catch it.

The deployment guide gains "Bootstrap with least-privilege": an account
with no bootstrap, the ComputeTypes parameter, an account that already
has a bootstrap, and the preflight with a remedy for each result. It
says what the preflight leaves unchecked: a compute backend that only a
deployment profile selects. Replacing a standard CDK bootstrap is shown
with --force, because the CDK CLI otherwise changes nothing and exits 0
(#701); the setup section gives the same command. The section says what
the replacement means for the other CDK apps of the account and Region,
and that --force also lets the CLI downgrade a newer CDK bootstrap
version. It explains the "Using default execution policy of
...AdministratorAccess" line the CLI prints during a bootstrap: that
line describes the standard template, not this one.

DEPLOYMENT_ROLES.md gains "Versioning": the three CDKToolkit outputs,
where each comes from and what it answers. They describe the template
that was deployed, not what is attached to the execution role, and the
section says so. The preflight table moves from there to the guide.

The command in DEPLOYMENT_ROLES.md that sets ComputeTypes did not run
as printed: its value was unquoted, so the shell removed the backslash
that escapes the comma, and the AWS CLI rejected the value as a list.
With the escaping repaired it named only ComputeTypes, and
CloudFormation sets every parameter that an update leaves out to its
template default. The block now quotes the parameter, reads the names
of the stack's other parameters and names each with UsePreviousValue,
which is the update `bgagent setup` makes. It sends the update only
when it could read them, so that a read that fails, for example
because --profile was given to the update alone, cannot leave an
update that names ComputeTypes alone. The comment in that block loses
its backticks: pasted into a zsh that does not treat # as a comment at
the prompt, the macOS default, the block ran `cdk bootstrap` from
them. The Lambda MicroVMs section of the guide passed --parameters to
`aws cloudformation deploy`, which has no such option; that step links
to the new section instead.

The comment above the bootstrap task in cdk/mise.toml carried a third
copy of the old command, and the task's description sends operators
there. It points to the section of DEPLOYMENT_ROLES.md instead.

The JSON policy blocks of DEPLOYMENT_ROLES.md stay. They are the
baseline that cdk/test/bootstrap/golden-baseline.test.ts reads by
position, so the issue's request to remove them is not met.

Refs #128

* fix(agent): screen turn, tool-call and error events for credentials

Of the events the runner writes, only tool results were screened. The
model's thinking and text, the input of a tool call and the text of an
exception that ends the session went into the task's events as they
were, and from there to `bgagent watch`, the web console and the Slack
notice of an agent error.

The runner screens each of these texts the way it screens a tool
result, and before the progress writer cuts it to a preview: what the
output scanner or the redaction of log lines takes for a credential is
replaced by a marker. The text of a session error is screened once,
for the event and for the task's error message, which the failure
notice quotes.

A tool input is recorded as the repr of a dict. Its strings are
screened first, because a repr escapes the quotes, tabs and newlines
the patterns rely on. The repr as a whole then passes the scanner
only, for a secret that only a key and its value show together: the
log redaction replaces up to the next blank, which in a repr takes
the quote and the comma that close an argument, and the web console
reads the arguments back from that text. Tool results go through the
same helper. A string result is recorded as before; a result that is
a list of content blocks keeps what stands between a marker and the
next blank, as a string result does.

For operators: these previews show what tool-result previews and log
lines already show, false positives included. In a path or identifier
that contains `ghs_`, `ghp_`, `gho_`, `ghu_` or `ghr_` followed by
word characters, the rest of the word reads `***`
(`docs/walkthroughs_intro.md` becomes `docs/walkthroughs_***`), and
so does the value after `Authorization: Bearer` or `Authorization:
token`, a variable reference included. An input in which nothing is
found is recorded exactly as before. Event types and field names do
not change.

One part of #225. The policy per entity type, the audit record, PII
detection and the gate on pull-request content stay open.

Refs #225

* fix(security): scope gitleaks fixture allowlists to their rule and file

Two global allowlists in .gitleaks.toml exempted a test fixture by
stopword alone: the Slack signing secret of slack-verify.test.ts and
the idempotency key of orchestration-release.test.ts. With no `paths`,
no `targetRules` and no condition, each value passed the secret scan in
every file and under every rule, so a copy of either one outside its
test was not reported.

Each entry now names its rule (generic-api-key, the only rule that
reports the fixture) and its one test file, and sets
`condition = "AND"`. Without the condition gitleaks ORs the criteria:
the value would still be allowed everywhere, and every finding of the
rule would be allowed in the listed file. The history of HEAD still
scans clean. Either value in another file is reported, and so is a
secret in the two test files that does not contain the fixture value.

A comment above the entries states the convention, and the new suite
cdk/test/scripts/gitleaks-config.test.ts holds it: every global
allowlist lists its files in patterns anchored at both ends, and one
that exempts a value or a commit also names its rule and requires every
criterion. No JavaScript workspace declares a TOML parser, so the suite
reads the file as text and fails on a line in any other TOML form than
the one the file uses: gitleaks reads those forms too, and names in any
letter case, so an entry written that way would go unread. The file as
it is would pass a looser reading as well, so a second block gives the
same reading small configs that it has to refuse.

When a listed file moves, its old path has to stay in `paths` next to
the new one: the history scan reads each commit under the paths of its
time.

Refs #328

* test(ops): pin which stacks the ephemeral cleanup script deletes

scripts/cleanup-ephemeral-stacks.sh deletes CloudFormation stacks and
had no test: nothing held which stacks it selects, which it leaves
alone, or how it fails.

The suite runs the real script with a fake `aws` on PATH that answers
from a fixture and logs every call. The script deletes whatever its
`aws` reaches, so the suite starts it only when a bash that is started
the same way resolves `aws` to that fake. Where it does not, the tests
fail with that reason and the script is not run; one test holds that.

The suite holds that:

- an ABCA stack older than the default 48 hours is deleted, with or
  without the solution id in its description, and one in DELETE_FAILED
  is deleted again;
- the listing asks for the stacks that are complete, rolled back or
  failed to delete, and for no other state;
- a stack with termination protection, a younger stack, one whose
  creation time cannot be read and one that is in progress when it is
  described are left alone, each with its reason printed and counted;
- a stack of another application, the network stack of the same
  application and a stack without a description are left alone;
- of a stack that is left alone only the description is read, and a
  dry run stops once it has described the stack;
- --prefix limits the sweep, --max-age-hours replaces the default max
  age and --region is the region of every call;
- a refused deletion does not end the run, and its error is shown;
- a failing list-stacks and a failing identity call end the run with
  exit 1, and an unknown option or an invalid --max-age-hours is
  rejected before any AWS call.

One test reads cdk/src/main.ts: it fails when the application stack
gets another description than the one in the fixtures, which is the
text the script selects by.

Left out on purpose: the forced detach of network interfaces, which
issue #72 records as unable to release the interfaces AgentCore holds
and due to be replaced, and the exit code after a refused deletion,
which depends on that replacement. Not held either: --max-age-hours 0,
a stack that cannot be described, whether a stack with another
description is counted, and MAX_AGE_HOURS and AWS_DEFAULT_REGION read
from the environment, which the suite empties.

The script is unchanged, so every test passes before and after this
commit. Each test was seen to fail against a copy of the script, of
main.ts or of the suite's own start-up check with the line it guards
changed. The fake starts node for every `aws` call, 93 times in a run,
which is where the run time goes: 8 to 19 seconds on a development
laptop, depending on its load.

Refs #72

* fix(observability): sanitize a non-bmp character to one dash in ua.ts

agent/src/ua.py, cdk/src/handlers/shared/ua.ts and cli/src/ua.ts must
sanitize a label identically (AGENTS.md, #319), and the vectors of
contracts/ua-vectors.json hold them to it. One case had no vector, and
in it the modules disagreed: a character outside the Basic Multilingual
Plane. The two TypeScript modules matched UTF-16 code units and wrote
two dashes for it; the Python module iterates characters and writes
one. For "a", U+1F600, "b" that is a--b against a-b.

The regular expression of both TypeScript modules takes the `u` flag,
so it matches by code point and writes one dash. That is the contract's
own rule: every character outside the token alphabet becomes '-'. The
contract gains a fourteenth vector for the case, its input written as a
JSON surrogate-pair escape so that the file stays ASCII. The three
suites load the vectors themselves and need no change. Without the flag
the vector fails the cdk and the cli suite (expected a-b, received
a--b); the agent suite passes it either way, because its module already
does what the other two do with the flag.

Nothing else moves: the thirteen existing vectors pass unchanged, a
lone surrogate stays one dash in all three modules, and no value sent
today differs, since every component label in use is an ASCII constant.

Not covered: the app-id value built in
cdk/src/constructs/solution-ua-aspect.ts. It has its own copy of the
expression, no counterpart in another language and no vector, so a
character outside the Basic Multilingual Plane in an app-id override
still becomes two dashes there.

Refs #719

* fix(agent): run a build command shlex cannot split through the shell

A build or lint command without a shell operator is split with shlex
and started directly. shlex raises on a quote that is never closed and
on a trailing backslash, and nothing caught the ValueError: a coding
task failed during setup, before the agent ran, and a review task,
whose setup runs no baseline, failed in the gate after the review. The
blueprint stores the command unchecked, so one typo did that to every
task of the repository.

The same text beside a shell operator goes to `bash -lc`, where a
quote that is never closed is a syntax error with exit status 2: a
failed baseline or gate, not an exception. resolve_verify_argv sends a
command that shlex cannot split there as well, so both forms behave
alike, as they do since #1052 for a program that is not installed.
What a trailing backslash becomes is the shell's decision; its exit
status is the result either way.

The asks of the issue were met by #1052. This is an adjacent input
that still ended a task before the agent started.

Refs #750

* test(registry): cover the 502 a stranded record gives the publisher

When a publish fails after its record was created, the handler answers
502 REGISTRY_PUBLISH_INCOMPLETE with the record id and the adapter's
instruction to approve or delete the record before retrying. Publishing
the same version again is refused while that record exists, so this
answer is how the publisher learns which record has to be approved or
deleted.

No test executed that branch. With it removed the answer becomes the
generic 500, and all 46 tests of the two suites that load the handler
still passed.

Add one case that pins the status, the error code, the record id and
the instruction in the message. Test only, no product code changes.

The asks of #782 were met by #1052, which gave the publish function
28 s against a wait of 20 s for record creation but did not cite the
issue. This case covers the answer that change protects.

Refs #782

* docs(cdk): say that the dead-letter alarms notify the alerts topic

Four comments describe the notification channel of the CloudWatch
alarms as future work: the alarm property of FanOutConsumer and of
ApprovalMetricsPublisherConsumer, the comment on the publisher's
dead-letter queue, and the header of the publisher's handler. One
speaks of an action that "can be attached once a notification channel
is provisioned". The channel exists: AgentStack attaches the
OperationalAlerts SNS topic to both dead-letter alarms as their alarm
action (#629), and the stack tests pin it.

The two property comments state that in the present tense, so a
reader of either construct learns that the alarm notifies the alerts
topic and why the property is typed as the concrete Alarm class. The
queue comment ends at the alarm, whose own comment says the rest. The
handler's header keeps what holds for its metrics, that an alarm can
be defined on them; no such alarm exists, so it says nothing about
where one would notify. Comments only; the code is unchanged.

Two design documents said the same. Section 9.5 of
INTERACTIVE_AGENTS.md called alarm notification deferred for want of a
channel, and the status note of section 15 of CEDAR_HITL_GATES.md
listed the alarm plumbing as deferred. Both say what exists; what
stays deferred there are the additional alarms of section 11.5.

The required asks of #228 are met on main. Its optional OK action is
not implemented and is left to the maintainers.

Refs #228

* test(agent): pin that telemetry redaction keeps the text around a secret

The three tests for a secret in the error text of a METRICS_REPORT
event checked that the secret is gone and that its marker is there.
Both are also true when the whole message is replaced by the marker,
so the tests passed for a function that drops the readable text of
every error that holds a secret. Keeping that text is what #118 asked
for, and only the tests for errors without a secret pinned it.

Each of the three tests compares the whole logged value instead. The
comparison implies the two checks it replaces: a value that still
holds the secret, or lacks the marker, fails it as before. The
expected values are what main logs, so no product code changes.

Refs #118

* fix(bootstrap): apply the template to an already-bootstrapped account

`mise //cdk:bootstrap` did nothing on an account whose CDKToolkit stack
records another bootstrap variant, and exited 0. The CDK CLI does not
overwrite such a stack unless it is given --force: it warns and leaves
the stack as it is. A standard `cdk bootstrap` records another variant,
so the execution role kept AdministratorAccess and the ABCA policies
were never attached. The stack can keep the old variant value after a
forced bootstrap, so a later run without the flag did nothing again.
The deploy preflight names this task as the remedy, and `bgagent setup`
runs it and checks only the exit code.

The task passes --force. It replaces the bootstrap it finds: a standard
one, another variant, or a newer CDK bootstrap version, which the CLI
also declines to replace without the flag. A fresh account is
bootstrapped as before. On a bootstrap that is already current the CLI
prints its "You used the --force flag" warning and changes nothing.

Behaviour change for operators: on an account with a standard bootstrap
the task replaces it, and the other CDK apps of that account and Region
then deploy through the ABCA execution policies. A script that must not
replace one cancels the flag: `mise //cdk:bootstrap -- --no-force`.
`bgagent setup` still leaves a standard bootstrap unchanged.

DEPLOYMENT_ROLES.md covers the already-bootstrapped account: what the
task changes, what the kept variant value means for a later standard
`cdk bootstrap`, the execution policy list an earlier bootstrap may
have set, and how to check the role.

DEPLOYMENT_GUIDE.md gives the bare task for replacing a standard
bootstrap, and the Quick Start note and cdk/AGENTS.md say that the task
replaces the bootstrap it finds. The preflight message for a standard
bootstrap says that the remedy replaces it for every CDK app of the
account and Region.

The issue also allowed failing loudly on a variant mismatch. The flag
is the choice here because the tool's own remedies name the bare task,
and a stack that keeps the old variant value would fail on every later
run.

A test pins the flag in the task's command line.

Closes #701

* fix(agent): keep the stop-language of a deny when the reason is long

When a reviewer denies a gated tool call, the agent gets the reason
inside a fixed text: the rule that gated the call and the instruction
not to retry that class of action. The instruction stands at the end,
and the whole text was cut at 500 characters. The API accepts a reason
of up to 2000 characters, so a reason of more than about 220
characters cut into the instruction, and a longer one removed it and
the rule name altogether. The agent was then left with the bare
reason, which it answers with retries.

The cut now falls in the reviewer's reason: the names of the matching
rules, then the reason, are shortened to the room the fixed text
leaves, and escape sequences are removed before the cut, so that it
cannot split one. A text that fitted is unchanged, and so are the cap
of 500 characters and the wording. With the refused call the agent
sees about the first 200 characters of a long reason; the full reason
still follows in the <user_denial> block at the next Stop seam.

No test held the wording: with the rule name and the instruction
deleted, the suite passed. One test now compares the whole text.

The user guide says what a deny does: the instruction, the 60 seconds
in which the same rule refuses the same tool without a new request,
what a timed-out gate does not do, and when to approve instead. The
design document describes the rule-level cache entries and the text
that is returned.

Refs #113

* docs(registry): document the 443-only network reach of mcp servers

REGISTRY.md said nothing about the network an mcp_server asset is
reached from, although the registry bullet of the deployment guide
sends the reader there. The agent connects to the server from inside
the task's compute session, and on every backend (AgentCore, ECS and
Lambda MicroVMs) the runtime security group allows outbound TCP 443
only.

Section 2 gains a subsection, 2.1, that says so: an http or sse
server has to be served on port 443 and is not supported on another
port on any backend, the calls of a stdio server are bound by the
same rules, and neither publish nor resolution looks at the port or
tests connectivity, so a pin to a server the session cannot reach
resolves and loads, the task starts, and the agent cannot use the
server's tools. The rule and the DNS Firewall allowlist stay
described in one place, COMPUTE.md, which the subsection links to.

The issue took the restriction to be specific to lambda-microvm; all
three backends have it. Of the two options the issue leaves open, a
reachability check or a note, this is the note, as in the deployment
guide: nothing checks reachability at synth, onboarding or publish
time. The other asks of the issue are met on main: the test that
crosses the 4,096-byte hook limit through resolved_assets landed
with #904 (cdk/test/handlers/orchestrate-task-microvm.test.ts), and
the Lambda MicroVMs sections of COMPUTE.md and of the deployment
guide state the 443-only egress.

Closes #818

* test(agent): pin the server-test thread join and use distinct task ids

The race of #841 is already fixed: reset_server_state joins every
pipeline thread while the stubs of its test are still in place (#806)
and fails the test whose thread outlives the join (#1035). Nothing held
that in place. With the join deleted the file stays green in most runs,
because the thread usually finishes in time anyway, and the order "join
first, undo the stubs after" is inherited from conftest's _clean_env,
not stated by the fixture.

A new test runs pytest on a throwaway module of two tests, with the
fixture and conftest.py loaded as they are for this file. The first
test ends while its pipeline thread has not looked up run_task yet; the
second checks that the thread ran the first test's stub and never its
own. It fails when the join is removed and when the stubs are undone
before the join, both times with the failure the issue reports: a stub
called by a test that never made the call. The thread of that module
calls run_task only once it is released, so a run that stops between
the two tests cannot start a real pipeline. The nested run is started
without the caller's PYTEST_ADDOPTS: an option exported in a shell,
such as -k, would otherwise decide its result.

The three accepting tests of TestMicrovmRunHookPlatformConfig that
shared the task id t-pc pass their own. Every pipeline thread of the
file is started by exactly one test, so the name in a leak message
points at its origin.

Two boxes of the issue are not implemented as written. A join at
fixture setup has nothing to join: every test ends with its threads
joined or fails, no other file starts a pipeline thread, and none is
alive at the start of any of the 240 tests. The re-run of #680 is moot:
that pull request has merged.

Closes #841

* feat(observability): count and alarm on failed webhook screening (#794)

The Jira and Linear webhook processors screen recent comments and
Linear project documents on their own and drop them when the Bedrock
Guardrail call fails, so that third-party text never gates the
reporter's task (ADR-026). The only trace of such a drop was a warning
in the processor's log: a lasting guardrail fault could thin out the
context of every tracker task with no metric and nothing to alarm on.

The three paths the issue names now write one embedded-metric line for
each failed screening call: ABCA/Webhooks:WebhookScreeningFailed, with
a `source` dimension (jira-comments, linear-comments, linear-docs) and
a total without dimensions. Only a failed call counts. Content that
the guardrail blocks, or that no guardrail is configured to screen, is
dropped as before and not counted.

Where Linear or Jira is deployed, the deployment has one alarm on the
total (Sum >= 1 in a 5-minute period, missing data not breaching)
that notifies the shared OperationalAlerts topic. The
metric is sparse, so a rule that waits for several datapoints would
stay silent on a quiet deployment. Operators subscribed to the topic
get a new kind of notification, one per transition into ALARM.

The alarm comes from a private helper beside the stack's
addAlarmActions call, not from a new construct, and is created in the
ConcurrencyMaintenance nested stack, next to the scheduled jobs. The
root stack has no room for one more resource: its widest inline
configuration (all three backends, every option, a three-zone pin)
already needs the whole 490-resource budget.
OBSERVABILITY.md and ADR-026 describe the metric and the alarm.

Not counted: a sub-issue's own files in a Linear epic. They are
dropped one level up, where a failed screening call cannot be told
from the other reasons for a rejection.

Closes #794

* chore(setup): move lambda microvm regions into the capability catalog

The Regions that offer Lambda MicroVMs were declared in
cdk/src/handlers/shared/microvm-regions.ts, outside the capability
catalog, and a second, unguarded copy lived in the CLI. `bgagent setup`
checked neither, so `--compute lambda-microvm` in another Region got as
far as `cdk diff`, which then failed inside synthesis.

contracts/deployment-capabilities.json has a `compute` section with one
entry per backend; only lambda-microvm lists Regions. The CDK constant
is that entry, the CLI reads its parity-tested mirror, and the CLI's
own copy is gone. Setup rejects a backend the Region does not list as
soon as the compute selection is final, whether it comes from
--compute, the existing stack or the profile: before the feature
prompts, before a profile is written and before the diff.

For reviewers:

- Setup honours the escape hatch of ADR-021 as synthesis does: a
  non-empty microvm_region_override, from --context or from persistent
  CDK context, lifts the check. Without that, setup would refuse a
  stack that was deployed with the override.
- persistentContext() lists its sources lowest precedence first
  (~/.cdk.json, cdk.context.json, cdk.json), the order in which the
  CDK CLI lets one override another. Setup's network topology lookup
  reads the same list, so it also prefers cdk.json over
  cdk.context.json when both set networkTopology.
- `--no-deploy` refuses to write a profile with a backend the Region
  does not list.
- lastVerified and source are unchanged: they describe core and the
  features. The Lambda MicroVMs list is the ADR-021 launch list
  (2026-06-22), moved as it was and not checked against AWS again; the
  deployment guide says which entries the date covers.
- The synth warning, the synth error and the task-error remedy name
  the catalog as the place to add a Region.
- microvm-regions.ts imports the `compute` section by name, so the 32
  handler bundles that reach the error classifier carry that section
  and not the whole catalog.

Closes #1017

* fix(observability): show the turn count that max_turns limits

The turn numbers of one task disagreed, and `bgagent status` could
print one that `max_turns` does not limit against `~<max_turns>`.

The task record took both `turns_attempted` and `turns_completed` from
the `num_turns` that the agent SDK reports, and so did the `turn` of
`agent_cost_update`. That is not the count `max_turns` limits: on a
run stopped at the limit it is the limit plus one, and otherwise it
grows with each tool result, so an answer that calls two tools adds
two. A task with 62 answers under a limit of 80 and an SDK count of 90
was recorded with turns_attempted 90 and turns_completed 80.

Agent:
- `turns_completed` is the runner's count of the model's answers, which
  is what the limit counts, clamped to `max_turns`. The SDK's count
  stands in only where the runner counted no answer.
- `turns` and `turns_attempted` keep the SDK's raw count. The field
  documentation says what it is and why it can exceed the limit.
- `agent_cost_update` carries the turn number of the `agent_turn`,
  `agent_tool_call` and `agent_tool_result` events around it.

Turn line of `bgagent status`:
- `<n> / <max_turns>`, without the `~`: the limit is exact.
- A finished task shows the `turns_completed` of its record, whatever
  events are still in the window, as the web console does. A running
  task shows the turn of the newest `agent_turn` event, and so does a
  finished one whose record holds no count (0 included).
- `turns_attempted` is no longer printed against the limit.

Two values change their source, not their shape: `turns_completed` on
the task record and `metadata.turn` of `agent_cost_update` come from
the runner's count instead of the SDK's `num_turns`. No field is
added, renamed or retyped, and nothing reads the `turn` of a cost
update. `turns_completed` is lower than before for a task whose
answers call several tools at once.

Records written before this change keep the SDK's count as
`turns_completed`, and `bgagent status` prints it for them. An agent
built since #1052 clamped it to the limit: the task above reads
`80 / 80`, where it read `62 / ~80` while its last `agent_turn` event
was among the 20 events that `bgagent status` fetches, and `90 / ~80`
otherwise. An older agent did not clamp it: that task reads `90 / 80`,
where it read `90 / ~80`, or the turn of an `agent_turn` event that
such an agent numbered per message (`171 / ~80` in the issue). Deploy
the agent with or before the `bgagent` CLI.

Still open in #919: the Linear and Jira completion comments, the
Linear iteration reply and the Jira preview print `turns_attempted`
against `max_turns` (`turns: 90 / 80`).

Refs #919

* chore(cli): fail lint on an import that leaves the cli package

The CLI ships only lib/, compiled from cli/src, so a file outside the
package is not part of an installed CLI. Nothing but the compiler's
rootDir kept cli/src inside the package, and it stops TypeScript
sources only: an import of another package's build output (cdk/lib)
or of a JSON file such as contracts/constants.json compiles, and for
a source the answer is a bare TS6059. ESLint reported none of them
by path. For a workspace package imported by its name
(@abca/cdk/lib/...) its only answer was
import-x/no-extraneous-dependencies, which proposes to declare the
package: with the package declared, lint and compile passed.

import-x/no-restricted-paths fails an import in cli/src of any file
of the repository outside cli/, by a path or by the name of a
workspace package. The root node_modules is exempt, where Yarn
installs the dependencies, but not the links Yarn makes there for
the workspace packages. The message says what to do instead: mirror
an API type or constant in src/types.ts, which check:types-sync
compares with the CDK, or copy the value and pin the copy with a
parity test. cli/src holds no such import, so the rule lands without
findings. Tests are not covered: they may load a contract.

The first zone is the repository minus the package, not a list of
sibling packages: contracts/ is mirrored for the same reason as the
CDK types, and no listed directory can be renamed and switch the
rule off unnoticed. The second zone is those links, the CLI's own
aside: the build output or a JSON file of a workspace package,
imported by the package name, resolves to a path through its link,
which the first zone lets pass with the rest of node_modules. A test
row imports @abca/cdk/package.json, so a renamed scope fails the
test instead of switching that zone off.

cdk/AGENTS.md and cli/AGENTS.md also say what the two messages of
import-x/no-cycle mean and how to break a cycle.

Refs #254

* chore(cdk): drop nodejs20.x from the cedar layer's compatible runtimes

The engines range no longer admits Node 20 (#1035, #1052). The Cedar
layer's compatible runtimes still named it, and the issue left "drop
or keep" open for the Lambda runtime references.

Drop. Lambda deprecated nodejs20.x on 2026-04-30 and every function
of the stacks runs nodejs24.x, the one that attaches the layer
included. The list filters layer listings, and CDK refuses at synth
to attach a layer to a function whose runtime is not in it, so no
function changes behaviour.

For operators: CloudFormation replaces the layer version on the next
deploy, as on every cedar-wasm bump, and the CedarWasmLayerArn output
carries the new ARN. Nothing to do.

The one other nodejs20.x reference in the repository, the fixture
function of the solution-UA aspect test, moves to nodejs24.x with the
change for #192 (deprecation warnings of the build).

Closes #889

* fix(jira): do not drop an admitted event when the registry read fails

The Jira webhook processor decided whether to create a task from a
registry read that turns every DynamoDB error into "tenant not in
registry". On the trigger-label path and on the @bgagent comment
iteration path a throttled read, a timeout or a missing permission
therefore ended the invocation successfully with a WARN. The receiver
had already answered Jira, and Lambda retries an asynchronous
invocation only when it fails, so the event was lost.

Both paths now read the workspace registry row with the existing
getRegistryRowStrict before they resolve the token. A read that fails
is logged at ERROR and fails the invocation, and Lambda delivers the
event again, twice by default. Everything before that read is a read
and task creation carries an idempotency key, so a retry repeats no
side effect; no Jira comment is posted for a failed attempt. A
registry that was read and holds no usable row still drops the event,
under its own log line. A row that was read is served to the resolver
from its cache, so the path makes no second query.

The label path's WARN names the missing token instead of the registry
and keeps the phrase "dropping event". The Jira setup guide tells the
two log lines apart.

For operators: an unreadable registry shows …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-runtime Python agent container: pipeline, runner, hooks, prompts, tools, Dockerfile documentation Improvements or additions to documentation enhancement New feature or request infra-cdk CDK stacks/constructs, bootstrap, deploy topology, tags, IAM wiring, teardown v1 Version 1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cdk): switch Bedrock inference profile to the global geo

3 participants