feat(session): 落成事件出口,五个接缝全部有调用点
Event 从零字段变成 kind + run_id + model_binding + step,新增 EventKind(只有一种取值, 但第一天就带 kind,逼每个出口分发)。事件在「一步走完」原子落地之后发,只有这次进程里 真的执行过的步才发;投递失败接住、计数进 RunResult、继续跑,CancelledError 原样穿过。 契约套件那两条 xfail 关掉:一条要断言的是库发了几次、接缝自己看不到;另一条的前提是错的 ——审计纪律由意图日志承担不由事件流承担,改成在 unit 层验日志里原文与改写后的文本各有 位置。_project_observation 那段说「将来靠事件流送出去」的注释一并改对。 283 passed / 15 skipped / 2 xfailed,剩下两条 xfail 是原子写与前缀持久性,没有机器兜底。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ from collections.abc import Mapping
|
||||
|
||||
import pytest
|
||||
|
||||
from polyloop.ports import Action, Event, ToolCall
|
||||
from polyloop.ports import Action, Event, EventKind, ToolCall
|
||||
from polyloop.stores import JsonlRunStore
|
||||
from polyloop.types import (
|
||||
ActionOutcome,
|
||||
@@ -155,8 +155,13 @@ class _Records:
|
||||
tool_call=None if tool_name is None else ToolCall(name=tool_name, arguments={}),
|
||||
)
|
||||
|
||||
def event(self) -> Event:
|
||||
return Event()
|
||||
def event(self, *, run_id: str = "run-1", step_idx: int = 0) -> Event:
|
||||
return Event(
|
||||
kind=EventKind.STEP_FINISHED,
|
||||
run_id=run_id,
|
||||
model_binding={"item": "a"},
|
||||
step=self.step(step_idx=step_idx),
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user