mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-12-04 05:25:56 +00:00
Duplicates are the cheapest way to lose reviewer trust, and the only guard today is
a prompt instruction: the worker is told to check list_findings before registering.
It does not hold — in one run against a deliberately vulnerable app three defect
classes were registered twice each (two SQLi, two IDOR, two admin-endpoint
findings), and one of the pairs differed only in wording.
A decision model answers exactly this kind of closed-list question (same defect as
one of these N findings, or not?) with probabilities and no generated text, so the
judgement costs one small request instead of a main-model turn over a six-figure
context. Measured on our own findings before writing any of this (15 candidates,
hand labels): the correct partner 8/8 on a 27B decider and 7/8 on the flash one,
against 7/15 for the constant "always distinct", at 0.66 s and ~1.7k input tokens
per call with zero output tokens. Repeated calls were stable (30/30 identical).
Changes
- agent/triage.go: TriageClient interface, a /v1/systemone HTTP client, and the pure
pieces (state builder, criteria builder, answer parser, threshold) so the logic is
testable without a server.
- report_finding: consults the client before registering. On a duplicate above the
confidence threshold the finding is not registered again; the caller is told which
finding_id it matched and to extend it with update_finding_report.
- Wiring: agent.SetTriageClient on the worker/planner ToolSets, a triage_profile_id
setting (any llm_profiles row whose base_url serves the decision contract; 0 = off),
exposed through the settings API.
Fail-open, by construction
Triage changes an outcome only when it is confident; every other path behaves exactly
as today: no client, no existing findings, empty summary, transport error, non-200,
malformed body, an id the question never offered, or confidence below the threshold
all fall through to normal registration. A wrong suppression loses evidence, a wrong
registration only costs a row — hence the threshold, and hence "advisory".
Verification
- go test ./agent/ passes, including new tests: request shape (model/state/criteria
carry every candidate), distinct answer, unknown id reads as distinct, probability
fallback when confidence is absent, error on 500, no HTTP call without input, state
cap, threshold boundaries.
- red/green on two independent breakages: forcing the threshold false and accepting
an unoffered id both fail the suite; restored, it passes.
- go test ./server/ shows one failure,
TestManagerSOCKS5UDPOptInAndAssetBlockRuleDropsDatagram (bind 127.0.0.2 —
environment), reproduced on clean main in a separate worktree.
- gofmt -l agent/ server/ clean.
Notes
- The profile must serve /v1/systemone. A chat-only decider endpoint (one that refuses
/v1/chat/completions) needs a thin adapter; a decision endpoint works directly.
- Off by default: with no triage_profile_id the platform behaves as before.
The cap on offered findings is a SELECTION, not "the newest N": with a wide graph
the true partner falls out of a newest-first list, so candidates are ranked by
relevance (same class, overlapping endpoint, another task on a shared asset) with
recency only breaking ties. Per-entry summary capping replaces the whole-state
truncation, which used to cut mid-line and leave criteria ids whose state line had
been dropped.
Threshold is a knob, not a constant (live acceptance): on a run with the wider
cross-task pool the model named the right partner in 8 of 9 questions, but its
confidence moved with the question's width — 0.73-0.79 on a small pool, 0.30-0.53
with twenty candidates. Six duplicates were suppressed, and exactly the two that
slipped were the 0.30 and 0.47 ones, both with the correct partner named. A fixed
0.5 cannot fit both ends, so the threshold is a setting (triage_min_confidence,
default 0.5); the low end is affordable because the suppression result tells the
agent to re-register explicitly when the finding is in fact distinct.
Cross-task pool (found by re-measuring the live miss): task_relations only links
spawned tasks, so two tasks created independently against the same target never see
each other's findings and a defect registered in both is invisible to the dedup
question. FindingsSharingAssets joins on the candidate's own asset ids (jsonb
containment, GIN-served) and adds those findings to the question, marked with their
task. On three real cross-task duplicates the wider question names the right partner
in all three (confidence 0.58-0.73, above the threshold), where the own-task pool
could only answer "none".
Regression note (found on a live run, not in CI): FindingID is filled from the findings table, so building the candidate list straight from the nodes dropped every entry and triage never fired ("nodes=6, no usable existing findings"). Covered by TestTriageCandidates_SkipsNodesWithoutFindingRow; findings inherited from a directly related task are kept and marked in the question.
---
Found while running the platform against a live target.
limits: triageDupMinConfidence 0.5 - калибровка 538 пар одной цели (stage3_calibrate.py, 2026-11-22): recall 1.00 при FP 0.47 на 75 жёстких негативах; на истинных дублях в живом прогоне 0.30-0.79
limits: triageMaxExisting 10 - ширина вопроса на реальном дубле (stage3_width.py, 2026-11-22): уверенность 0.81-0.91 до 11 кандидатов, 0.64 на 19, 0.56 на 29; латентность 0.44->1.29 с
limits: triageMaxSummaryChars 400 - p90 длины сводки 334, максимум 564 по 53 находкам графа (2026-11-22)
limits: triageMaxStateChars 6000 - арифметика при потолке 10 записей: 10*(400+60)+480 ~= 5.1 КБ, запас 1.17x
limits: triageHTTPTimeout 20s - наблюдаемая латентность decider 0.26-1.29 с, 3.83-3.96 с на 27B; запас ~5x к худшему
limits: findings pool query limit 50 - самый широкий пул по ассету 31 находка (53 в графе, 2026-11-22), запас 1.6x
limits: ответ decider 1 MiB - наблюдаемый ответ 0.3-2 КБ, запас ~500x
|
||
|---|---|---|
| .. | ||
| adversarial_gate_seed_test.go | ||
| agentic_guards_test.go | ||
| assembly.go | ||
| assembly_test.go | ||
| auto_scope_hygiene_test.go | ||
| bbot_ingest.go | ||
| bbot_ingest_confined_test.go | ||
| bbot_ingest_test.go | ||
| bbot_ingest_tool.go | ||
| bbot_ingest_tool_pg_test.go | ||
| bbot_ingest_tool_test.go | ||
| bedrock_gateway.go | ||
| bedrock_gateway_test.go | ||
| blackboard_inheritance_test.go | ||
| budget.go | ||
| budget_test.go | ||
| cancelcause.go | ||
| capture.go | ||
| capture_approval_test.go | ||
| capture_usage_test.go | ||
| chat.go | ||
| chat_session_id_test.go | ||
| clipbody_test.go | ||
| coldgraph.go | ||
| coldgraph_test.go | ||
| compaction.go | ||
| constraints.go | ||
| coverage.go | ||
| coverage_flag_test.go | ||
| coverage_ledger.go | ||
| coverage_ledger_test.go | ||
| data_envelope.go | ||
| data_envelope_test.go | ||
| deadline_contract_seed_test.go | ||
| deferred.go | ||
| deferred_test.go | ||
| fact_assets.go | ||
| fact_assets_test.go | ||
| fact_input.go | ||
| fact_input_legacy.go | ||
| fact_input_test.go | ||
| fact_provenance_test.go | ||
| filetools.go | ||
| filetools_identity.go | ||
| filetools_identity_linux.go | ||
| filetools_identity_other.go | ||
| filetools_identity_root_linux_test.go | ||
| filetools_identity_scope_root_linux_test.go | ||
| filetools_identity_test.go | ||
| filetools_other.go | ||
| filetools_test.go | ||
| filetools_unix.go | ||
| finding_dedup_seed_test.go | ||
| finding_hint_degrade_test.go | ||
| finding_quality_seed_test.go | ||
| finding_reasoning_test.go | ||
| finding_recorder.go | ||
| finding_recorder_source_test.go | ||
| finding_recorder_test.go | ||
| finding_workflow.go | ||
| finding_workflow_test.go | ||
| goals.go | ||
| hooks_reach_test.go | ||
| insert_assets_test.go | ||
| mainagent.go | ||
| noa.go | ||
| noa_budget.go | ||
| noa_budget_test.go | ||
| noise_profile.go | ||
| noise_profile_test.go | ||
| operator_handoff_seed_test.go | ||
| p43_adversarial_bench_test.go | ||
| p43_envelope_and_scan_test.go | ||
| p43_proof_gate_test.go | ||
| planner.go | ||
| prompt.go | ||
| prompt_injection_seed_test.go | ||
| prompt_now_test.go | ||
| prompt_test.go | ||
| promptcatalog.go | ||
| provider.go | ||
| provider_capture_e2e_test.go | ||
| provider_capture_test.go | ||
| provider_env_test.go | ||
| provider_quota_test.go | ||
| provider_responses_test.go | ||
| provider_window_test.go | ||
| providerstop.go | ||
| providerstop_test.go | ||
| proxyenv_test.go | ||
| record_fact_shapes_test.go | ||
| retester.go | ||
| review_context_test.go | ||
| rundir_test.go | ||
| runinfo.go | ||
| scan_ingest.go | ||
| scan_ingest_test.go | ||
| scan_ingest_tool.go | ||
| scan_ingest_tool_pg_test.go | ||
| session.go | ||
| session_header_test.go | ||
| session_test.go | ||
| side_questions.go | ||
| side_questions_test.go | ||
| skill_index_test.go | ||
| spill.go | ||
| spill_test.go | ||
| stagnation_test.go | ||
| target_gate_tools_test.go | ||
| taskclock.go | ||
| terminalreason.go | ||
| terminalreason_test.go | ||
| testmain_test.go | ||
| toolcatalog.go | ||
| toolcatalog_test.go | ||
| toolrag.go | ||
| toolrag_test.go | ||
| tools.go | ||
| tools_creds.go | ||
| tools_digest.go | ||
| tools_insert.go | ||
| tools_nil_store_test.go | ||
| tools_overview_test.go | ||
| triage.go | ||
| triage_test.go | ||
| untrusted_boundary.go | ||
| untrusted_boundary_test.go | ||
| untrusted_prompt.go | ||
| user_agent_test.go | ||
| webfetch.go | ||
| webfetch_dialer_test.go | ||
| webfetch_egress_test.go | ||
| webfetch_redirect_test.go | ||
| worker.go | ||
| worker_cache_prefix_test.go | ||
| worker_intervention_test.go | ||
| wrapup.go | ||