Skip to content

fix: Bedrock debt remediation from PR #144 CR#146

Merged
jpr5 merged 5 commits intomainfrom
blitz/bedrock-debt/integration
Apr 29, 2026
Merged

fix: Bedrock debt remediation from PR #144 CR#146
jpr5 merged 5 commits intomainfrom
blitz/bedrock-debt/integration

Conversation

@jpr5
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 commented Apr 29, 2026

Summary

Remediates all 15 debt items from the PR #144 code review backlog plus 8 pre-existing issues surfaced during CR. Includes the PR #144 native stream format changes that landed after v1.16.1.

Fixed

  • Bedrock invoke native stream formatinvoke-with-response-stream now emits Anthropic-native snake_case payloads (content_block_delta, input_json_delta) wrapped in Bedrock EventStream chunk frames, instead of Converse-style camelCase events. Converse-stream retains camelCase format. (PR fix: emit native Bedrock invoke stream chunks #144, sf-jin-ku)
  • Bedrock invoke false-green test — Reasoning negative test used wrong event filters, masking a real bug (PR fix: emit native Bedrock invoke stream chunks #144)
  • Bedrock invoke/stream hardeningcompletionReq.stream = true in streaming handler; deterministic tool_use_${index} fallback IDs; textContent ?? null to preserve empty strings; unsupported content block and unexpected role warnings; webSearches warning on tool-call-only responses
  • Converse stream shape alignment — Wrap contentBlockStop and messageStop payloads to match real AWS Converse API; remove duplicate top-level contentBlockIndex; add trailing metadata events (usage + latencyMs) to all stream builders
  • Converse request conversion — Filter empty-string text blocks; unwrap inputSchema from { json: {...} } Converse API wrapper; completionReq.stream = true in streaming handler; content-loss warnings; error type ?? fix

Changed

  • Shared test helpers (createMockReq/createMockRes/createDefaults) in helpers/mock-res.ts
  • Per-test server lifecycle in reasoning-all-providers
  • Content+toolCalls streaming integration coverage for both invoke and converse paths (PR fix: emit native Bedrock invoke stream chunks #144)

Test plan

  • All 2645 tests pass (pnpm test)
  • Format check clean (pnpm run format:check)
  • Lint clean (pnpm run lint)
  • CI green (22/22 checks on prior push; monitoring current push)

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 29, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@146

commit: 601f107

@jpr5 jpr5 force-pushed the blitz/bedrock-debt/integration branch from d8d364b to bae1bf1 Compare April 29, 2026 05:59
jpr5 added 5 commits April 28, 2026 23:06
Move createMockReq/createMockRes/createDefaults into helpers/mock-res.ts
to eliminate duplication between bedrock and bedrock-converse test files.
Convert reasoning-all-providers to per-test server lifecycle
(beforeEach/afterEach) preventing cross-test state leakage.
Set completionReq.stream = true in streaming handler. Use deterministic
tool_use_${index} fallback IDs instead of random generation. Change
textContent || null to ?? null to preserve empty strings. Warn on
unsupported content block types and unexpected roles. Add webSearches
warning on tool-call-only responses. Update tests for new semantics.
unwrap inputSchema

Wrap contentBlockStop and messageStop payloads to match real AWS
Converse API shape. Remove duplicate top-level contentBlockIndex from
contentBlockStart/contentBlockDelta. Add trailing metadata events
(usage + latencyMs) to all three stream builders. Filter empty-string
text blocks in converseToCompletionRequest. Unwrap inputSchema from
Converse { json: {...} } wrapper. Set completionReq.stream = true in
streaming handler. Add content-loss warnings for non-text blocks.
Fix error type || to ??.
Update messageStop/contentBlockStop assertions for wrapped shapes.
Add safeResolve guard in postPartialBinary. Add unit tests for
contentBlockStop shape, contentWithToolCalls stream structure, and
metadata event presence. Add content+toolCalls streaming integration
coverage for both invoke and converse paths.
@jpr5 jpr5 force-pushed the blitz/bedrock-debt/integration branch from 806d9c4 to 601f107 Compare April 29, 2026 06:07
@jpr5 jpr5 merged commit 06e0e7c into main Apr 29, 2026
22 checks passed
@jpr5 jpr5 deleted the blitz/bedrock-debt/integration branch April 29, 2026 06:09
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