Repository navigation
DecGuard v0.1: native System One backend, real Kev and Jev validation - #5
Merged
Merged
Conversation
Add the built-in `systemone` provider for TypeSafe System One decision APIs: self-hosted Kev servers (`/v1/systemone`) and Jev through OpenRouter's Decisions API. It subclasses the `http` backend to reuse its client, timeouts, retries, environment-only credentials and the rule that error bodies are never recorded, and adds 429/529 as retryable. Choice labels are sent as criteria options, noul maps the probability of yes to the positive label, and score maps level indices back to the ordered levels. Answers are validated strictly and never repaired. Add opt-in `real_kev` / `real_jev` integration tests that run genuine inference, fail instead of skipping once selected, and check for secret leakage, plus a manual workflow running them on Ubuntu and macOS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
workflow_dispatch only works for workflows on the default branch; a `real-backends` label runs the same jobs on a pull request before merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document the `systemone` provider (wire translation, answer checks, provenance, Jev's two-decimal rounding) and exact Kev and Jev/OpenRouter reproduction steps with the required environment variables and secret. Record the design decision and update the shared project context. Share the label_map validation between `http` and `systemone`, and skip the uv cache in the Kev job, whose torch stack is faster to download than to restore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first run's Kev tests passed on both OSes, but the jobs failed: `uv run` kept uv's cache lock while the server ran, so setup-uv's post step timed out waiting for it. Start the server with the synced venv's Python and stop it once the reports are shown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
suffro
marked this pull request as ready for review
September 24, 2026 22:35
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 the last DecGuard v0.1 release blocker: genuine end-to-end decisions through real Kev and real Jev (OpenRouter), validated in GitHub Actions on Ubuntu and macOS.
What changed
systemonebackend (built in,src/decguard/backends/systemone.py). It speaks TypeSafe's System One wire format, which is shared by self-hosted Kev (POST /v1/systemone), TypeSafe's Jev, and OpenRouter's Decisions API (POST /api/alpha/decisions). It is a thin subclass of thehttpbackend, so it reuses the httpx client, URL and credential checks, timeouts, retries, environment-only credentials, and the rule that error bodies are never recorded. It also retries HTTP 429 and 529. No new dependency and no vendor SDK.criteriaoption keys. The answer'sprobabilitiesare read by option, andchoicemust be the most probable option.noulis the probability of the positive (first) contract label, and the negative label gets1 − noul.criterialist.probabilitiesare read by level index, and thelegendmust echo the levels sent.DecisionResultpath (exact labels, canonical order, sum withinprobability_tolerance).model_versionis the model that answered (e.g.typesafe/jev-1.13-20260917). Per-result metadata recordsrequest_id,upstream_providerandusage(input_tokens,output_tokens,cost). The report's backend listsserved_modelsandupstream_providers.tests/integration/test_real_backends.py, contracts intests/integration/real/) with the markersreal_kevandreal_jev. They are skipped by default. Once selected with-m, a missing server, checkpoint or credential fails them. They assert successful decisions with valid probabilities, report generation, provenance, and that no secret appears in stdout, stderr, reports or exceptions. The last check includes a real rejected-key call (HTTP 401) with a canary key.Real backendsworkflow (.github/workflows/real-backends.yml): manual (workflow_dispatch, or thereal-backendslabel on a PR from this repository), Python 3.13 only. It runs four jobs: REAL KEV and REAL JEV onubuntu-latestandmacos-latest.OPENROUTER_API_KEYcomes from repository secrets and is passed only to the Jev test step. The Kev weights are cached by pinned revision.tests/unit/test_systemone_backend.py, 36 tests).docs/backends.mdhas thesystemonereference and exact Kev and Jev/OpenRouter reproduction steps. Also updated: README, CHANGELOG,docs/ci.md, the.context/state, and a decision record.Real backends used
jaredpalmer/kev@09ff745d52a0f23954e3b0f5a608bf4c7c6aebb4,python -m kev.servejaredpalmer/kev-0.8b@9a45d25eb2ab761841196625383fa1dff0e56c1e(Kev-0.8B, the smallest current checkpoint; baseQwen/Qwen3.5-0.8B-Base)typesafe/jev-1.13, served astypesafe/jev-1.13-20260917https://openrouter.ai/api/alpha/decisionsJev rounds probabilities to two decimals, so the real contracts set
evaluation.probability_tolerance: 0.02. The sum is still checked, never rescaled.Evidence
Real-backend run 36067954968 on
95cc5bd:ubuntu-latestmacos-latestEach Kev job logged
serving jaredpalmer/kev-0.8b@9a45d25… on cpu via torch (float32)or… on mps via mlx (bfloat16). Each Jev decision has an OpenRoutergen-dec-…request id,upstream_provider: TypeSafeand served modeltypesafe/jev-1.13-20260917. Standard CI on the same commit: 36067948253. Lint, package, and Ubuntu/macOS × Python 3.11/3.12/3.13 are all green.An earlier run (36067123735) passed all real tests, but its Kev jobs failed afterwards. A still-running
uv runserver held uv's cache lock, and setup-uv's post step timed out waiting for it. Fixed in95cc5bd: the server now starts with the venv's Python and is stopped at the end of the job.Local checks:
ruff check,ruff format --check,mypyandpytestall pass (313 passed, 8 opt-in skips).uv buildproduces a wheel and sdist, and the clean-wheel smoke test (validateplus a real Kev decision) passes.Not in this PR
No tag, PyPI release or GitHub release.
🤖 Generated with Claude Code