Skip to content

refactor(core): Enhance error redaction and factory initialization - #813

Merged
haiphucnguyen merged 3 commits into
mainfrom
feature/improvements
Nov 10, 2026
Merged

haiphucnguyen merged 3 commits into
mainfrom
feature/improvements

Conversation

@haiphucnguyen

Copy link
Copy Markdown
Collaborator

⚠️ First-time contributor? This PR cannot be merged until you sign the CLA.
The CLA Assistant bot will post a comment below — reply to it with exactly:
I have read the CLA Document and I hereby sign the CLA
(Separate from this: all commits must also be signed off with git commit -s — see the Checklist.)

Summary

Related Issue(s)

  • Improves redactErrorText to preserve plain exception class names by restricting redaction to tokens containing digits.
  • Updates OpenAI compatible model factories to pass settings context when initializing telemetry listeners.
  • Provides more specific telemetry provider keys based on model templates where applicable.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation
  • ♻️ Refactor (no functional change)
  • 🧪 Tests
  • 🔧 Chore / tooling / CI

What Changed & Why

How to Test

./gradlew test

Screenshots / Recordings (if applicable)

Checklist

  • I have read the CONTRIBUTING guide
  • I signed the CLA (first-time contributors — reply to the CLA Assistant bot comment)
  • My branch is up to date with main
  • I ran ./gradlew spotlessApply and ./gradlew detekt locally
  • I ran ./gradlew test and all tests pass
  • I added/updated tests for my changes (if applicable)
  • I added/updated documentation (if applicable)
  • My commits are signed off (DCO) — git commit -s
  • This PR is focused on a single feature/fix

Additional Notes

- Improves `redactErrorText` to preserve plain exception class names by restricting redaction to tokens containing digits.
- Updates OpenAI compatible model factories to pass settings context when initializing telemetry listeners.
- Provides more specific telemetry provider keys based on model templates where applicable.

BREAKING CHANGE: The `redactErrorText` function now uses a more precise regex, ensuring that exception class names are preserved during error reporting, as redaction is only applied to opaque tokens containing digits.
Copilot AI lite review requested due to automatic review settings November 10, 2026 05:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The change still exposes digitless secrets or opaque identifiers and breaks template-specific provider reporting because its key format is incompatible with existing telemetry consumers.

2 open issues
What changed in this PR

This pull request refines error redaction and makes OpenAI-compatible telemetry initialization aware of provider settings and model templates.

Changes:

  • Updates error-text redaction and adds regression coverage for exception class names.
  • Passes provider settings into telemetry listener creation.
  • Adds template-specific telemetry provider keys.
File Description
shared-jvm/​src/​test/​kotlin/​io/​askimo/​core/​util/​TextUtilsTest.kt Adds regression tests covering preservation of exception class names during error redaction.
shared-jvm/​src/​main/​kotlin/​io/​askimo/​core/​util/​TextUtils.kt Updates bare-token error redaction behavior.
shared-jvm/​src/​main/​kotlin/​io/​askimo/​core/​providers/​openaicompatible/​OpenAiCompatibleModelFactory.kt Adds template-aware telemetry provider keys and passes provider settings to listeners.
shared-jvm/​src/​main/​kotlin/​io/​askimo/​core/​providers/​openaicompatible/​OpenAiCompatibleChatModelFactory.kt Extends telemetry listener initialization to receive provider settings.

Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Approval is blocked by a critical source/binary compatibility break in the public factory hook, compounded by redaction behavior that can leave secret-shaped tokens exposed.

3 open issues
2 resolved since last review

Review effort: Lite

.replace(Regex("""(?:[A-Za-z]:\\|/)[\w./\\-]{3,}"""), "[path]")
.replace(Regex("""\b[A-Za-z0-9_-]{16,}\b"""), "[id]")
// Bare opaque tokens are redacted, except PascalCase ...Exception/...Error names.
.replace(Regex("""\b(?!(?:[A-Z][A-Za-z]+(?:Exception|Error))\b)[A-Za-z0-9_-]{16,}\b"""), "[id]")
@haiphucnguyen
haiphucnguyen merged commit 2a40dc0 into main Nov 10, 2026
14 checks passed
@haiphucnguyen
haiphucnguyen deleted the feature/improvements branch November 11, 2026 04:31
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.

2 participants