FunctionManager silently drops tool modules containing dataclasses with postponed annotations
評価
調査の方向性
Start with utils/function_manager.py and reproduce the temporary tool module containing postponed annotations and a dataclass. Run python reproduce.py --fetch --case chatdev-dataclass-tools --variant after from the linked bundle to inspect the seven regression and control tests. Done means increment is available and failed imports clean up or restore module state while existing filtering remains intact.
索引モデルが issue の本文から書いたものです。
説明
Problem
The dynamic loader creates a module with module_from_spec() and executes it without inserting it into sys.modules. A tool file containing from __future__ import annotations and a dataclass then fails during class creation, because the dataclass decorator needs to resolve the defining module.
FunctionManager catches the import failure and omits the module's functions, so otherwise valid agent tools become unavailable.
Reproduction
import tempfile
from pathlib import Path
from utils.function_manager import FunctionManager
with tempfile.TemporaryDirectory() as directory:
path = Path(directory) / 'example.py'
path.write_text('''from __future__ import annotations
from dataclasses import dataclass
@dataclass
class Payload:
value: int
def increment(value: int) -> int:
return Payload(value).value + 1
''', encoding='utf-8')
manager = FunctionManager(Path(directory))
print(manager.has_function('increment')) # Actual: False; expected: True
print(manager.call_function('increment', 41)) # Expected: 42
Proposed change
Register the new module in sys.modules[module_name] before exec_module(). On an import failure, remove the partially initialized module or restore the previous entry, then re-raise into the existing loader error handling. This follows normal import semantics while preserving the current filtering of private and imported functions.
Validation
Source: utils/function_manager.py, current blob 50de030442ec72e8293482320cc37072367c86cd.
Before: 4 failed, 3 passed. After: 7 passed. The complete FunctionManager module was run against real temporary tool files, including postponed-annotation dataclasses, self-referential annotations, ordinary tools, imported/private function filtering, failed-import cleanup, and restoration after a failed reload.
Python 3.13.5, pytest 9.0.2, Linux. No provider calls or full workflow execution were run. Searches for FunctionManager issues and dataclass-related PRs found memory-store additions, not this dynamic-import failure.
Patch and tests
Source-pinned patch and seven regression/control tests. From the bundle root, run python reproduce.py --fetch --case chatdev-dataclass-tools --variant after. The runner verifies the source hash and patch application before executing the tests.
- 主要言語
- Python
- スター
- 34.5k
- フォーク
- 4.3k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenBMB/ChatDev のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
-
CodeReviewModification never shows the programmer the six review regulations, so fixes are made blind to the checklist they are re-reviewed against対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
OpenBMB/ChatDev の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sierra-research/tau2-bench#635 ·
メンテナーはふだん 1 日以内に返信
-
The add-ssm-model skill requires a Cython simulator; the contributing guide allows Python ones対応中かも @fmuia が今日担当しました。 オープンdocumentation skill
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
lnccbrown/ssm-simulators#406 ·
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
btclib-org/btclib-ecc#309 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
jbacalso24/mimry#459 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] POST /revoke with a FastMCP access token is a silent no-op (ownership gate never matches)オープンauth bug high-priority
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信