Skip to content

Remove HttpRequestDetails from AI errors and response metadata - #10010

Merged
tim-smart merged 4 commits into
v4/next-minorfrom
agent/nelson-effect-bot/a52f296c0e5b
Oct 27, 2026
Merged

tim-smart merged 4 commits into
v4/next-minorfrom
agent/nelson-effect-bot/a52f296c0e5b

Conversation

@effect-bot

Copy link
Copy Markdown
Contributor

Removes HttpRequestDetails from the AI modules, along with each of its three uses:

  • AiError.NetworkError has flat method and url fields in place of request. message is unchanged, since it only ever read those two fields.
  • AiError.HttpContext is now { response?, body? }. Nothing read http.request; providers already put (METHOD url) into the description through buildErrorDescription.
  • Response.ResponseMetadataPart no longer has request, and the Response.HttpRequestDetails alias is gone. Four language models were attaching the full request, headers included, to every response's metadata part, so it ended up in persisted Chat histories.

These APIs are marked unstable, so this ships as a minor release.

Provider changes:

  • The six provider error mappers build NetworkError with NetworkError.fromRequestError, which keeps main's description and reason handling. The status-code mappers take method and url directly.
  • The private buildHttpRequestDetails and requestDetails helpers are removed from the provider error modules and language models.
  • The OpenAI WebSocket error paths used to copy request.headers into the error without calling Redactable.redact. They now record only the method and URL.

Errors and response metadata no longer carry request headers or query parameters at all, so credential redaction no longer depends on the header redaction rules. Diagnostics stay the same: reason, description, method and URL.

The migration annotations and migration/v3-to-v4.md are updated to match. This is independent of #9984 and does not include its cause-derived NetworkError descriptions.

Checks: pnpm check, pnpm lint, the packages/effect/test/ai and packages/ai suites (1613 passed), and doc examples for AiError.ts and Response.ts.

Closes EFF-2992

@changeset-bot

changeset-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9fbca56

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
effect Minor
@effect/ai-anthropic Minor
@effect/ai-cloudflare Minor
@effect/ai-openai Minor
@effect/ai-openai-compat Minor
@effect/ai-openrouter Minor
@effect/ai-typesafe Minor
@effect/opentelemetry Minor
@effect/vitest Minor
@effect/atom-react Minor
@effect/atom-solid Minor
@effect/atom-vue Minor
@effect/platform-browser Minor
@effect/platform-bun Minor
@effect/platform-deno Minor
@effect/platform-node-shared Minor
@effect/platform-node Minor
@effect/sql-clickhouse Minor
@effect/sql-d1 Minor
@effect/sql-libsql Minor
@effect/sql-mssql Minor
@effect/sql-mysql2 Minor
@effect/sql-pg Minor
@effect/sql-pglite Minor
@effect/sql-sqlite-bun Minor
@effect/sql-sqlite-do Minor
@effect/sql-sqlite-node Minor
@effect/sql-sqlite-react-native Minor
@effect/sql-sqlite-wasm Minor
@effect/docgen Minor
@effect/doctest Minor
@effect/graphql-generator Minor
@effect/openapi-generator Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@effect-bot
effect-bot changed the base branch from main to v4/next-minor October 27, 2026 03:30
@effect-bot
effect-bot force-pushed the agent/nelson-effect-bot/a52f296c0e5b branch from 09ae7f5 to 585993f Compare October 27, 2026 03:39
@effect-bot
effect-bot force-pushed the agent/nelson-effect-bot/a52f296c0e5b branch from 2b93985 to 9fbca56 Compare October 27, 2026 04:10
@tim-smart
tim-smart enabled auto-merge (squash) October 27, 2026 04:15
@tim-smart
tim-smart merged commit 3284465 into v4/next-minor Oct 27, 2026
10 checks passed
@tim-smart
tim-smart deleted the agent/nelson-effect-bot/a52f296c0e5b branch October 27, 2026 04:19
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 39.34 KB 39.34 KB 0.00 KB (0.00%)
basic.ts 7.18 KB 7.18 KB 0.00 KB (0.00%)
batching.ts 11.06 KB 11.06 KB 0.00 KB (0.00%)
brand.ts 6.84 KB 6.84 KB 0.00 KB (0.00%)
cache.ts 11.49 KB 11.49 KB 0.00 KB (0.00%)
config.ts 22.75 KB 22.75 KB 0.00 KB (0.00%)
differ.ts 21.91 KB 21.91 KB 0.00 KB (0.00%)
http-client.ts 26.74 KB 26.74 KB 0.00 KB (0.00%)
http-router.ts 36.82 KB 36.82 KB 0.00 KB (0.00%)
logger.ts 11.96 KB 11.96 KB 0.00 KB (0.00%)
metric.ts 9.42 KB 9.42 KB 0.00 KB (0.00%)
optic.ts 7.05 KB 7.05 KB 0.00 KB (0.00%)
pubsub.ts 15.97 KB 15.97 KB 0.00 KB (0.00%)
queue.ts 12.77 KB 12.77 KB 0.00 KB (0.00%)
schedule.ts 11.74 KB 11.74 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.00 KB 14.00 KB 0.00 KB (0.00%)
schema-binary.ts 41.03 KB 41.03 KB 0.00 KB (0.00%)
schema-class.ts 21.54 KB 21.54 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 29.50 KB 29.50 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 27.90 KB 27.90 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.26 KB 15.26 KB 0.00 KB (0.00%)
schema-string.ts 12.24 KB 12.24 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.18 KB 16.18 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 38.86 KB 38.86 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 26.06 KB 26.06 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 20.81 KB 20.81 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 20.96 KB 20.96 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.06 KB 21.06 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.09 KB 26.09 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.14 KB 21.14 KB 0.00 KB (0.00%)
schema.ts 20.74 KB 20.74 KB 0.00 KB (0.00%)
stm.ts 14.15 KB 14.15 KB 0.00 KB (0.00%)
stream.ts 10.33 KB 10.33 KB 0.00 KB (0.00%)

@effect-bot effect-bot mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants