Adapter function metrics record success for contract-level IOContract mismatches
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Start with mellea/stdlib/components/intrinsic/_util.py at call_intrinsic, then compare the invocation-completion handling in adapter.py and the Embedded/Granite formatter closures added in PR #1609. Trace both the embedded and local_file paths, including how synchronous code dispatches async hooks. Done means contract-level output mismatches are recorded as failures, valid outputs as successes, and each invocation fires exactly once.
索引モデルが issue の本文から書いたものです。
説明
Summary
mellea.adapter_function.invocations/.parse_failures mis-record one class of failure for adapter functions called through call_intrinsic: a contract-level IOContract mismatch on output that is valid JSON.
Background
PR #1609 (issue #1560) wired adapter_function_invocation_complete firing for the Embedded/Granite Switch binding. It fires the outcome once each backend's granite_formatters_processing closure resolves — success if the response parses as JSON, schema_error if it doesn't, error otherwise.
That closure runs before call_intrinsic (mellea/stdlib/components/intrinsic/_util.py:171) calls adapter.io_contract.parse(result_str) — the actual contract check (required fields, types, shape). So when a response is syntactically valid JSON but fails that contract check, AdapterSchemaMismatchError is raised to the caller — but the invocation was already recorded as outcome="success".
Impact
- The caller is unaffected:
AdapterSchemaMismatchErrorpropagates uncaught through every wrapper (rag.py,core.py,guardian.py) straight to application code. No silent failures. - The metric is wrong:
.parse_failuresundercounts this specific failure mode, and.invocations{outcome="success"}overcounts it. A model that drifted into returning valid-but-wrong-shape JSON would look 100% healthy on a dashboard built from these metrics while every call actually fails downstream. - Scope is narrow: only applies to output that's valid JSON but violates the adapter's declared schema — not malformed JSON (already
schema_error) and not a generation/network failure (alreadyerror). - Applies to
local_file/PEFT too, not justembedded—AdapterMixin.adapter_scope's outcome closes at generation return, before parsing or contract validation ever run, so this binding never records anything for this failure mode either.
Proposed fix
Move (or add) the invocation-complete fire point into call_intrinsic, after io_contract.parse() resolves, so the recorded outcome reflects contract validation too. Complications:
call_intrinsicis shared by both bindings — this needs handling that's correct forlocal_fileas well asembedded, not an embedded-only patch.call_intrinsicis synchronous; hook dispatch (invoke_hook) is async. Needs the same sync→async bridgingadapter.py's_fire_invocation_completealready does via_run_async_in_thread— the embedded fire helper introduced in #1609 (_fire_embedded_invocation_complete) deliberately avoids that bridging since it's always called from an already-running coroutine, so this can't just reuse it as-is.- Need to decide whether the backend-level
successfire (in the closures) should be suppressed/deferred entirely in favour of this one, to keep the "fires exactly once per invocation" invariant intact.
cc @ajbozarth
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 161
- 平均マージ
- 4日 3時間
- マージ済み PR(30日)
- 45
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
generative-computing/mellea のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
generative-computing/mellea#1864 ·
メンテナーはふだん 3 日以内に返信
-
bug: instruct() and react() replay tool-call turns without tool_calls対応中かも @simonyang08 が 21 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
generative-computing/mellea#1784 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
Silently mangled docstrings: lone backslash line-continuations in non-raw docstrings collapse command examples対応中かも @madhusudhan1260 が 18 日前に担当しました。 オープンgood first issue p2
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
generative-computing/mellea#1780 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
area/telemetry enhancement p2
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
generative-computing/mellea#1210 ·
メンテナーはふだん 3 日以内に返信
-
area/requirement area/stdlib enhancement p2
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
generative-computing/mellea#31 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
generative-computing/mellea の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
OpenFreeEnergy/openfe#2371 ·
メンテナーはふだん 2 日以内に返信
-
HMDB's smiles file writes "None" for metabolites with an empty <smiles/> (file not currently used)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
NCATSTranslator/Babel#1269 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
404 on sample dataオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
bcgov/nr-hydrometric-rating-curve#443 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100