Skip to content

fix(kiro): harden identity and request normalization#28

Merged
acking-you merged 2 commits into
masterfrom
fix/kiro-cr-post-merge-identity-signature
Jun 4, 2026
Merged

fix(kiro): harden identity and request normalization#28
acking-you merged 2 commits into
masterfrom
fix/kiro-cr-post-merge-identity-signature

Conversation

@acking-you
Copy link
Copy Markdown
Owner

@acking-you acking-you commented Jun 4, 2026

Summary

Fix two post-merge Kiro review issues from PR #27 and two production 400s seen online:

  • Avoid treating normal product/platform implementation requests as identity-conflict probes.
  • Keep protected thinking signatures from client-held pre-Bytecat-envelope history verifiable after deploy.
  • Accept OpenAI-style developer role messages by promoting them to Anthropic top-level system before validation.
  • Normalize historical assistant tool_use.id values to Bedrock-safe [a-zA-Z0-9_-]+ IDs and keep matching tool_result.tool_use_id in sync.

Root cause

The conflict-probe heuristic still allowed product token + platform to 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 system role noise before validation but left developer role messages untouched, so they reached the strict validator as unsupported roles. Historical tool_use.id values were only rewritten when duplicated, not when they contained characters rejected by Bedrock/Kiro.

What changed

  • Require explicit identity/thinking/conflict intent before product/platform mentions can trigger the conflict identity path.
  • Keep generating new protected signatures with the current Bytecat-shaped envelope while accepting the previous envelope for verification.
  • Promote non-empty developer text instructions into top-level system; reject non-text developer blocks with a targeted invalid-request error.
  • Sanitize invalid historical tool_use.id values, avoid collisions, and rewrite matching tool results consistently.
  • Add regression tests for identity false positives, legacy signatures, developer-role normalization, invalid tool-use IDs, and ID collision handling.

Tests

  • CARGO_TARGET_DIR=/mnt/wsl/data4tb/static-flow-data/cargo-target/static_flow cargo test -p llm-access-kiro --jobs 4
  • CARGO_TARGET_DIR=/mnt/wsl/data4tb/static-flow-data/cargo-target/static_flow cargo clippy -p llm-access-kiro --jobs 4 -- -D warnings
  • git diff --check

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread crates/llm-access-kiro/src/anthropic/converter/identity.rs
Comment thread crates/llm-access-kiro/src/anthropic/converter/identity.rs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread crates/llm-access-kiro/src/anthropic/converter/identity.rs Outdated
@acking-you acking-you force-pushed the fix/kiro-cr-post-merge-identity-signature branch from f78c08c to 3f19fad Compare June 4, 2026 07:01
@acking-you acking-you force-pushed the fix/kiro-cr-post-merge-identity-signature branch from 3f19fad to 834d05d Compare June 4, 2026 07:02
@acking-you acking-you changed the title fix(kiro): narrow identity probes and verify legacy signatures fix(kiro): harden identity and request normalization Jun 4, 2026
@acking-you acking-you merged commit cd44ba8 into master Jun 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant