mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-15 16:14:16 +00:00
Trace unexecuted tool calls in one place; tidy span lifecycles
Paused, denied, skipped and client-run tool calls all go through trace_unexecuted_tool_call. The research synthesis, continuation and workflow step spans use with-blocks instead of hand-rolled GeneratorExit handling. Fixes blank lines and adds a missing hint and docstrings.
This commit is contained in:
1 parent
b3aa509d3a
commit
a74420ed2c
7 files changed
+38
-54
No files matched your search
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
from threading import Thread
|
||||
from time import monotonic
|
||||
from typing import List, Optional
|
||||
from typing import Any, List, Optional, Sequence
|
||||
|
||||
from docsgpt import tracing
|
||||
from docsgpt.guardrails.base import ScanContext
|
||||
@@ -27,7 +27,8 @@ logger = logging.getLogger(__name__)
|
||||
_MAX_WORKERS = 8
|
||||
|
||||
|
||||
def _start_guardrail_span(stage: Stage, controls) -> "tracing.Span":
|
||||
def _start_guardrail_span(stage: Stage, controls: Sequence[Any]) -> "tracing.Span":
|
||||
"""Open a ``guardrail`` span for evaluating ``controls`` at ``stage``."""
|
||||
return tracing.start_span(
|
||||
tracing.KIND_GUARDRAIL,
|
||||
f"guardrail {stage.value}",
|
||||
@@ -39,6 +40,7 @@ def _start_guardrail_span(stage: Stage, controls) -> "tracing.Span":
|
||||
|
||||
|
||||
def _content_fired(decision: StageDecision) -> bool:
|
||||
"""True when a check matched, or the text was blocked or redacted."""
|
||||
return bool(decision.triggered or decision.blocked or decision.redacted)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user