feat: competitor-drift instrument harness (pluggable external-agent silent-wrong-action-rate runner, cost-capped)#73
Merged
Conversation
…ilent-wrong-action-rate runner, cost-capped) Extend the self-directed silent-wrong-action benchmark (#67) from "our own runtime" to ANY external computer-use agent. A new `openadapt_flow.instrument` package points the #63 EffectVerifier at an arbitrary external agent's runs against the MockMed transactional-fault suite (`mockmed.fault_server`) and measures its silent-wrong-action rate (wrong effect landed while the agent reported success), anonymized by architecture class. This PR is the HARNESS ONLY: no concrete competitor adapter, no paid API / model call, no vendor name. The real (cost-capped) run against a real competitor is a separate, user-gated step this makes one command away. - `ExternalAgentAdapter` Protocol: the pluggable seam (run_task + a pre-flight estimate_cost_usd + an anonymized architecture_class). A real adapter wraps a vendor's own entry points behind it, out of this repo (docstring example). - `run_instrument`: drives an adapter through the fault suite, reads the system of record with RestRecordVerifier, and computes the rate — output anonymized by architecture class (Tool A/B/C), structurally enforced; never a vendor. - `CostGuard`: hard max_cost_usd / max_steps / max_runs kill-switch that aborts the WHOLE run the instant a cap would be crossed (pre- and post-flight), plus a dry-run mode that projects cost BEFORE spending. No run can silently exceed. - `StubExternalAgentAdapter`: deterministic, offline, $0 stub (screen-blind and honest modes) proving the harness measures nonzero silent-wrong on the fault classes and zero on clean ones end to end. - 25 tests; reuses the #67 ground-truth judge and #63 effect contract as the single source of truth. No existing files modified. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CKrVJJy5jWVCkXAqgUqtqZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Extends the self-directed silent-wrong-action benchmark (#67) from our own runtime to any external computer-use agent. A new
openadapt_flow.instrumentpackage points the #63EffectVerifierat an arbitrary external agent's runs against the MockMed transactional-fault suite (mockmed.fault_server) and measures its silent-wrong-action rate — a wrong / absent / duplicate business effect that landed while the agent reported success — output anonymized by architecture class (Tool A/B/C), never a vendor name.This PR is the HARNESS ONLY. It spends $0, makes no model / paid API call, ships no concrete competitor adapter, and names no vendor. The real, cost-capped run against a real competitor is a separate, user-gated decision — this makes it one command away.
The seam:
ExternalAgentAdapterProtocolA real adapter (a thin wrapper over a vendor's own record/replay/agent entry points) plugs in later, out of this repo — the Protocol is the only contact point, and the vendor's code never touches our scoring path. A worked wrapping example is in the
ExternalAgentAdapterdocstring. The harness reads the MockMed system of record itself withRestRecordVerifier; the only agent-supplied signal the metric uses is the agent's own success claim.Cost guardrails (mandatory)
CostGuardis a hard kill-switch onmax_cost_usd/max_steps/max_runsthat aborts the whole run the instant a cap would be crossed:can_start): refuses to start a run whose estimate would cross the cost cap, or oncemax_runsis hit;record): books actual spend/steps and aborts everything if cumulative cost passed the cap or a run blew the step budget;Stub-adapter proof (CI, $0, offline)
StubExternalAgentAdapteremulates an external agent driving MockMed:screen_blind(a vision-style blind agent) → silent-wrong-action rate 100% on each of the 5 silent fault classes (partial / optimistic / duplicate / double / stale), 0% on the clean classes (ok / idempotent), and correctly 0% onsession(safe halt) andtimeout(write actually landed). Headline: 55.6% (5/9).honest(negative control) → 0% everywhere, proving the metric is not hardwired to fire.For every silent-wrong row, our
EffectVerifierrefused to confirm — i.e. pairing the agent with our verifier converts the silent wrong-action into a safe halt.Tests
25 tests, all green (
tests/test_competitor_drift_instrument.py): nonzero-on-faults / zero-on-clean, the honest negative control, cost/step/run-cap aborts, dry-run projection, and anonymization (vendor labels rejected structurally; rendered artifacts scanned for vendor strings). Reuses the #67 ground-truth judge and #63 effect contract as the single source of truth. No existing files modified — additive only.Run it:
python -m openadapt_flow.instrument.competitor_drift --dry-run(estimate) or--stub-mode screen_blind($0 proof).🤖 Generated with Claude Code
https://claude.ai/code/session_01CKrVJJy5jWVCkXAqgUqtqZ