feat(logging): unify canonical task CoT events

This commit is contained in:
2026-08-24 17:00:17 +03:00
parent 511219e3e0
commit 0c895cf416
32 changed files with 741 additions and 321 deletions

View File

@@ -140,7 +140,7 @@ class TestExtractErrorContext:
from src.core.task_manager.models import LogEntry
task = _make_task(
result={"other": "data"},
logs=[LogEntry(level="ERROR", message="Critical failure in module X")],
logs=[LogEntry(level="ERROR", trace_id="trace", src="plugin", marker="EXPLORE", intent="Critical failure in module X", error="Critical failure in module X")],
)
ctx = extract_error_context(task, ReportStatus.FAILED)
assert ctx is not None
@@ -285,7 +285,7 @@ class TestExtractErrorContextLogFallback:
from src.core.task_manager.models import LogEntry
task = _make_task(
result={"other": "data"},
logs=[LogEntry(level="Error", message="cased error")],
logs=[LogEntry(level="Error", trace_id="trace", src="plugin", marker="EXPLORE", intent="cased error", error="cased error")],
)
ctx = extract_error_context(task, ReportStatus.FAILED)
assert ctx is not None
@@ -298,9 +298,9 @@ class TestExtractErrorContextLogFallback:
task = _make_task(
result={"other": "data"},
logs=[
LogEntry(level="ERROR", message="first error"),
LogEntry(level="INFO", message="noise"),
LogEntry(level="ERROR", message="last error"),
LogEntry(level="ERROR", trace_id="trace", src="plugin", marker="EXPLORE", intent="first error", error="first error"),
LogEntry(level="INFO", trace_id="trace", src="plugin", marker="REASON", intent="noise"),
LogEntry(level="ERROR", trace_id="trace", src="plugin", marker="EXPLORE", intent="last error", error="last error"),
],
)
ctx = extract_error_context(task, ReportStatus.FAILED)
@@ -313,7 +313,7 @@ class TestExtractErrorContextLogFallback:
from src.core.task_manager.models import LogEntry
task = _make_task(
result={"error": {"message": "", "code": "E1"}},
logs=[LogEntry(level="ERROR", message="log fallback hit")],
logs=[LogEntry(level="ERROR", trace_id="trace", src="plugin", marker="EXPLORE", intent="log fallback hit", error="log fallback hit")],
)
ctx = extract_error_context(task, ReportStatus.FAILED)
assert ctx is not None