From 55e2a4d037d2364b725426af0057f4ab0ba88c32 Mon Sep 17 00:00:00 2001 From: Nikolay Gusev Date: Sat, 21 Nov 2026 20:30:41 +0300 Subject: [PATCH] agent: state on the tools that traffic binding is off when the switch is off MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With agent_traffic_binding disabled (the default) findingWorkflowTools strips bind_finding_traffic from every agent toolset and removes traffic_refs / evidence_hint_id from the report_finding and hint schemas, but the tool descriptions keep promising the binding path: prove_goal says a finding closes a goal once a traffic_ref is bound, and the report_finding error path says already-registered findings can be bound later via bind_finding_traffic. An agent then chases a tool that is not in its toolset. Observed on a live run (v0.7.0, local OpenAI-compatible model): a worker spent minutes on it — "the tool bind_finding_traffic must be invoked as a tool", a bare Bash true, then grepping the transcripts and the strings of the binary. The task registered findings with poe_level 3, zero bound traffic, and closed no goal; a run with the switch on bound traffic and closed 4 of 6 goals. Fix: attach binding-off notes to the same tools the capture-off notes ride on (report_finding, add_hint / add_task_hint, prove_goal) in the disabled branch, so the standing guidance stays empty — the contract the PG test asserts — while the agent is told the tool and the parameters are absent, that findings stay unverified, and that an operator can enable binding or bind manually. Test: agent/finding_workflow_test.go asserts the notes exist on the tools and name the absent tool; red on the planted break, green with the fix. Verified against the PostgreSQL-dependent server test that CI runs (TestFindingWorkflowAutoHintToPlannerAndSetting) and go test ./agent/ ./server/. --- agent/finding_workflow.go | 34 ++++++++++++++++++++++++++++++++++ agent/finding_workflow_test.go | 23 +++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/agent/finding_workflow.go b/agent/finding_workflow.go index 5362a26..a44a689 100644 --- a/agent/finding_workflow.go +++ b/agent/finding_workflow.go @@ -87,6 +87,33 @@ func trafficCaptureOffToolNote(toolName string, captureOff bool) string { } } +// Automatic traffic binding off is a DIFFERENT switch from capture off: capture +// can be on while binding is off, and then the disabled branch below strips +// bind_finding_traffic and every traffic parameter from the schemas while the +// tool descriptions keep promising the binding path. An agent then chases a tool +// that is not in its toolset (observed: "the tool bind_finding_traffic must be +// invoked as a tool", a bare Bash true, then grepping the transcripts and the +// binary). These notes ride on the tool descriptions, exactly like the capture +// notes above, so the standing guidance stays empty when the feature is off. +const ( + findingBindingOffProveGoalNote = "\nNote: automatic traffic binding is OFF on this server, so a finding cannot be bound to captured traffic here and cannot close an HTTP goal. Recorded findings stay visible; non-HTTP goals still close with an observed tool_output fact. An operator can enable binding (System settings) or bind captured traffic manually on the finding page, after which a bound finding closes the goal." + findingBindingOffReportFindingNote = "\nNote: automatic traffic binding is OFF on this server, so report_finding carries no traffic parameters and the bind_finding_traffic tool is not in your toolset. Findings still save with their evidence, but stay unverified and cannot prove a goal. Register a reproducible PoC in evidence as usual; do not guess traffic IDs and do not re-probe only to capture packets." + findingBindingOffHintNote = "\nNote: automatic traffic binding is OFF on this server, so hint traffic parameters are not in this schema. Keep the verified evidence and the known real traffic IDs in the hint text; the receiving task registers the finding and the operator can bind captured traffic later." +) + +func findingBindingOffToolNote(toolName string) string { + switch toolName { + case "prove_goal": + return findingBindingOffProveGoalNote + case "report_finding": + return findingBindingOffReportFindingNote + case "add_hint", "add_task_hint": + return findingBindingOffHintNote + default: + return "" + } +} + // Applied after ToolResolve: user descriptions and prompts remain intact, while // all actual reporters (including Planner and custom chat agents) see the same // API contract. Disabled/unbound tools are never reintroduced here. @@ -119,11 +146,18 @@ func findingWorkflowTools(agentKey string, tools []actool.CoreTool) ([]actool.Co desc += note decorated = true } + if note := findingBindingOffToolNote(tool.Name()); note != "" { + desc += note + decorated = true + } if decorated { tool = DecorateTool(tool, desc, schema) } out = append(out, tool) } + // The standing guidance stays empty: the binding-off notes ride on the + // tool descriptions, so a disabled deployment keeps the same contract the + // PG test asserts (def.FindingGuidance == ""). return out, "" } out := append([]actool.CoreTool(nil), tools...) diff --git a/agent/finding_workflow_test.go b/agent/finding_workflow_test.go index ba8fa76..693bd4d 100644 --- a/agent/finding_workflow_test.go +++ b/agent/finding_workflow_test.go @@ -39,6 +39,29 @@ func TestFindingWorkflowSharedAssemblyAndSwitch(t *testing.T) { if strings.Contains(system[0], "traffic_refs") != on { t.Fatalf("%s: guidance ignored switch: %v", role, on) } + if !on { + // The switch strips the tool and the schema, so the tool descriptions + // must say so: otherwise the agent chases bind_finding_traffic, which + // is not in its toolset, and burns turns on it. + if def.FindingGuidance != "" { + t.Fatalf("%s: disabled deployment must keep the standing guidance empty, got %q", role, def.FindingGuidance) + } + noted := false + for _, tool := range out { + if !strings.Contains(tool.Description(), "automatic traffic binding is OFF") { + continue + } + noted = true + // The tool that carries traffic parameters is the one whose + // schema lost them, so it must name the absent tool. + if tool.Name() == "report_finding" && !strings.Contains(tool.Description(), "bind_finding_traffic") { + t.Fatalf("%s: report_finding note must name the absent tool", role) + } + } + if !noted { + t.Fatalf("%s: disabled deployment must state on the tools that binding is off", role) + } + } if on && (!strings.Contains(system[0], "TCP") || !strings.Contains(system[0], "evidence_hint_id")) { t.Fatal("missing optional/handoff contract") }