chore(cleanup): non-blocking review nits deferred from #806 — doctor comment/detail accuracy, Blueprint modelId validation, docs geography default
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- aws, python, typescript
- Domain
- cli, cloud, documentation, testing
Research direction
Start with the checklist and the named anchors in cdk/src/constructs/blueprint.ts, cdk/src/handlers/shared/bedrock-model-constants.ts, and cli/src/platform-doctor.ts, then inspect the referenced tests and diagnostic script. Run the relevant Blueprint, platform-doctor, model-id, and SDK smoke tests before changing behavior. Done means all nine findings are addressed, including validation, accurate diagnostics and details, corrected comments and tests, failed smoke-test status, and the documented geography default with its mirror regenerated.
Written by the indexing model from the issue text.
Description
Component
CLI (cli/src/platform-doctor.ts), CDK (cdk/src/constructs/blueprint.ts, cdk/src/handlers/shared/bedrock-model-constants.ts), docs (DEVELOPER_GUIDE.md + mirror), agent diagnostics (agent/scripts/diagnostics/test_sdk_smoke.py)
Describe the feature
Clear the non-blocking findings deferred from the review of #806 (approved at 5640d879, merged with these outstanding). Nothing here blocks a deploy today: the items are comment accuracy, one asymmetric validation boundary, one diagnostic exit-code gap, and one operator-facing doc default. Line numbers are as of 5640d879 and will shift; the symbol names are the anchors.
One is more than cosmetic — item 1 is the only remaining path that writes an unvalidated model id to the RepoTable.
- 1.
blueprint.tswritesagent.modelIdto the RepoTable with no validation (cdk/src/constructs/blueprint.ts:319, and theonUpdatepath at:426/:470). #806 addedassertModelIdUsablesorepo onboard --modelrejects bare ids, wrong geographies, ungranted models and doubled prefixes before the write. The Blueprint is a sanctioned co-writer of the same column and rejects none of them, so a Blueprint-pinnedus.anthropic.claude-opus-5on aglobaldeploy still fails at turn 0 withAccessDeniednaming no cause. The grant list and geography are both known at synth, so this can throw at synth. Symmetry with the CLI writer is the goal. - 2.
platform-doctor.tscarries two copies of a stale rationale comment (:441-447incheckBedrockModel,:518-523incheckBedrockInferenceProfile). Both explain theerr.name-vs-err.messagematching that now lives inclassifyProbeFailure(which has its own copy of the same reasoning), so neither function does what its comment describes. Both also credit the idiom tocheckGithubToken, which has notry/catchand no error matching at all (:280) — a maintainer sent there finds nothing. Delete both. - 3.
checkBedrockModelgives the same remedy fordeniedandabsent(platform-doctor.ts:452-455). Both render "Enable model access in the Bedrock console" — drawing a conclusion about the MODEL from an error about the CALLER, the split thatcheckBedrockInferenceProfileandcheckGrantedModelProfilesalready make correctly. The status is right (warnon denial); only the detail conflates the two. - 4.
bedrock_granted_model_profilesstates a half-false fact on a partially-updated stack (platform-doctor.ts:574-582). The guard isif (!bedrockModelIds || !geoRegion)— either output missing — but the detail says the stack "does not export BedrockModelIds and BedrockGeoRegion". Interpolate the actually-missing name(s). - 5.
cli/test/platform-doctor.test.ts:217restates the geography literal (const GEOS = ['global', 'us-gov', …]) instead of importingBEDROCK_GEO_PREFIXESfromcli/src/model-id.ts. The list itself now has a real forcing function (see "Already fixed" below); this restatement is the one copy left that nothing pins. - 6. Stale, self-contradictory comment in
cdk/test/constructs/blueprint.test.ts:429. The rationale "this blueprint declares noagent.modelId, so it legitimately removesmodel_id" is false against current behaviour —model_idis a non-asset override that is carried forward, not cleared — and contradicts the very next test (onUpdate does NOT remove model_id). The per-column assertions are correct; only the comment is wrong. - 7.
test_sdk_smoke.pyprintsPASSand exits 0 after an exception (agent/scripts/diagnostics/test_sdk_smoke.py:123).okis derived from message counts only and ignores theerrorslist, so a run that streams a result and then raises reports success with the traceback printed below the verdict — the exact silent-success this diagnostic exists to rule out. Suggestok = counts["assistant"] > 0 and counts["result"] > 0 and not errors, and printerrorsabove the verdict. - 8.
inferenceProfileId(geoRegion, bareModelId)takes two interchangeable unvalidated strings (cdk/src/handlers/shared/bedrock-model-constants.ts:135). The one function that owns the bare/prefixed distinction cannot enforce it — a swapped or already-prefixed argument compiles and producesglobal.global.anthropic.…. All callers are correct today; a guard (or branded/validated inputs) would make that structural rather than reviewed. - 9.
DEVELOPER_GUIDE.md:125says the geography default isus— "Geography via contextbedrockGeoRegion(defaultus)" — in the section the file calls canonical. Every other artefact #806 touched uses the precise form, e.g. theBedrockGeoRegionCfnOutput: "globalin the shipped cdk.json,usif no context is supplied at all". An operator reading the row concludes their deploy grantsus.profiles and pinsus.<model>per repo; on the CLI path the new--modelguard catches that, but via a Blueprint (item 1) it is written unvalidated. Use the CfnOutput wording and regenerate the Starlight mirror (developer-guide/Model-configuration.md).
Use case
Every item is drift-prevention on surfaces #806 just reworked: comments that now point at the wrong symbol are the mechanism by which the next maintainer reintroduces the bug that PR fixed, and items 1 and 7 are the same failure class the PR exists to eliminate — a value that cannot work being accepted silently and resurfacing as an unattributed turn-0 (or exit-0) failure.
Proposed solution
Items 2-6, 8 and 9 are comment/detail/test edits and can land as one cleanup PR. Item 1 (synth-time validation of agent.modelId in the Blueprint construct, with a test for each class assertModelIdUsable rejects) and item 7 are behaviour changes and are each worth their own commit within it.
Other information
- Raised during review of #806 (
aws-samples/sample-autonomous-cloud-coding-agents#806), which is approved and merged; deliberately kept out of that PR to keep it reviewable. - Already fixed at
5640d879, do not redo: the approving review's nits 1-3 and 9 were addressed in that head and its list is stale on them —BEDROCK_GEO_PREFIXESnow has a text-read parity test against the CDK literal (cli/test/model-id.test.ts, stays in sync with the CDK geography list); all four doctor probes route throughclassifyProbeFailure(no remaining inline regex copies);checkBedrockModel's three-way classification is pinned byit.eachon Throttling/InternalServer/Timeout plus explicit denial and absent cases; and theworkflows.tsallow-list doc block andbedrock-models.tsGEO_REGION_ENUM_VALUEScomment were both rewritten to describe the derivation correctly. - Related and already tracked: #846 (scope workflow model admission to the deployed geography) — the runtime-admission instance of the same geography-blindness, not in scope here.
- Also raised in the #806 description and not covered above: the platform default model id is still hand-copied across TypeScript and Python, though
model-default-docs-parity.test.tsnow pins the copies to each other.
- Dominant language
- TypeScript
- Stars
- 146
- Forks
- 46
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 26
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws-samples/sample-autonomous-cloud-coding-agents
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug v1
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
bug v1
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
-
documentation P2 security
Difficulty 2/5 1-2 days Newbie friendliness 74/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aws-samples/sample-autonomous-cloud-coding-agents#767 · 2 comments ·
All issues in aws-samples/sample-autonomous-cloud-coding-agents
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
TanStack/tanstack.com#1293 ·