From 25217afdce675c77060134bd27d28782a758265d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0=B0=D0=B9=20=D0=93=D1=83?= =?UTF-8?q?=D1=81=D0=B5=D0=B2?= Date: Sat, 21 Nov 2026 21:11:31 +0300 Subject: [PATCH] refactor(agent): remove unused finding traffic guidance --- agent/finding_recorder.go | 4 ---- agent/finding_recorder_source_test.go | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 agent/finding_recorder_source_test.go diff --git a/agent/finding_recorder.go b/agent/finding_recorder.go index eed68d2..f5368f1 100644 --- a/agent/finding_recorder.go +++ b/agent/finding_recorder.go @@ -20,10 +20,6 @@ type TrafficCaptureChecker interface { TrafficExists(ctx context.Context, trafficID string) (bool, error) } -// Tool-use guidance is appended without replacing the user's editable prompt. -// It does not require capture or claim that unavailable traffic tools exist. -const findingTrafficGuidance = "\n\n**Vulnerability traffic evidence**: when reporting a vulnerability via report_finding, bind real HTTP request/response IDs via traffic_refs in reproduction order; domains and times are only candidate filters and do not imply association. A finding without bound traffic stays recorded and visible, but cannot close a goal via prove_goal until verified traffic matching its asset host is bound (via report_finding or bind_finding_traffic). For TCP and other non-HTTP vulnerabilities, when nothing was captured, or when there is no exact match, omit traffic_refs or pass [], keep verifiable command output and logs in evidence, and close non-HTTP goals with an observed tool_output fact. Do not guess IDs, and do not re-probe just to capture packets." - func (t *ToolSet) SetFindingRecorder(r FindingRecorder) { t.findingRecorder = r } func (w *Worker) SetFindingRecorder(r FindingRecorder) { w.findingRecorder = r } func (p *Planner) SetFindingRecorder(r FindingRecorder) { p.findingRecorder = r } diff --git a/agent/finding_recorder_source_test.go b/agent/finding_recorder_source_test.go new file mode 100644 index 0000000..71ab6d9 --- /dev/null +++ b/agent/finding_recorder_source_test.go @@ -0,0 +1,26 @@ +package agent + +import ( + "go/ast" + "go/parser" + "go/token" + "testing" +) + +func TestFindingRecorderHasNoLegacyTrafficGuidance(t *testing.T) { + // Check the declaration directly: an unused constant cannot affect prompt output. + f, err := parser.ParseFile(token.NewFileSet(), "finding_recorder.go", nil, parser.SkipObjectResolution) + if err != nil { + t.Fatal(err) + } + ast.Inspect(f, func(n ast.Node) bool { + if spec, ok := n.(*ast.ValueSpec); ok { + for _, name := range spec.Names { + if name.Name == "findingTrafficGuidance" { + t.Fatal("finding_recorder.go declares the obsolete findingTrafficGuidance constant") + } + } + } + return true + }) +}