From 6ec67f61f9c2ca63ed5fc66b56f46ea800da6eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20Nu=C3=B1ez?= Date: Sun, 9 Aug 2026 10:57:31 -0400 Subject: [PATCH] docs+fix: README states toolCallId pairing; catch SIGTERM as documented The tool_calls evaluator already pairs by toolCallId authoritatively (with a name/FIFO fallback only when a result has no id), matching the schema, the trace docs, and the id-pairing tests. Only the README still described the fallback as the primary mechanism ("by tool name, in order"); update it to lead with the id. Also, main registered only os.Interrupt while its comment claimed "SIGINT or SIGTERM". Register syscall.SIGTERM too so the comment is accurate and a SIGTERM (the default kill/orchestrator stop signal on Unix) actually cancels an in-flight run, notably the network-bound LLM judge. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 6 ++++-- cmd/trazo/main.go | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe1b76f..fb64828 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,10 @@ Every finding carries one judgment (`evaluator/Evaluator.go`): - `trajectory/` — the `Run`/`Step` model, the JSON loader, and `Validate()` (structural invariants: ids, timestamps, per-type required fields). - `evaluator/` — the `Evaluator` interface and the evaluators: - - `tool_calls` — pairs tool calls with results (by tool name, in order) and - flags orphans (neutral) and tool errors (bad). + - `tool_calls` — pairs each tool result with its call by `toolCallId` when + present (authoritative, order-independent), falling back to tool name in FIFO + order only when a result carries no id; flags orphans (neutral) and tool + errors (bad). - `loops` — flags repetition (same tool plus identical input, or same node) at least `MaxRepeats` times; catches runaways the pairing check cannot see. - `cost_latency` — flags per-step and whole-run cost/latency budget breaches diff --git a/cmd/trazo/main.go b/cmd/trazo/main.go index 6f14639..7f7613c 100644 --- a/cmd/trazo/main.go +++ b/cmd/trazo/main.go @@ -8,6 +8,7 @@ import ( "os" "os/signal" "strings" + "syscall" "time" "github.com/Cro22/trazo/config" @@ -141,7 +142,7 @@ func main() { // Cancel in-flight evaluation on Ctrl+C (SIGINT) or SIGTERM so a long run, // notably one using the network-bound LLM judge, stops promptly. - ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) + ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) defer stop() start := time.Now()