Skip to content

fix(spring-ai): preserve native error privacy and incomplete outcomes - #523

Open
nik13 wants to merge 2 commits into
devfrom
fix/opus-followup-traceAI-473
Open

nik13 wants to merge 2 commits into
devfrom
fix/opus-followup-traceAI-473

Conversation

@nik13

@nik13 nik13 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to merged #473, addressing all three verified recall findings without introducing a second model span or provider.

  • Add maintained SpringAITracingObservationHandler as a replacement for Micrometer's generic DefaultTracingObservationHandler. With FI_HIDE_ERROR_DETAILS=true, native chat, embedding and tool errors retain ERROR status and exception type without recording messages or stacks. Original application exceptions and observation contexts are not mutated. Explicit raw-error opt-in remains available.
  • Preserve UNSET rather than synthesizing OK when a native chat observation stops without a completed response. Spring AI stops cancelled streams, including downstream timeouts, without reporting their cause. The handler therefore preserves an unknown outcome rather than fabricating a timeout/provider error; reported errors remain ERROR, completed calls/streams remain OK.
  • Resolve compatibility-wrapper request metadata from configured defaults plus non-null request overrides, keeping request aliases separate from response snapshots in both sync and streaming calls.
  • Update the README's normal bean configuration to replace the generic handler, not add another tracing pipeline. The existing filter alone cannot intercept error recording. Bridge dependencies remain provided by the application.
  • Extend the installed-JAR CI matrix to the latest published Spring AI 2.1.0-RC1, alongside stable 2.0.2 and the 1.1.x cells.

Reproduction

On current dev 268f76a823a43a3238b34b4984d25fd0e946d252, the recall harness reproduced four failing assertions covering the three findings: native error privacy, native timeout reported as OK, sync request alias replaced by the response snapshot, and missing stream request model. Regression tests were added before implementation.

Existing open Spring PRs were checked first; #204 concerns the earlier 1.1.x port, #444 concerns starter/provider reuse, and #334 concerns shared Arconia privacy rather than these native Spring AI lifecycle defects.

Validation

All runtime tests used synthetic credentials and loopback HTTP under an outbound-denied sandbox. No vendor or Future AGI Cloud calls were made.

  • Installed-JAR consumer: 26 tests passed in each of 1.1.0, 1.1.8, 2.0.2 and 2.1.0-RC1. Includes sync/stream error privacy, unchanged exception identity, real stalled SSE timeout, explicit cancellation, alias/snapshot separation, native tools/embeddings/parentage, OTLP protobuf/JSON and compression, and Boot 3.5/4.1's documented beans and wire output.
  • Spring AI module on 1.1.8 and 2.1.0-RC1: 63 discovered, 58 passed, 5 credential-dependent tests skipped, no failures. New handler tests inspect the recording span before stop/export, verify type-only events, raw-error policy, non-AI observation behavior, and prevention of sensitive error tags being recorded during stop.
  • New handler and chat-wrapper unit suites against the 1.1.0 runtime: 20 passed. The SDK remains compiled against 1.1.8 as before; the complete installed-JAR consumer exercises the 1.1.0 binary-compatibility floor.
  • Java core: 37 passed.
  • python3 .github/release/release_plan.py --check: 129 packages consistent.
  • git diff --check: passed. Branch contains current origin/dev (normal merge reported already up to date).

Scope and rollout

Existing constructors remain available; no version bumps, registry publication, merge, or external docs publication. Native users must adopt the documented replacement handler alongside the filter. Privacy applies to these AI spans, not application logs or independently instrumented HTTP-client spans. UNSET intentionally means unknown/incomplete, not confirmed success or a guessed provider failure.

🤖 Generated with Claude Code

nik13 and others added 2 commits November 1, 2026 23:16
Replace the generic native handler with a maintained OpenTelemetry handler that records type-only errors under FI_HIDE_ERROR_DETAILS and preserves unknown outcomes when no completed chat response is available. Resolve wrapper request metadata from defaults plus overrides, without substituting response models. Add real-SDK and Boot wire regressions through Spring AI 2.1.0-RC1.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Apply error privacy and completion-aware status to native ChatClient and advisor observations. Preserve optional client linkage for model-only consumers and cover errors, timeout, cancellation, completed requests, and stop-time tags across the supported runtime matrix.

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
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