fix(kiro): harden identity and request normalization#28
Conversation
There was a problem hiding this comment.
Code Review
This pull request refines the platform identity conflict probe detection logic for Chinese and English and adds support for verifying legacy thinking signature envelopes to maintain compatibility with client-held history. The review feedback suggests a performance optimization in both has_platform_identity_intent_zh and has_platform_identity_intent_en by reordering the boolean conditions so that the expensive is_model_identity_probe check is evaluated last, allowing cheaper string checks to short-circuit early.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f78c08c017
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
f78c08c to
3f19fad
Compare
3f19fad to
834d05d
Compare
Summary
Fix two post-merge Kiro review issues from PR #27 and two production 400s seen online:
developerrole messages by promoting them to Anthropic top-levelsystembefore validation.tool_use.idvalues to Bedrock-safe[a-zA-Z0-9_-]+IDs and keep matchingtool_result.tool_use_idin sync.Root cause
The conflict-probe heuristic still allowed
product token + platformto trigger canned identity JSON without requiring identity, model, thinking, or runtime-platform intent.The protected signature verifier recomputed only the newest Bytecat-shaped envelope, so any assistant thinking block signed with the previous envelope could fail validation when clients sent it back in later turns.
The Kiro/Anthropic converter normalized
systemrole noise before validation but leftdeveloperrole messages untouched, so they reached the strict validator as unsupported roles. Historicaltool_use.idvalues were only rewritten when duplicated, not when they contained characters rejected by Bedrock/Kiro.What changed
developertext instructions into top-levelsystem; reject non-text developer blocks with a targeted invalid-request error.tool_use.idvalues, avoid collisions, and rewrite matching tool results consistently.Tests
CARGO_TARGET_DIR=/mnt/wsl/data4tb/static-flow-data/cargo-target/static_flow cargo test -p llm-access-kiro --jobs 4CARGO_TARGET_DIR=/mnt/wsl/data4tb/static-flow-data/cargo-target/static_flow cargo clippy -p llm-access-kiro --jobs 4 -- -D warningsgit diff --check