Repository navigation
CONTRACT: feat(ui-server,common): ask Jev about the extraction heuristics' ambiguous band, routed under G2, metered and budgeted (#4089) - #4101
Merged
Conversation
…tics' ambiguous band, routed under G2, metered and budgeted (#4089) Add the `taint.judge` governance policy setting, `{ mode: off, floor: 0.9 }` by default. With `mode: jev` beside `taint.classifier: heuristics`, an interactive turn puts a tainted session's outgoing call whose heuristic score falls in the ambiguous band (0.2 to below 0.35, as #3434 calibrated it) to Jev through the host's own client instead of raising its card. - The state is the outgoing request (body cut at 2,000 characters), the wording of what tainted the session and the overlap score: never the conversation, the tainting content or a read file. - The model is pinned to jev-1.13.0. `benign` admits and `extraction` refuses only at or above the floor (configurable, 0.5 to 1). `suspicious`, a sub-floor answer, no answer, a timeout, an open breaker, a missing key and a different answering model all ask. - G2: TypeSafe is the recipient `typesafe` under the web providers' routing rule; a conversation shown a folder the policy keeps from it, or one whose exposure cannot be judged, sends nothing. A blocked budget scope or no ledger sends nothing either. - Each physical request is recorded as a `typesafe` attempt with the new operation `extraction_judge` against the turn, its conversation and its UTC day, with the tokens TypeSafe reports; unpriced, so its cost is unknown. - Voice never calls the judge and keeps refusing. Answers stay host state. The recorded #3434 Jev answers replayed through the production judge reproduce the plan's heuristics-plus-Jev row in every repetition: held-out 1 leak and 3 benign cards, the realistic session 2 of 22. Contract: additive `taint.judge` in the policy schema and in `brain policy check --json` `effective.taint`, the `extraction_judge` metered operation, and the ui-server API report; documented in the contract index, cli.md, package-api.md and supported-inputs.md. Closes #4089 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
schlessera
marked this pull request as ready for review
November 16, 2026 23:27
This was referenced Nov 16, 2026
Closed
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.
Closes #4089
What changed
A new policy setting,
taint.judge, defaults to{ mode: off, floor: 0.9 }. Withmode: jev, and only besidetaint.classifier: heuristics, an interactive turn sends a tainted session's outgoing call to Jev when the call's heuristic score falls in the ambiguous band (0.2 to below 0.35, the #3434 calibration). Without the setting, that call raises the per-use card. The call goes through the host's own Jev client (createJevClient, production mode: one attempt, receipt model and usage read). The client is shared across turns, so its breaker is too. Jev sees a three-part state:fetched a web page;It never sees the conversation, the tainting content or any file the session read. The model is pinned to
jev-1.13.0.benignadmits the call, andextractionrefuses it, only at or above the floor. Every other result asks:suspicious;typesafe.Each physical request is metered against the turn, its conversation and its UTC day. It is recorded as a
typesafeattempt with the new operationextraction_judge:dispatchedjust before it leaves, then the settled outcome with the tokens TypeSafe reports. No rate is held for it, so its cost is unknown, never zero. Voice turns never call the judge and keep refusing.Why this shape
observeProvider/providerAdmission, the sameobservepath inprepareRelayedEgress) and itstypesaferecipient, origin and key name (ui-sdk: relay Jev reranking for governed workers, so hosted search is not always unranked #3792).webRoutingRefusal, recipienttypesafe). The judge is shown text the model wrote, which can quote any folder the model saw. A conversation that is not yet named has no recorded exposure, so it sends nothing whenever a rule restrictstypesafe.dispatchedfrom inside the client (classify(request, { dispatched })). A call the breaker or a missing key skips records no spend.benignon the tuning beacon and the card, so the setting cannot remove it.WebFetch <host>name. Production keeps only the source kind, and the wording carries no tainting content. The replay uses the recorded answers; evals: requalify the Jev extraction band with extraction cases that reach it before it is enabled by default #4090 requalifies the band live.Proof
bun run check:pr --base origin/main # exit 0 at 5fff54d20, receipt belowtsc --noEmit(8 GiB heap),bun run build,bun run api-report(ui-server report:taint.judgein schema and resolved policy) andbun run lintare clean.New and neighbouring suites:
extraction-judge(23 tests),extraction-classifier-labelled(4),extraction-admission(9),provider-relay-budgetsand the inbox-triage suites give 60 pass and 0 fail. The policy suites (core/governance-policy,core/policy-cliandcommon/taint-trust) give 16 + 12 pass.Acceptance criteria, by named test (
packages/ui-server/tests/extraction-judge.test.ts; TypeSafe is a stub atfetch, the lowest request method the host client uses):JUDGE_NOT_ASKED_BELOW_BAND,JUDGE_ONLY_AMBIGUOUS_BAND,JUDGE_STATE_ONLY_THREE_THINGS,JUDGE_NEVER_SEES: <read-file text, tainting text, WebFetch prompt>,JUDGE_MODEL_PINNEDandJUDGE_BODY_TRUNCATED.JUDGE_BENIGN_AT_FLOOR_NO_CLASSIFIER_CARD/…_NO_TAINT_CARD(benign at exactly 0.9 admits a new host with no card), andJUDGE_EXTRACTION_REFUSES. Each of the following raises the card:JUDGE_SUB_FLOOR_BENIGN_ASKS,JUDGE_SUSPICIOUS_ASKS,JUDGE_SUB_FLOOR_EXTRACTION_ASKS,JUDGE_NO_ANSWER_ASKS,JUDGE_HTTP_ERROR_ASKS,JUDGE_TIMEOUT_ASKS,JUDGE_OPEN_BREAKER_ASKS(+_NO_CALL,_NO_RECEIPT),JUDGE_OTHER_MODEL_ASKSandJUDGE_NO_KEY_ASKS.JUDGE_RECEIPTS,JUDGE_METERED_ON_TURN,JUDGE_TOKENS_CHARGED_{turn,session,day},JUDGE_COST_UNKNOWN_NOT_ZERO_*andJUDGE_EXHAUSTED_BUDGET_ASKS/JUDGE_NO_LEDGER_ASKS(no call, no receipt). G2 routing:JUDGE_ROUTING_REFUSES_SHOWN_FOLDER,JUDGE_ROUTING_REFUSES_UNKNOWN_EXPOSUREandJUDGE_ROUTING_ADMITS_UNSHOWN.JUDGE_VOICE_KEEPS_REFUSING,JUDGE_VOICE_NEVER_CALLS,JUDGE_OFF_BY_DEFAULTandJUDGE_NEEDS_HEURISTICS. Autonomous turns get no turn proxy (prepareRelayedEgressonly), so they never build one.JUDGE_EMITS_NOTHING,JUDGE_REPORTS_NO_ACTIVITY,JUDGE_CARD_HAS_NO_VERDICTandJUDGE_REFUSAL_HAS_NO_VERDICT.extraction-classifier-labelled.test.ts): the recordedresults-2026-11-16.jsonanswers go throughcreateExtractionJudgeover a stubbedcreateJevClientwith the 0.9 floor. For each of the three repetitions, all 86 calls match the recordedheuristics+jev#<rep>row (JEV_REPLAY_MATCHES_RECORDED_RUN#<rep>). Held-out gives 1 leak, 3 benign cards, 0 benign refused and 8 judged calls. The realistic session asks on 2 of 22.JUDGE_DEFAULT_OFF,JUDGE_FLOOR_CONFIGURABLEandJUDGE_STRICT_VALUE(rejectsfloor: 0.4,floor: 1.1, an unknown mode and amodelkey).Failing first. The judge modules stay, but the call in
turn-extraction.tsthat consults the judge is removed. Then the new tests give 10 pass / 13 fail, includingJUDGE_BENIGN_AT_FLOOR_NO_CLASSIFIER_CARDandJUDGE_ROUTING_ADMITS_UNSHOWN, and every*_ASKScase fails its judge-call count. This is not a module-load failure. The line was then restored.Mutations (each restored; the suites pass again):
judgeBand:if (!answer) return "ask")JUDGE_SUB_FLOOR_BENIGN_ASKS,JUDGE_SUB_FLOOR_EXTRACTION_ASKS,FLOOR_BENIGN_BELOW,JEV_REPLAY_MATCHES_RECORDED_RUN#0(19 pass / 4 fail)judgeBand(null)→allow)NO_ANSWER_ASKSif (!answer)→allow)JUDGE_NO_ANSWER_ASKSoutcome !== "answered"→allow)JUDGE_HTTP_ERROR_ASKS,JUDGE_TIMEOUT_ASKS,JUDGE_FAILURE_ASKSJUDGE_OTHER_MODEL_ASKSJUDGE_EXHAUSTED_BUDGET_ASKSJUDGE_ROUTING_REFUSES_SHOWN_FOLDERJUDGE_NOT_ASKED_BELOW_BANDJUDGE_VOICE_KEEPS_REFUSINGProvider history. Nothing on the provider-facing path changes: no tool, system prompt, append or transcript change. The judge's answers are host state, and a judged call reaches the conversation only as the existing card or refusal text. The keyless guards (
ui-backend-claudeandui-backend-piprovider-history.test.ts) cannot start their CLIs on this host. They fail the same way withorigin/main'spackages/commonandpackages/ui-sdkchecked out (Claude Code process exited with code 1; piprobe()), so this is environment-only. They ran in hosted draft heavy feedback instead.Hosted draft heavy feedback, run 43940170497: conclusion
success, and its jobs checked out head5fff54d20e224a10a09943587e7c1e0e48c00f54(HEAD is now at 5fff54d20). Every selected job passed: runtime, runtime_host, browser 1–3, layout 1–2, captures, endurance, pack and unit 1–4. The provider-history guards run in the unit shards. This is feedback, not merge proof.{"version":1,"kind":"brain-check-pr-receipt","head":"279fb4530f64c46e34357ac14a4a5552204deba1","base":"origin/main","mode":"focused","startedAt":"2026-11-16T23:23:34.292Z","finishedAt":"2026-11-16T23:25:07.622Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":13200.332188999997},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":108.94221899999684},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":81.12373600000137},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":20.18761799999993},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":79902.925318}]}Collisions (
bun scripts/collisions.ts --json --pr 4101, head5fff54d20): there are nopathcollisions. Thetextualones are #3622 indocs/integration-contract/package-api.mdandpackages/ui-server/src/app.ts, and #4002 inpackages/ui-server/src/ws/session-run/backend-entry.ts; whichever lands second merges. The rest areclosureonly (a shared test/build closure, not shared files): #3054, #3056, #3059, #3069, #3581, #4036, #4068, #4070, #4074, #4075 and #4080.Checklist
successat head5fff54d20..changeset/extraction-judge-band.md).cli.md,package-api.mdandsupported-inputs.mdare updated in theCONTRACT:commit.docs/reflect the change: the decision record (#extraction-judge), the plan, andhosting/agent-workers.md.extractionat or above the floor refuses. Self-recovery: the shared breaker re-probes on its own. Boot: nothing persists, so no historical record can block. Durable cause: each attempt and its outcome is inprovider_relay_usage. Unknown never clean: no answer, an unknown exposure or no ledger never admits. No host-wide failure: a dead TypeSafe costs one probe per breaker window and leaves the card.Anything left open
fetched a web page), not the spike'sWebFetch <host>. evals: requalify the Jev extraction band with extraction cases that reach it before it is enabled by default #4090's live run measures it as built.🤖 Generated with Claude Code