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
|
|
@ -15,6 +15,7 @@ from urllib.parse import quote
|
|||
from sqlalchemy import Select, select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from activity_core.glas_evidence import normalise_ops_result
|
||||
from activity_core.orm import ActivityRun, OpsRun, TaskSpawnLog
|
||||
|
||||
# Default public Forgejo web base (no trailing slash). Override with FORGEJO_WEB_BASE.
|
||||
|
|
@ -136,13 +137,33 @@ def artifacts_from_ops_result(
|
|||
|
||||
|
||||
def _ops_summary(row: OpsRun) -> dict[str, Any]:
|
||||
result = dict(row.result or {})
|
||||
# Drop bulky keys if ever present
|
||||
for bad in ("prompt", "raw_output", "messages", "token"):
|
||||
result.pop(bad, None)
|
||||
# Normalize again on read so historic rows cannot leak pre-allowlist blobs.
|
||||
result = normalise_ops_result(row.result)
|
||||
artifacts = artifacts_from_ops_result(
|
||||
result, target_repo=row.target_repo, title=row.title
|
||||
)
|
||||
execution_evidence = dict(result.get("execution_evidence") or {})
|
||||
compact_result = {
|
||||
k: result[k]
|
||||
for k in (
|
||||
"ok",
|
||||
"approach",
|
||||
"path",
|
||||
"date",
|
||||
"wrote",
|
||||
"committed",
|
||||
"pushed",
|
||||
"skipped_existing",
|
||||
"head_after",
|
||||
"target_repo",
|
||||
"collection_candidates",
|
||||
"reason",
|
||||
"error",
|
||||
)
|
||||
if k in result
|
||||
}
|
||||
if execution_evidence:
|
||||
compact_result["execution_evidence"] = execution_evidence
|
||||
return {
|
||||
"id": str(row.id),
|
||||
"state": row.state,
|
||||
|
|
@ -155,26 +176,10 @@ def _ops_summary(row: OpsRun) -> dict[str, Any]:
|
|||
"approach_hint": row.approach_hint,
|
||||
"harness_profile_ref": row.harness_profile_ref,
|
||||
"execution_refs": dict(row.execution_refs or {}),
|
||||
"execution_evidence": execution_evidence,
|
||||
"created_at": row.created_at.isoformat() if row.created_at else None,
|
||||
"updated_at": row.updated_at.isoformat() if row.updated_at else None,
|
||||
"result": {
|
||||
k: result[k]
|
||||
for k in (
|
||||
"ok",
|
||||
"approach",
|
||||
"path",
|
||||
"date",
|
||||
"wrote",
|
||||
"committed",
|
||||
"pushed",
|
||||
"skipped_existing",
|
||||
"head_after",
|
||||
"target_repo",
|
||||
"collection_candidates",
|
||||
"reason",
|
||||
)
|
||||
if k in result
|
||||
},
|
||||
"result": compact_result,
|
||||
"artifacts": artifacts,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue