|
|
@@ -66,6 +66,15 @@ def _messages(root: Path, trace_id: str) -> list[dict[str, Any]]:
|
|
|
|
|
|
|
|
|
def _build_id_for_root(root: Path, root_trace_id: str) -> int | None:
|
|
|
+ meta_path = root / "traces" / root_trace_id / "meta.json"
|
|
|
+ if meta_path.exists():
|
|
|
+ context = _read_json(meta_path).get("context")
|
|
|
+ if isinstance(context, dict):
|
|
|
+ build_id = context.get("script_build_id")
|
|
|
+ if isinstance(build_id, int) and not isinstance(build_id, bool):
|
|
|
+ return build_id
|
|
|
+
|
|
|
+ # Legacy traces may only expose the Build ID through GoalTree or early messages.
|
|
|
goal_path = root / "traces" / root_trace_id / "goal.json"
|
|
|
if goal_path.exists():
|
|
|
match = BUILD_ID_PATTERN.search(str(_read_json(goal_path).get("mission", "")))
|