getsentry / getsentry/sentry-javascript

AI integration deep proxies return new function references on every property access

オープン
#22,355 コメント 5 件 リアクション 2 件 担当者 0 名 GitHub で見る
agents javascript Task Tech Debt Type: Improvement
主要言語
TypeScript
スター
8.7k
フォーク
1.8k
平均マージ
1日 17時間
マージ済み PR(30日)
523

説明

The `get` trap in AI integration deep proxies always returns a different value instead of memoizing bound/instrumented methods.

For example, `console.log(ai.run === ai.run)` prints `false` because each access creates a new function via `instrumentMethod(...)` or `value.bind(obj)`.

This pattern exists across multiple AI integrations:

- `packages/core/src/tracing/openai/index.ts` (`createDeepProxy`)
- `packages/core/src/tracing/anthropic-ai/index.ts` (`createDeepProxy`)
- `packages/core/src/tracing/google-genai/index.ts` (`createDeepProxy`)

Suggested fix: keep a `Map` in the closure to store bound/instrumented methods, rather than creating a new value on every `get`.

> Originally posted by @isaacs in https://github.com/getsentry/sentry-javascript/pull/22119#discussion_r3581015061

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start at createDeepProxy in packages/core/src/tracing/openai/index.ts, packages/core/src/tracing/anthropic-ai/index.ts, and packages/core/src/tracing/google-genai/index.ts. Trace the get trap and the instrumentMethod or bind paths, then verify that repeated access to the same method returns the same reference while preserving instrumentation behavior.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
observability
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。