Normalize Glas execution evidence
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a028de-e2c8-7732-8521-46a7fc5db82f
This commit is contained in:
parent
b933cf52c8
commit
7e81545b24
13 changed files with 528 additions and 33 deletions
|
|
@ -225,6 +225,47 @@ async def test_claim_and_complete_roundtrip(monkeypatch: pytest.MonkeyPatch) ->
|
|||
assert open_run.result["path"] == "briefs/x.md"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_complete_persists_only_normalized_glas_evidence() -> None:
|
||||
from activity_core import ops_run_queue as oq
|
||||
|
||||
row = MagicMock()
|
||||
row.state = "claimed"
|
||||
row.claim_owner = "worker-1"
|
||||
row.result = {}
|
||||
session = AsyncMock()
|
||||
session.get = AsyncMock(return_value=row)
|
||||
|
||||
done = await oq.complete_ops_run(
|
||||
session,
|
||||
uuid.uuid4(),
|
||||
worker_id="worker-1",
|
||||
result={
|
||||
"ok": True,
|
||||
"evidence": {
|
||||
"request_id": "request-1",
|
||||
"profile_ref": "harness.agent-dev@1.0.0",
|
||||
"rein_id": "rein-aharness",
|
||||
"outcome": "succeeded",
|
||||
"duration_s": 0,
|
||||
},
|
||||
"tool_output": "must not persist",
|
||||
},
|
||||
)
|
||||
|
||||
assert done is row
|
||||
assert row.result == {
|
||||
"ok": True,
|
||||
"execution_evidence": {
|
||||
"request_id": "request-1",
|
||||
"profile_ref": "harness.agent-dev@1.0.0",
|
||||
"rein_id": "rein-aharness",
|
||||
"outcome": "succeeded",
|
||||
"duration_s": 0,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_fail_reopen_under_max_attempts(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
from activity_core import ops_run_queue as oq
|
||||
|
|
@ -268,6 +309,44 @@ async def test_fail_permanent_at_max_attempts(monkeypatch: pytest.MonkeyPatch) -
|
|||
assert row.state == "failed"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_fail_persists_redacted_failure_evidence() -> None:
|
||||
from activity_core import ops_run_queue as oq
|
||||
|
||||
row = MagicMock()
|
||||
row.state = "claimed"
|
||||
row.claim_owner = "worker-1"
|
||||
row.attempt = 1
|
||||
row.result = {}
|
||||
session = AsyncMock()
|
||||
session.get = AsyncMock(return_value=row)
|
||||
|
||||
failed = await oq.fail_ops_run(
|
||||
session,
|
||||
uuid.uuid4(),
|
||||
worker_id="worker-1",
|
||||
error="execution refused",
|
||||
result={
|
||||
"ok": False,
|
||||
"evidence": {
|
||||
"request_id": "request-failed",
|
||||
"profile_ref": "harness.agent-dev@1.0.0",
|
||||
"rein_id": "rein-aharness",
|
||||
"outcome": "failed",
|
||||
"failure_stage": "execution",
|
||||
"error": "execution failed; inspect direct caller error",
|
||||
"duration_s": 3.5,
|
||||
},
|
||||
"tool_error": "raw provider failure must not persist",
|
||||
},
|
||||
)
|
||||
|
||||
assert failed is row
|
||||
assert row.result["error"] == "execution refused"
|
||||
assert row.result["execution_evidence"]["failure_stage"] == "execution"
|
||||
assert "tool_error" not in row.result
|
||||
|
||||
|
||||
def test_label_filter_any_vs_all() -> None:
|
||||
"""Document labels_mode semantics used by claim_ops_runs."""
|
||||
row_labels = {"automated", "research-brief"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue