Skip to content

feat: intelligence layer, capture depth, schema-first adapters, eval harness, viewer polish#2

Open
EricFinland wants to merge 8 commits into
mainfrom
claude/all-tracks
Open

feat: intelligence layer, capture depth, schema-first adapters, eval harness, viewer polish#2
EricFinland wants to merge 8 commits into
mainfrom
claude/all-tracks

Conversation

@EricFinland

Copy link
Copy Markdown
Owner

Builds out all five roadmap tracks: the intelligence layer, capture depth, schema-first adapters, a reliability harness, and viewer polish.

Track A: Intelligence layer

  • Prompt-injection detection (witness/analysis/injection.py): flags the conjunction of injection-shaped DOM content (instruction-override phrasing, hidden/offscreen text, suspicious links) and a deviating post-injection action. Weak patterns only escalate to high when paired with a strong signal and a navigation/submit, so benign FAQ copy does not produce false highs.
  • Trajectory analysis (trajectory.py): loops/thrash, task drift, wasted/dead-end steps, and backtracking, plus a single trace-level health score.
  • Secret/PII exfiltration (exfil.py): masked-evidence detection of credentials typed into fields and DOM secrets carried into navigations or form posts. Raw secrets are never persisted.
  • Outcome prediction (outcome.py): heuristic risk score now, with an optional scikit-learn training harness (training.py, [ml] extra) that mines success/failure labels from captured runs.
  • New Finding model, an idempotent analysis runner, witness analyze [--all], GET /api/traces/{id}/findings, and POST /api/traces/{id}/analyze.

Track B: Capture depth

  • Opt-in OTLP export via WITNESS_OTLP_ENDPOINT (Jaeger/Grafana/Honeycomb), normalized to OpenTelemetry GenAI semantic conventions. Local-first remains the default.
  • Guarded CDP capture of network requests, console errors, and the accessibility tree per step.

Track C: Schema-first, multi-framework

  • Versioned capture schema (witness/schema.py, SCHEMA_VERSION 1.0) and a CaptureAdapter registry (witness/adapters/): browser_use full, Playwright scaffolded. witness.instrument stays backward compatible.

Track D: Reliability / eval harness

  • witness bench runs a task N times and reports success rate, step/cost/latency distributions, flakiness, and trajectory divergence. WitnessBench reference tasks live in examples/bench/.

Track E: Distribution and polish

  • Viewer: findings panel, trajectory-health and risk badges, per-step injection/exfil icons, trace-list filters and full-text search, a timeline scrubber, and a re-analyze button.
  • witness report writes a self-contained HTML report plus a markdown PR summary; a reusable GitHub Action posts the summary on PRs.

Quality

An adversarial review pass caught and fixed three high-severity issues before commit: the injection false-positive escalation, a cookie-banner exfil false positive, and a per-step Playwright listener leak. Each fix shipped with regression tests.

Tests

187 passed, 0 failed. 50 files changed, roughly +8000/-340.

Notes

  • The outcome ML model needs captured runs to train (pip install usewitness[ml]).
  • CDP capture depth is unit-tested and fully guarded but has not been exercised against a live browser_use run yet.

… schema

Add the shared contract the intelligence layer builds on: a Finding
SQLModel table, the witness.analysis package (analyzer protocol in base.py
plus an idempotent runner), a canonical versioned capture schema
(witness/schema.py, SCHEMA_VERSION 1.0), findings API endpoints, the
analyze/bench/report CLI commands, and the viewer Finding types/api.
…come)

- Prompt-injection detection: flags the conjunction of injection-shaped
  DOM content and a deviating post-injection action.
- Trajectory health: loop/thrash, task drift, wasted steps, backtracking,
  plus a single trace-level health score.
- Secret/PII exfiltration: masked-evidence detection of credentials typed
  into fields and DOM secrets carried into navigations or form posts.
- Outcome/risk prediction: heuristic score now, with an optional
  scikit-learn training harness that mines labels from captured runs.
When WITNESS_OTLP_ENDPOINT is set, additionally export spans to an OTLP
collector (Jaeger/Grafana/Honeycomb) while keeping local-first as the
default. Normalize spans to gen_ai.* GenAI conventions so exported data is
standards-compliant.
Refactor the capture path into a CaptureAdapter registry (browser_use
adapter plus a scaffolded Playwright adapter); witness.instrument stays
backward compatible. Best-effort, fully guarded CDP capture of network
requests, console errors, and the accessibility tree per step.
Run a task N times and report success rate, step/cost/latency
distributions, flakiness, and trajectory divergence. Add a small named
WitnessBench set of reference browser tasks under examples/bench.
witness report writes a single-file HTML report (summary, timeline,
findings, LLM calls) and a compact markdown summary; a reusable workflow
posts the summary as a PR comment.
Surface findings grouped by kind with severity badges and evidence,
trajectory-health and risk badges, per-step injection/exfil warning icons,
trace-list filters and full-text search, a timeline scrubber, and a
re-analyze button.
Add an intelligence-layer section to the README, reconcile the backlog
with what now ships, add docs for analysis, schema/adapters, the bench
harness, and OTLP export, and declare the optional [ml] and [otlp] extras.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant