fix(extension): inject_executor 废弃——曾把生信 stage runner 函数塞进扩展 store
根因:get_store() 惰性创建时调用旧 inject_executor,把 context.executor
(生信阶段 runner 执行函数)赋给扩展 store.executor 字段;启动注入真实
执行器时 .inject_real 撞函数对象('function' object has no attribute)。
修复:get_store 不再调;inject_real_executor 一律新建适配器实例注入;
inject_executor 保留空壳兼容。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -956,7 +956,6 @@ def get_store() -> ExtensionStore:
|
||||
base_dir=str(Path(s.extensions_dir_abs)),
|
||||
max_repair_rounds=int(s.extension_max_repair_rounds),
|
||||
)
|
||||
inject_executor(_store)
|
||||
return _store
|
||||
|
||||
|
||||
@@ -969,26 +968,17 @@ def inject_real_executor(real: Any, store: ExtensionStore | None = None) -> None
|
||||
target = store if store is not None else _active_store
|
||||
if target is None:
|
||||
return
|
||||
if target.executor is None:
|
||||
target.executor = ExtensionExecutor()
|
||||
# 无论字段现状如何(旧 inject_executor 可能塞过函数对象),
|
||||
# 一律新建适配器并注入真实执行器——语义唯一入口。
|
||||
target.executor = ExtensionExecutor()
|
||||
target.executor.inject_real(real)
|
||||
|
||||
|
||||
def inject_executor(store: ExtensionStore | None = None) -> None:
|
||||
"""Dev-B 替换点:extension_exec.py 实现后调用本函数注入真执行器。
|
||||
|
||||
executor 为 ExtensionExecutor 实例或可调用对象(协程:
|
||||
execute(ExtensionRunSpec) -> ExtensionRunResult | dict)。
|
||||
"""
|
||||
target = store or get_store()
|
||||
try:
|
||||
from ... import context as context_mod
|
||||
|
||||
executor = context_mod.context.executor
|
||||
if executor is not None:
|
||||
target.executor = executor
|
||||
except Exception: # noqa: BLE001
|
||||
pass
|
||||
"""【已废弃】旧 Dev-A 占位函数——曾把 context.executor(生信 stage runner
|
||||
函数)塞进扩展 store,导致注入真实执行器时 .inject_real 撞函数对象。
|
||||
现语义由 inject_real_executor 承担;本函数保留为空壳兼容旧调用。"""
|
||||
return
|
||||
|
||||
|
||||
def reset_store() -> None:
|
||||
|
||||
Reference in New Issue
Block a user