Skip to content

fix(startup-advisor): preserve Astra model and API across Bedrock migration - #369

Merged
leon1418 merged 10 commits into
mainfrom
feat/startup-advisor-astra-bedrock
Oct 21, 2026
Merged

leon1418 merged 10 commits into
mainfrom
feat/startup-advisor-astra-bedrock

Conversation

@leon1418

@leon1418 leon1418 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Ports awslabs/startups#283 to plugins/aws-startup-advisor/, following the plugin's repository migration.

Astra keeps its selected Bedrock model and supported API through recommendation, Design, Generate, evaluation and rewriting. Older GPT defaults previously sent bare Astra IDs to Converse or unnecessarily reshaped supported Chat Completions into Responses.

This change:

  • Adds the dated Astra catalog and path-specific capability, region, lifecycle and capacity checks. Standard Mantle supports Virginia and Oregon at /openai/v1; runtime uses supported US/Global CRIS IDs.
  • Honors compatible API preferences and blocks conflicting requirements, including Responses-only Astra prompt caching. Evaluator and rewriter share legacy-path normalization and preserve image payloads, throttling recovery and partial-result resume.
  • Carries the choices through GCP/Azure schemas and phase gates. GCP execution packs use matching clients, IAM and comparison harnesses; application-profile resources and report claims are conditional on actual model/API support. Runtime profile overrides remain aligned with invocation permissions.
  • Uses exact inference/context-tier prices, 30-minute cache-write labels and runtime output-token weighting. Both cloud consumers derive the final ROI recommendation from verified source/target rates; unknown source prices remain unavailable.

Validation:

  • 363 agent-advisor tests and 312 llm-to-bedrock tests pass.
  • Repository manifest, plugin specification, skill parity, full Markdown lint and whitespace checks pass. Scoped Bandit reports no findings in the modified production Python scripts.
  • The committed Mantle target template is exercised with the real OpenAI SDK and offline HTTP transport. Independent representative Mantle Chat, Mantle Responses and runtime Converse packs validate imports, shell/Python/Terraform syntax, request construction, profile permissions and report/resource consistency.
  • OCR-assisted parent review and one independent, memory-isolated reviewer cover the proposal and its affected consumers.

No live inference or AWS deployment was run. Model/API/region access and unverified parameters still require target-account verification. Local and fixture validation are separate from GitHub CI.

@leon1418
leon1418 marked this pull request as ready for review September 30, 2026 16:18
@leon1418
leon1418 requested review from a team as code owners September 30, 2026 16:18

@leon1418 leon1418 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[🤖 AI review 🤖]

Comprehensive review of ebcc6f0cb9fda71243afc4e8e38d221f79292dbe: four P2 findings below. OCR-assisted parent review plus one independent, memory-isolated reviewer covered all 53 changed files (54 entries with the catalog rename expanded). Both full suites passed (336 agent-advisor + 305 llm-to-bedrock tests); Markdown, manifest, specification, parity and whitespace checks also passed. No live inference or generated customer application was run. I recommend addressing all four findings before merge.

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

Reviewed across correctness, parsimony, completeness, contradiction-checking, security, and test coverage. Verified independently rather than taking the PR description at face value: ran both test suites, diffed the vendored copies for byte-identity, ran markdownlint and bandit, and re-traced all four findings from the prior review round against the current diff.

Verdict: APPROVED

Test counts confirmed exactly. uv run pytest gives 363 passed (agent-advisor) and 312 passed (llm-to-bedrock) — matches the PR description precisely.

Completeness — no stale vendored copies. Confirmed via diff that all four canonical shared/ai/*.md files (ai-migration-guardrails.md, ai-model-lifecycle.md, ai-openai-to-bedrock.md, bedrock-quotas.md) are byte-identical across shared/ai/, gcp-to-aws/.../vendored/ai/, and azure-to-aws/.../vendored/ai/. No drift.

No contradictions found between the vendored copies, or between the new Astra rules and existing GPT-5.6 rules. The bedrock-runtime fallback claim in ai-migration-guardrails.md (previously "exists only for GPT-5.6") is correctly softened to include Astra — a real correction, since the stale absolute claim would have told an agent Astra has no runtime escape hatch when it does.

Prior review's 4 findings independently re-verified as genuinely fixed (not just marked resolved): the Astra region list (was Oregon-only, now us-east-1/us-west-2 consistently across catalog + 3 markdown refs + 2 scripts), the ignored explicit preferred_api_path (now honored with a conflict check against governance/continuity requirements), the unsynced GCP artifact generator (generate-ai.md/generate-artifacts-ai.md now emit the correct base path and skip the inference-profile resource for Mantle targets), and the hardcoded 10% cost premium in GCP Part 7 (now computed from Part 5's verified delta, matching the pattern already applied to Azure).

Correctness traced end-to-end: candidate ordering forces Astra rather than silently falling back to a Claude tier; region gating fails closed (model_region_unavailable) on out-of-region Mantle requests; the Chat/Responses n-support asymmetry is threaded correctly through _feature_findings (Chat gets a [TUNE] probe, not a [BLOCKS] reshape); prompt-caching gating uses real feature detection (needed = set(detected) | set(critical_features)), not a hardcoded model check; Pro→Astra is correctly flagged as a model change, not a same-model connectivity-only shortcut.

Test quality is genuinely behavioral. test_astra_execution_contract.py executes the literal Python code blocks embedded in llm2bedrock-prompt-evaluator.md (via exec(compile(...)) against mocked openai/boto3 clients) rather than pattern-matching markdown text — covers Mantle client dispatch, image payload shape differences across Converse/Responses/Chat, resume-after-partial-completion, and throttle/backoff (asserting exactly 6 attempts + empty output on exhaustion). test_roi_executes_rate_derived_formula similarly executes the embedded ROI formula against 4 cases including a zero-source-price edge case.

Security: ran bandit on the 7 modified Python files, no findings. No credential-handling changes in this diff.

Parsimony: all 55 changed files trace to the Astra feature or a necessary side-effect of it. The one non-obvious inclusion — a new normalize_api_path helper in SKILL.md — fixes a latent pre-existing bug (two gates independently guessing a missing-path default, which could disagree with each other) that the Astra work surfaced as a byproduct, not scope creep.

Two minor, non-blocking notes below as an inline comment and in this summary:

  1. discover-preview.md's early Discover-phase estimate table states the ~10% premium as fixed text for GPT-5.x (Astra's own row is already correctly conditional — "verify the source price"). This is a pre-Design rough first pass, not the load-bearing ROI figure that Part 7's fix targets in estimate-ai.md — low severity, flagged as a possible follow-up if Discover's numbers are meant to track Estimate's more closely.
  2. Astra's pricing/region figures ($11/$55 short-context, cache-write rates, etc.) are repeated identically across six files but all trace to the same external model-card citation that can't be verified from the diff alone. Internally consistent, but a single point of failure if that source is wrong — a trust boundary on an external fact, not a code defect.

@leon1418 leon1418 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[🤖 AI review 🤖] Re-reviewed 1749bb5 with OCR delegation, a separate isolated general reviewer, full Git coverage, and a completed convergence gate.

The four earlier conversations are verified fixed for the concerns they raised. This fresh audit found four remaining P2 issues, detailed inline. The bounded correction list is:

  1. Refresh Astra runtime JSON Schema support in the catalog, selector guidance/tests, and both cloud fact references. Preserve the documented non-streaming restriction and required strict/schema fields.
  2. Accept a cataloged system inference profile's ARN representation for region checks while retaining the supplied invocation identifier; keep unknown profiles and invalid caller regions blocked.
  3. Carry the advisor's invocation ID through the GCP handoff and explicitly translate equivalent model/path representations. Equivalent US/Global Converse plans must pass; real model/API/profile changes must still halt.
  4. Apply the selected Astra price and quota rules in GCP Design, including unavailable source prices and medium-volume runtime risk, so persisted Design fields agree with Estimate and setup.

The Design, ARN and handoff gaps were overlooked in the earlier manual work; this review should have traced those consumers sooner. The structured-output finding compares today's AWS model-card contract with the dated catalog; it does not establish when that support changed. Prior incomplete review records were preserved, and this recovery does not claim an earlier completed review round.

Validation: 363 agent-advisor and 312 llm-to-bedrock tests pass; the independent reviewer also ran 87 overlapping offline tests. Manifest/specification/parity checks, Markdown lint (2,449 files), scoped Bandit, full-history gitleaks and whitespace checks pass. The parent reproduced the capability/ARN failures with schema-valid inputs. Handoff and Design findings are source-contract evidence; no live inference, deployment or full natural-language generator run is claimed.

Recommendation: request changes. GitHub also reports merge conflicts (DIRTY). Approval remains for the user.

@leon1418 leon1418 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[🤖 AI review 🤖] Verified fafe5e4 with the complete startups-hybrid-v1 follow-up gate.

All four earlier findings are fixed. Verification also found and corrected the runtime Chat/Responses execution mismatch and a legacy Mantle-alias regression before publication. One initially isolated general reviewer revalidated the revisions alongside the parent repository review; all 57 Git inventory entries are covered.

Validation: 376 agent-advisor tests and 350 llm-to-bedrock tests pass. The independent reviewer ran 392 overlapping offline tests. Markdown, manifest/specification/parity, scoped Bandit, gitleaks and whitespace checks pass. Actual evaluator snippets and SDK MockTransport checks cover selected APIs, profile IDs/ARNs, images, retry and resume behavior. No live AWS inference or deployment was performed.

No remaining verified code findings. The four conversations we opened were resolved after current-head fix and ownership checks; the separate non-blocking reviewer's thread remains open for them. Approval is recommended for the user to perform. GitHub currently reports DIRTY and REVIEW_REQUIRED; this does not claim merge readiness.

@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

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

Review

This is ready to merge. The branch is current with main (merge-base is 3aeea52), and the one real overlap with recently merged startup-advisor work is reconciled correctly.

Catalog overlap with #454

#454 added openai_gpt_6_astra to skills/agent-advisor/references/models/openai-bedrock-2026-09-24.json. This PR edits that same key. Diffing main against this head, the only catalog change is inside openai_gpt_6_astra: the thinner #454 entry is replaced with the path-specific one (per-API supported_regions, inference_profile_regions, Responses-only prompt_caching, runtime structured_output_json). The openai_gpt_6_sol, openai_gpt_6_luna, and openai_gpt_6_1_sol entries from #454 are unchanged.

Astra is the only GPT-6 model with extra selector special-casing in openai_model_recommendation.py (Opus 5.5 converse-tier fallback, forced candidate order, prompt-caching / structured-output / sampling notes). openai_gpt_6_sol, luna, and 6.1-sol already resolve through _same_model_catalog_key and _mantle_candidate_order. That split matches the runtime differences and stays inside this PR's scope.

Generate path

generate-artifacts-ai.md drops the fake provider_adapter.py stub that Mantle and CRIS paths used to emit so Step 2's import would resolve. Step 2 now calls the selected client directly (chat.completions.create vs responses.create), resolves required_client_api for runtime_openai_cris, and keeps aws_model_id as given (short ID or system-profile ARN, with no ARN-in-ARN interpolation). The same guidance is carried into the Azure skill.

Discover pricing

53920d473 replaces the fixed "~10% premium" line in discover-preview.md. Same-model rows now derive price direction from verified source rates and the selected inference option and context tier.

Validation

On this head: 562 agent-advisor tests, 406 llm-to-bedrock tests, and 469 plugin tests passed. tools/validate.py, tools/sync-plugin-skills.py --check, and markdownlint on plugins/aws-startup-advisor/**/*.md are clean.

Non-blocking

openai_model_recommendation.py matches Astra with display_name == "OpenAI GPT-6 Astra (on Bedrock)" in several places. Keying those checks off openai_gpt_6_astra would survive a display-name edit. Not a merge blocker.

@leon1418
leon1418 added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit 7cf4fab Oct 21, 2026
11 checks passed
@leon1418
leon1418 deleted the feat/startup-advisor-astra-bedrock branch October 21, 2026 23:46
herosjourney pushed a commit to herosjourney/agent-toolkit-for-aws that referenced this pull request Oct 22, 2026
…n-assessment

Merge main, which contains PR aws#369 (preserve Astra model and API across
Bedrock migration), into the PR 483 branch using a semantic union.

- The five conflicted gcp-to-aws phase files (clarify-ai-only, design-ai,
  estimate-ai, generate-ai, and the agent-advisor migration-plan overlap)
  keep the 483 delegation-only shims.
- PR aws#369's neutral behavior is ported into the bedrock-migration-assessment
  files instead: design-ai, estimate-ai, clarify-ai-only, generate-ai,
  generate-artifacts-ai, discover-preview and shared/openai-on-bedrock.
  483's source-neutral wording is kept in the textual conflict hunks.
- Vendored AI guides are resynced from shared/ai.
- closure.json and the bootstrap manifests are regenerated with the repo
  tools. The closure stays at 65 entries. The documented bootstrap hash in
  gcp-to-aws SKILL.md and discover.md is updated to 5863fe96...bba7.
- Regression tests for the moved aws#369 behavior are added.

Validation: plugin pytest 697 passed, llm-to-bedrock 407 passed,
agent-advisor 562 passed; mise ci, validate, build and security pass;
fixture validator 85 artifacts, 0 errors; six-scenario remote smoke 6/6.
herosjourney pushed a commit to herosjourney/agent-toolkit-for-aws that referenced this pull request Oct 23, 2026
Addresses PR aws#483 review 5620455181 by vagmur-aws, comment 4353203474
(skills/shared/migration/bma-input-patterns.json:3 and closure.json):
4a51ac3 was a merge commit on the aws#449 branch, not an ancestor of main,
and predated aws#369.

- selected_base 4a51ac3
  -> 9ab5063 (upstream/main)
  git merge-base --is-ancestor 9ab5063 upstream/main -> exit 0
- Regenerated closure.json and both bootstrap manifests with the PR's own
  tooling (sync-runtime-copies.py, build-bma-closure.py).
- Verified every aws#369 hunk in the 7 adapted sources (clarify-ai-only,
  design-ai, discover-preview, estimate-ai, generate-ai,
  generate-artifacts-ai, openai-on-bedrock) is present in the BMA
  copies; no content drift to port. Vendored files pass lint:vendored-parity.
- New test test_selected_base_pins_agree_and_are_consistent asserts one
  selected_base across closure.json, both bootstrap manifests, all three
  bma-input-patterns.json copies, runtime-copy-manifest.json, both
  fixtures, and the BASE constant in the classifier copies and tools.

Hashes:
  closure.json file 7a58d70792bc363ab3d9e86156236dd3429905cc12ba9414c951bfa62717a783
  closure.json self 457c32fc8ca1b0e6c74975500a6f921e2464aba1eb4cba0dbd279a0e261fa5da
  bootstrap manifest file 267fe013d216f85dd8c272126099d3f3eb2b909901324d14ab1a47ee06751b02
  bootstrap manifest self 2447652f905ab40b2db3220883abb41c470106d118402f23b68fc6906624faab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants