fix sync on oss side (#4797)

This commit is contained in:
Shuchang Zheng
2026-02-18 15:41:33 -08:00
committed by GitHub
parent bf92eea8ea
commit da175fee70
3 changed files with 27 additions and 17 deletions

View File

@@ -5,6 +5,8 @@ from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import Any
from skyvern import analytics
class ErrorCode:
NO_ACTIVE_BROWSER = "NO_ACTIVE_BROWSER"
@@ -63,6 +65,19 @@ def make_result(
warnings: list[str] | None = None,
error: dict[str, Any] | None = None,
) -> dict[str, Any]:
analytics.capture(
"mcp_tool_call",
data={
**analytics.analytics_metadata(),
"tool": action,
"ok": ok,
# "total" is set by Timer.__exit__; None for early-return paths before Timer starts
"timing_ms": (timing_ms or {}).get("total"),
"error_code": error.get("code") if error else None,
"browser_mode": browser_context.mode if browser_context else None,
"session_id": browser_context.session_id if browser_context else None,
},
)
return {
"ok": ok,
"action": action,