mirror of
https://github.com/aws/agent-toolkit-for-aws.git
synced 2026-11-22 05:18:04 +08:00
fix(aws-startup-advisor): stop granting GPT-5.4/5.5 an in. CRIS id in the rewriter and Design/Generate checklists
bc51f0cc scoped the in. prefix to GPT-5.6 in the catalog and schema, but
three consumers of that rule still said us./in./global. for GPT-5.4/5.5:
agents/llm2bedrock-code-rewriter.md, gcp-to-aws design-ai.md's checklist,
and azure-to-aws generate-artifacts-ai.md's checklist. Their model cards
publish only us. and global. ids. Each now reads: us./in./global. for
GPT-5.6; us./global. only for GPT-6, GPT-5.5 and GPT-5.4.
Adds tests/test_gpt54_55_cris_prefix_scope.py, which reads the catalog, the
shared/Azure schemas, the guardrails guide, and the three consumer files and
fails on any window that pairs GPT-5.4/5.5 with a grouped us./in./global.
grant without scoping in. to GPT-5.6. Verified to fail against the previous
wording of all three files.
This commit is contained in:
@@ -257,7 +257,7 @@ client = anthropic.Anthropic(
|
||||
|
||||
Preserve compatible SDK request/response shapes. A model version change still requires §9 target checks, including typed response parsing for Opus 5.5. Apply the Chat Completions → Responses reshape only when that API change was selected. Preserve the exact validated runtime profile ID or ARN. After applying the changes above, skip the Converse-specific guidance in the rest of §8; the §9 behavior-delta application still applies normally.
|
||||
|
||||
**Converse for a proprietary GPT target is id-form-dependent, not family-dependent.** A **bare** proprietary GPT id (`openai.gpt-5.5`, `openai.gpt-5.4`, `openai.gpt-5.6-*`, `openai.gpt-6-*`) is a `bedrock-mantle` id with no `bedrock-runtime` in-region form — a boto3 `converse()` call against a bare id fails at runtime; if your context pairs a bare id with the Converse path, stop and report the contradiction. GPT-5.6, GPT-6 (Astra, Sol, Luna, 6.1 Sol) **and GPT-5.5 / GPT-5.4** (model cards read 2026-11-06: `us.openai.gpt-5.5` / `global.openai.gpt-5.5`, `us.openai.gpt-5.4` / `global.openai.gpt-5.4`; Responses, Chat Completions and Converse on runtime, no Invoke) all have a `bedrock-runtime` path via CRIS ids (`us.`/`in.`/`global.` prefixed): when the plan says `migration_path: runtime_openai_cris`, a Converse, Responses or Chat Completions rewrite against the CRIS id is valid (base URL `bedrock-runtime.{region}.amazonaws.com/openai/v1` for the OpenAI-compatible APIs; note Guardrails are Converse-only and prompt caching Responses-only on runtime). For a Responses-based source app, the mantle express lane above remains the default and smallest change.
|
||||
**Converse for a proprietary GPT target is id-form-dependent, not family-dependent.** A **bare** proprietary GPT id (`openai.gpt-5.5`, `openai.gpt-5.4`, `openai.gpt-5.6-*`, `openai.gpt-6-*`) is a `bedrock-mantle` id with no `bedrock-runtime` in-region form — a boto3 `converse()` call against a bare id fails at runtime; if your context pairs a bare id with the Converse path, stop and report the contradiction. GPT-5.6, GPT-6 (Astra, Sol, Luna, 6.1 Sol) **and GPT-5.5 / GPT-5.4** (model cards read 2026-11-06: `us.openai.gpt-5.5` / `global.openai.gpt-5.5`, `us.openai.gpt-5.4` / `global.openai.gpt-5.4`; Responses, Chat Completions and Converse on runtime, no Invoke) all have a `bedrock-runtime` path via CRIS ids (`us.`/`in.`/`global.` prefixed for GPT-5.6; `us.`/`global.` for GPT-6, GPT-5.5 and GPT-5.4 — those cards publish no `in.` profile): when the plan says `migration_path: runtime_openai_cris`, a Converse, Responses or Chat Completions rewrite against the CRIS id is valid (base URL `bedrock-runtime.{region}.amazonaws.com/openai/v1` for the OpenAI-compatible APIs; note Guardrails are Converse-only and prompt caching Responses-only on runtime). For a Responses-based source app, the mantle express lane above remains the default and smallest change.
|
||||
|
||||
### Converse rewrite (default)
|
||||
|
||||
|
||||
+2
-2
@@ -157,8 +157,8 @@ is AWS-only and ports from gcp unchanged.
|
||||
`global.` CRIS id. Chat/Responses and runtime artifact selection match the saved design.
|
||||
- [ ] No **bare** proprietary GPT model ID (including bare `openai.gpt-5.5` / `openai.gpt-5.4`)
|
||||
paired with a Converse/`bedrock-runtime` path. GPT-5.6, GPT-6, GPT-5.5 and GPT-5.4 MAY use
|
||||
`migration_path: "runtime_openai_cris"` on `bedrock-runtime` with a `us.`/`in.`/`global.`
|
||||
CRIS id — this is NOT a violation.
|
||||
`migration_path: "runtime_openai_cris"` on `bedrock-runtime` with a CRIS id (`us.`/`in.`/`global.`
|
||||
for GPT-5.6; `us.`/`global.` only for GPT-6, GPT-5.5 and GPT-5.4) — this is NOT a violation.
|
||||
- [ ] Plugin attribution strings say "Azure-to-AWS".
|
||||
- [ ] `generation-ai.json` validates; `rollback_plan.mechanism == "feature_flag"`.
|
||||
|
||||
|
||||
@@ -518,7 +518,8 @@ Write `aws-design-ai.json` to `$MIGRATION_DIR/`.
|
||||
- [ ] No `bedrock_models[]` entry pairs a **bare** proprietary GPT id (including bare
|
||||
`openai.gpt-5.5` / `openai.gpt-5.4`) with a Converse/`bedrock-runtime` migration path.
|
||||
GPT-5.6, GPT-6, GPT-5.5 and GPT-5.4 MAY use `migration_path: "runtime_openai_cris"` on
|
||||
`bedrock-runtime` with a `us.`/`in.`/`global.` CRIS id — this is NOT a violation.
|
||||
`bedrock-runtime` with a CRIS id (`us.`/`in.`/`global.` for GPT-5.6; `us.`/`global.` only for
|
||||
GPT-6, GPT-5.5 and GPT-5.4) — this is NOT a violation.
|
||||
- [ ] `regional_warnings` is present (empty array `[]` if no issues; populated if any service unavailable in target region)
|
||||
- [ ] `multi_model_warnings` is present (empty array `[]` if single model or no coordination issues)
|
||||
- [ ] If `agentic_profile.is_agentic == true`: `agentic_design` object is present with `migration_approach` matching `preferences.json`
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
"""Guard: the `in.` CRIS prefix is a GPT-5.6 fact only.
|
||||
The GPT-5.4 and GPT-5.5 model cards (read 2026-11-07) publish only `us.` and
|
||||
`global.` inference-profile ids:
|
||||
https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-54.html
|
||||
https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-openai-gpt-55.html
|
||||
The catalog records that; this test makes sure no prose consumer of the catalog
|
||||
(design/generate checklists, the code-rewriter agent, the shared schema) hands
|
||||
those two models a grouped `us.`/`in.`/`global.` grant that would let an agent
|
||||
record `in.openai.gpt-5.4` / `in.openai.gpt-5.5` as a runtime id.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
PLUGIN_ROOT = Path(__file__).resolve().parent.parent
|
||||
CATALOG = PLUGIN_ROOT / "skills" / "shared" / "ai" / "models" / "openai-bedrock.json"
|
||||
# Every file that names GPT-5.4 / GPT-5.5 alongside a CRIS-prefix grant.
|
||||
CONSUMERS = [
|
||||
PLUGIN_ROOT / "agents" / "llm2bedrock-code-rewriter.md",
|
||||
PLUGIN_ROOT / "skills" / "gcp-to-aws" / "references" / "phases" / "design" / "design-ai.md",
|
||||
PLUGIN_ROOT / "skills" / "azure-to-aws" / "references" / "phases" / "generate" / "generate-artifacts-ai.md",
|
||||
PLUGIN_ROOT / "skills" / "shared" / "ai" / "schema-design-aws-ai.md",
|
||||
PLUGIN_ROOT / "skills" / "azure-to-aws" / "references" / "shared" / "schema-design-aws-ai.md",
|
||||
PLUGIN_ROOT / "skills" / "shared" / "ai" / "ai-migration-guardrails.md",
|
||||
]
|
||||
_GROUPED_PREFIX = re.compile(r"`?us\.`?\s*/\s*`?in\.`?\s*/\s*`?global\.`?")
|
||||
_GPT_54_55 = re.compile(r"GPT-5\.[45]|gpt-5\.[45]", re.IGNORECASE)
|
||||
def _sentences_granting_in_to_gpt54_55(text: str) -> list[str]:
|
||||
"""Return sentence-ish windows that mention GPT-5.4/5.5 AND the grouped
|
||||
us./in./global. prefix WITHOUT also scoping `in.` to GPT-5.6 in that window."""
|
||||
hits: list[str] = []
|
||||
for m in _GROUPED_PREFIX.finditer(text):
|
||||
window = text[max(0, m.start() - 320) : m.end() + 320]
|
||||
if not _GPT_54_55.search(window):
|
||||
continue
|
||||
# Acceptable only when the same window explicitly scopes `in.` to GPT-5.6
|
||||
# and gives GPT-5.4/5.5 their own `us.`/`global.` grant.
|
||||
scoped = re.search(r"GPT-5\.6", window) and re.search(
|
||||
r"`?us\.`?\s*/\s*`?global\.`?\s*(only|for|;)", window
|
||||
)
|
||||
if not scoped:
|
||||
hits.append(" ".join(window.split()))
|
||||
return hits
|
||||
def test_catalog_inference_profiles_for_gpt54_55_are_us_and_global_only() -> None:
|
||||
catalog = json.loads(CATALOG.read_text())
|
||||
for key in ("openai_gpt_5_4", "openai_gpt_5_5"):
|
||||
assert set(catalog["models"][key]["inference_profiles"]) == {"us", "global"}, key
|
||||
def test_no_prose_consumer_grants_in_prefix_to_gpt54_55() -> None:
|
||||
offenders: dict[str, list[str]] = {}
|
||||
for path in CONSUMERS:
|
||||
assert path.exists(), path
|
||||
hits = _sentences_granting_in_to_gpt54_55(path.read_text())
|
||||
if hits:
|
||||
offenders[str(path.relative_to(PLUGIN_ROOT))] = hits
|
||||
assert not offenders, (
|
||||
"GPT-5.4 / GPT-5.5 are granted a us./in./global. CRIS id; their cards publish "
|
||||
"us. and global. only. Scope `in.` to GPT-5.6:\n"
|
||||
+ "\n".join(f" {k}: {v[0][:200]}" for k, v in offenders.items())
|
||||
)
|
||||
def test_vendored_copies_match_canonical_for_edited_files() -> None:
|
||||
pairs = [
|
||||
(
|
||||
PLUGIN_ROOT / "skills" / "shared" / "ai" / "schema-design-aws-ai.md",
|
||||
PLUGIN_ROOT / "skills" / "gcp-to-aws" / "references" / "vendored" / "ai" / "schema-design-aws-ai.md",
|
||||
),
|
||||
(
|
||||
PLUGIN_ROOT / "skills" / "shared" / "ai" / "schema-design-aws-ai.md",
|
||||
PLUGIN_ROOT / "skills" / "azure-to-aws" / "references" / "vendored" / "ai" / "schema-design-aws-ai.md",
|
||||
),
|
||||
(
|
||||
CATALOG,
|
||||
PLUGIN_ROOT / "skills" / "agent-advisor" / "references" / "vendored" / "ai" / "models" / "openai-bedrock.json",
|
||||
),
|
||||
]
|
||||
for canonical, vendored in pairs:
|
||||
assert canonical.read_bytes() == vendored.read_bytes(), f"{vendored} drifted from {canonical}"
|
||||
Reference in New Issue
Block a user