[bot] OpenAI Responses API `compact()` (server-side conversation compaction) not instrumented

Offen Anfängerfreundlich
#236 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
78/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
ruby
Bereich
observability

Rechercherichtung

Lies zunächst lib/braintrust/contrib/openai/instrumentation/responses.rb und lib/braintrust/contrib/openai/patcher.rb und vergleiche anschließend die vorhandene Instrumentierung für create und stream. Ergänze Tests für den Aufruf von compact über den bestehenden Responses-Patching-Pfad und prüfe die relevanten Tests auf Spans, komprimierte Ausgabe und Tokenverbrauch. Fertig ist es, wenn client.responses.compact(params) einen Trace mit der Eingabe, Ausgabe und dem Tokenverbrauch des Aufrufs erzeugt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

<!-- provider-gap-audit: openai-responses-compact-not-instrumented -->

Summary

The official openai Ruby gem's Responses resource exposes a stable compact method (client.responses.compact(params)) that invokes the model to compact/summarize a long-running conversation and returns an OpenAI::Models::Responses::CompactedResponse. This is a model-execution call — billed, and producing a model-generated summary — not a CRUD/admin operation. It is not instrumented anywhere in this repo: only create and stream are wrapped for the Responses API.

What is missing

  • OpenAI::Resources::Responses#compact is not wrapped by Instrumentation::Responses and is not patched by ResponsesPatcher.
  • No span is created, so a compaction call produces zero trace: no input, no output (the compacted summary), no token usage/cost for the compaction call itself.

Braintrust docs status

supported (in another Braintrust SDK, not Ruby) — https://docs.braintrust.dev/integrations/ai-providers/openai explicitly lists, in the TypeScript SDK's Responses API span table: openai.responses.compact ↔ responses.compact (OpenAI SDK v6.10.0 or later). The same page's Ruby-relevant sections only reference create, parse, and stream variants — compact is absent for Ruby (and for Python/Go/Java/.NET). This is a concrete Ruby-specific parity gap against Braintrust's own TypeScript instrumentation of the identical upstream capability.

Upstream sources

Local repo files inspected

  • lib/braintrust/contrib/openai/instrumentation/responses.rb — Instrumentation::Responses::InstanceMethods defines only create (line 35) and stream (line 59); no compact
  • lib/braintrust/contrib/openai/patcher.rb — ResponsesPatcher#perform_patch (lines 94–111) includes Instrumentation::Responses into ::OpenAI::Resources::Responses/the target's singleton class, but the module itself has no compact wrapper, so calls pass straight to super untraced
  • lib/braintrust/contrib/openai/integration.rb — confirms ResponsesPatcher is the sole patcher registered for the Responses API surface
Vorherrschende Sprache
Ruby
Sterne
9
Forks
11
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
3

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus braintrustdata/braintrust-sdk-ruby

Alle Issues in braintrustdata/braintrust-sdk-ruby

Ähnliche Issues

Weitere Issues zu Ruby

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.