Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

ci: make agent validation proportional and baseline-aware (#214)

Ruben Lütke1ce8b3306160
diff --git a/.github/AGENT_WORKFLOW_AUDIT.md b/.github/AGENT_WORKFLOW_AUDIT.md
new file mode 100644
index 0000000000..97facabf2a
--- /dev/null
+++ b/.github/AGENT_WORKFLOW_AUDIT.md
@@ -0,0 +1,69 @@
+# Coding-agent workflow audit
+
+Snapshot: 2026-09-27, `PersonalJarvis/PersonalJarvis`, `main`. This records the
+live GitHub API state, not a remembered setting. Re-read protection before any
+change. GitHub documents the [status-check protection API](https://docs.github.com/en/rest/branches/branch-protection#update-status-check-protection)
+and warns that a required workflow skipped by a path filter can remain
+[pending](https://docs.github.com/en/actions/how-tos/manage-workflow-runs/skip-workflow-runs).
+
+## Current contract and cost
+
+| Mechanism | Protection | Cost or failure mode | Decision |
+| --- | --- | --- | --- |
+| Commit hook: knowledge mirrors, added German, private keys, withheld paths, staged bundle | Prevents inconsistent agent guidance, privacy leaks, and a broken shipped WebView | Diff-scoped and cheap; CI repeats the irreversible checks | Keep |
+| Push hook: credentials and private keys | Stops a public leak before network transfer | About two seconds; other whole-tree gates were already removed from this hook | Keep; no full-tree test here |
+| Required `privacy-gate`, `repo-hygiene`, `language-policy` | Secrets, public identity, keys, bundled assets, English policy, agent mirrors | Fast and tied to shipped safety | Keep |
+| Required `frontend (test + production build)` | Tests, production compilation, entry bundle budget | At audit start, main had 19 stale test failures; merged PR #208 repaired them while preserving independent build and bundle-budget checks | Keep strict; run build even if tests fail so both results appear |
+| Required `test (ubuntu-latest)` | Full Python suite, import check, routing and voice guards | Around two hours; the old minimum-passed floor let new individual failures disappear inside a red baseline or a green count | Make the suite's own failure visible; require an independent fast four-contract job instead |
+| `jarvisctl unit` with nine repository-wide policy scripts before its tests | API metadata, config wiring, silent handlers, async routes, WebGL cleanup, generated references | Existing drift in unrelated route files turns a healthy CLI unit suite red before it runs | Put policy scripts in their own required job; findings in changed files block while unchanged baseline findings remain visible |
+| Other CI jobs: dependency portability, realtime, docs privacy, desktop installers | Platform, package, and release evidence | Some are slow or need specialized runners; they remain visible and are mandatory when the change affects their contract | Keep their checks; let the agent select extra local proof |
+| PR template and fixed T1/T2/T3 rules | Encourage test evidence and cross-platform care | Blanket commands and automatic escalation turn a small patch into unrelated cleanup | Require a reasoned scope and named evidence instead |
+
+The live branch has **no repository rulesets**, no required approving review,
+`strict=false`, conversation resolution enabled, and force pushes/deletions
+disabled. Admin enforcement is off. A draft PR is reviewable work, not a merge
+request. Agents may merge ordinary authorized PRs after required checks and
+scoped review; releases still require explicit authorization.
+
+## Required-check transition
+
+The **five live required check names stay the same**, including GitHub Actions
+`app_id=15368` and `strict=false`. No GitHub settings write is needed, so an
+in-flight PR without the new workflow cannot be stranded by a missing check.
+The workflow changes what the existing `test (ubuntu-latest)` check proves:
+
+| Required check | Before | After this workflow merges |
+| --- | --- | --- |
+| `repo-hygiene`, `privacy-gate`, `language-policy` | Required | Required, unchanged |
+| `frontend (test + production build)` | Required; a test failure skips build | Required; test, build, and bundle budget all report their results |
+| `test (ubuntu-latest)` | Two-hour broad suite with a passed-count floor | Fast aggregator; passes only if the four core contracts and exact-base code policy pass |
+
+The two-hour Linux/Windows matrix moves to `broad suite (...)` and retains a
+red result for failing tests. The fast jobs have their own visible check
+results and feed the existing required context. A failed or skipped dependency
+therefore makes `test (ubuntu-latest)` fail. This keeps branch protection
+effective throughout the transition and avoids an admin bypass.
+
+The full Python suite becomes a **red advisory signal**, not a silent success:
+its pytest step returns failure and the minimum-passed floor runs even after
+that failure. The separate policy job fails if a changed file has a static
+finding; unchanged findings are logged against the exact base. Before merging,
+compare each red advisory job with the exact PR base commit under
+the same dependencies and runner. Record failing test identities and causes;
+counts or a generic “pre-existing” label do not suffice. New or unexplained
+failures block the PR. A required check is never waived because main is red.
+Never add path filtering to the required workflow: GitHub may leave its check
+pending when the workflow is skipped.
+
+## Representative decisions
+
+- **T1 UI:** a layout fix needs focused component tests, production build,
+ light/dark inspection, and a strict bundle budget. The 19 baseline failures
+ affecting PR #206 were repaired by merged PR #208; no waiver is proposed here.
+- **T2 runtime:** a desktop startup fix needs its focused behavior tests and a
+ boot/lifecycle check. Whole-tree async-route drift reports from `code policy`
+ without being mislabeled as a CLI unit failure; compare it to exact base.
+- **T3 contract:** a shared provider, credential, or OS change needs affected
+ contract families and platform proof. The four core guards always run in the
+ fast required job. A new key path also needs one-key fresh-install proof;
+ unrelated schema edits do not.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 24bda3dae5..4e3b6b1bbb 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,90 +1,15 @@
-<!--
-Thanks for contributing to Personal Jarvis.
+## Change
-Tick only the block that matches your change. A one-line docs fix does not owe
-the same evidence as a new speech provider, and we do not pretend otherwise.
--->
+<!-- What changed, and what user-visible problem does it solve? Link an issue or larger design discussion when one exists. -->
-## What does this PR do?
+## Validation
-<!-- Two or three sentences: what changed, and why. Plain language is fine. -->
+<!-- Name the affected surface, the checks you ran, and any platform or device you could not verify. Choose evidence proportional to the risk. Visible UI changes need light/dark inspection and a production build; docs/media changes need rendered links and assets checked. Public text must contain no personal data or credentials. -->
-## Related issue
+## CI failures, if any
-<!-- "Closes #123", or "none" if there isn't one. Small fixes don't need an issue first. For larger changes, link the design discussion. -->
-
----
-
-## Everyone
-
-- [ ] **English only** — code, comments, docs, commit messages, and this PR text.
- Maintainers have to be able to read every line that lands; CI enforces it.
- Chat with us in any language you like on [Discord](https://discord.gg/x7USduHxbc).
-- [ ] **One logical change.** Unrelated fixes go in their own PR.
-- [ ] **No secrets, API keys, or personal data** anywhere in the diff.
-
-## Then pick your block
-
-<details open>
-<summary><b>Docs, comments, or translations only</b></summary>
-
-- [ ] Links and media touched by this change resolve in the rendered page.
-- [ ] Public text contains no personal data or credentials.
-
-</details>
-
-<details>
-<summary><b>Web UI / frontend change</b></summary>
-
-- [ ] `npm run test` and `npm run build` pass in `jarvis/ui/web/frontend/`
-- [ ] It works in **light and dark mode** — colours come from theme tokens, not one hardcoded mode
-- [ ] Screenshot or clip below, before and after
-- [ ] You did **not** commit `jarvis/ui/web/dist/` — the maintainer rebuilds the shipped bundle
-
-</details>
-
-<details>
-<summary><b>Bug fix or ordinary Python change</b></summary>
-
-- [ ] `pytest -m "not slow"` passes, and there is a test covering the fixed behaviour
-- [ ] `ruff check jarvis/` and `ruff format --check jarvis/` are clean
-
-</details>
-
-<details>
-<summary><b>New provider (wake / STT / TTS / brain / harness / tool / channel)</b></summary>
-
-- [ ] `pytest tests/contract/` passes for the group you added to
-- [ ] No `import jarvis.*` inside the plugin module; entry-point registered in `pyproject.toml`
-- [ ] Secrets go through `get_secret()`; the provider degrades honestly without a key
-- [ ] Any heavy or platform-specific dependency is an extra, not a base install
-
-</details>
-
-<details>
-<summary><b>Change to a shared contract (capability, config schema, turn-taking, credentials, OS backend)</b></summary>
-
-- [ ] Named which platforms and providers you touched, and what the others do now
- (unchanged / emulated / degraded, with the reason)
-- [ ] `pytest tests/contract/` passes; a new gate has a test that fails without it
-- [ ] It still imports and boots on a headless `python:3.11-slim` container
-- [ ] `CHANGELOG.md` and the affected docs are updated
-
-</details>
-
----
-
-## How did you test it?
-
-<!-- The commands you ran and the platform you ran them on (Linux / macOS / Windows).
- "pytest -m 'not slow' on Ubuntu 24.04" is a complete answer. -->
+<!-- For every red non-required check, compare the exact PR base commit in the same environment. Name the failing tests or gate and explain whether the cause is unchanged. New or unexplained failures must be fixed before merge. A count alone is insufficient. -->
## Screenshots or recordings
-<!-- Only for visible changes. Drag the files straight in. -->
-
-<!--
-First PR here? You do not need to get every box right. Open it, and we will
-help you finish it in review. By contributing you agree your work is licensed
-under the Apache License 2.0 — see docs/licensing.md.
--->
+<!-- Include before/after evidence when the visible interface changes. -->
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b836c96592..b7a0e7b849 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,8 +14,10 @@
# * import-cleanliness gate -> BLOCKING. Proves `import jarvis` is clean on
# Linux/macOS (no module-scope pywin32/winreg/global_hotkeys) - the €5-VPS
# contract. A regression here breaks Mac/Linux outright.
-# * pytest + min-passed floor -> BLOCKING. Any behavioral failure,
-# collection error, or mass-skip regression fails the relevant OS leg.
+# * pytest + min-passed floor -> RED EVIDENCE. The full suite reports any
+# failure, collection error, or mass-skip regression. Agents compare a red
+# PR result with the exact base before merging; the existing required
+# `test (ubuntu-latest)` context now waits for the fast safety jobs.
#
# Cost policy (added 2026-06-23): macOS runners bill at ~10x the Linux rate, so
# the macOS leg is OFF for ordinary push/PR runs and ON only for a manual
@@ -24,7 +26,7 @@
# `concurrency` group cancels a superseded in-flight run so a burst of commits
# can't stack billable minutes. To prove macOS on demand: the Actions tab ->
# "Run workflow", or `gh workflow run ci.yml`. The `configure` job is the single
-# source of truth for which OS legs run (consumed by both `test` and `jarvisctl`).
+ # source of truth for which OS legs run (consumed by `broad-suite` and `jarvisctl`).
#
# Action SHAs are pinned to 40-char commits already vetted elsewhere in this
# repo's workflows (CVE-2025-30066 hardening).
@@ -77,7 +79,7 @@ jobs:
# Single source of truth for which OS legs run. macOS bills at ~10x the Linux
# rate, so it is included ONLY for a manual workflow_dispatch with include_macos
# (default true). Every ordinary push/PR runs the cheap Linux + Windows legs,
- # which catch almost all cross-platform regressions. Both `test` and `jarvisctl`
+ # which catch almost all cross-platform regressions. Both `broad-suite` and `jarvisctl`
# consume this output so the policy lives in exactly one place.
configure:
name: configure matrix (cost-aware)
@@ -159,8 +161,8 @@ jobs:
echo "No drop-path file changed since $base — drag-drop proof SKIPPED."
fi
- test:
- name: test (${{ matrix.os }})
+ broad-suite:
+ name: broad suite (${{ matrix.os }})
needs: configure
strategy:
fail-fast: false # we want to see ALL OS legs, not just the first red one
@@ -248,15 +250,9 @@ jobs:
-m "not skip_ci and not slow and not openclaw_live and not voice_latency and not eval" \
--junitxml=realtime-session-report.xml
- - name: pytest (JUnit XML)
+ - name: pytest (JUnit XML; all failures visible)
shell: bash
run: |
- # Exit code deliberately non-blocking: the suite still carries the
- # pre-existing env/platform backlog (Windows-only tests on the Linux
- # leg etc.), gated by the min-passed floor below. Re-tighten
- # (drop the `|| echo` and pass --strict) only once the backlog is
- # actually green cross-platform — flipping strict first turned the
- # v1.0.6 release head red on 133 long-tolerated failures.
extra_pytest_args=()
if [ "${{ matrix.os }}" = "windows-latest" ]; then
extra_pytest_args+=(
@@ -268,60 +264,70 @@ jobs:
-o faulthandler_timeout=300 \
-m "not skip_ci and not slow and not openclaw_live and not voice_latency and not eval" \
--continue-on-collection-errors \
- --junitxml=report.xml \
- || echo "pytest exited non-zero (pre-existing failures are gated by the min-passed floor)"
+ --junitxml=report.xml
- - name: Minimum-passed floor (BLOCKING, Linux leg is authoritative)
- if: matrix.os == 'ubuntu-latest'
+ - name: Minimum-passed floor (also runs after a failing suite)
+ if: always() && matrix.os == 'ubuntu-latest'
run: python scripts/ci/assert_min_passed.py report.xml
- # Its OWN blocking step, on purpose, and two traps avoided deliberately:
+ # Its OWN strict step, on purpose, and two traps avoided deliberately:
#
# * NOT carrying the `eval` marker. The suite above filters
# `-m "not ... and not eval"`, so an `eval`-marked routing test would
# silently never run — which is exactly how scripts/skill_routing_eval.py
# became invisible.
- # * NOT folded into the pytest step above, which ends in `|| echo` and
- # therefore swallows failures until the min-passed floor moves.
+ # * NOT folded into the pytest step above, so it still runs and reports
+ # its own result when the broad suite has unrelated failures.
#
# Measures precision AND recall together. Watching only precision is how
# the wake-word subsystem destroyed its own recall twice without anyone
# noticing (AP-27); recall may not drop without editing the committed
# BASELINE.json in the same change, which puts it in the diff.
- - name: Skill routing eval (BLOCKING — precision AND recall)
- if: matrix.os == 'ubuntu-latest'
+ - name: Skill routing eval (strict — precision AND recall)
+ if: always() && matrix.os == 'ubuntu-latest'
shell: bash
run: |
python -m pytest tests/unit/skills/test_skill_routing_offline.py \
-q -p no:cacheprovider
python scripts/skill_relevance_calibrate.py
- # The four guards CLAUDE.md §10 names by name, in their OWN blocking step
- # for the same reason the skill eval has one: the suite above ends in
- # `|| echo`, so a broken guard costs one passed test against a ~700-test
- # cushion above the min-passed floor and rides through green. These four
- # pin contracts that are cheap to break and expensive to notice later —
- # the router stays a pure dispatcher (ADR-0011), the voice scrubber stays
- # regex-only (AP-11), a status enum stays in step across all five layers
- # (AP-4, BUG-008 recurred 4x), and ONE resolver decides a turn's output
- # language (CLAUDE.md §1). Seconds to run; add a guard here when you add
- # one there.
- - name: Contract guards (BLOCKING — router, scrubber, enum parity, language)
- if: matrix.os == 'ubuntu-latest'
- shell: bash
- run: |
- python -m pytest \
- tests/unit/brain/test_routing.py \
- tests/unit/brain/test_output_filter.py \
- tests/unit/sessions/test_hangup_reason_parity.py \
- tests/unit/core/test_turn_language.py \
- -q -p no:cacheprovider
- - name: Plugin auth contract (BLOCKING — browser-auth standard per plugin)
+ - name: Plugin auth contract (strict — browser-auth standard per plugin)
+ if: always()
shell: bash
run: |
python scripts/ci/check_plugin_auth_contract.py
python -m pytest tests/contract/test_plugin_auth_standard.py tests/contract/test_connector_auth.py tests/contract/test_service_connectors.py tests/contract/test_plugin_availability.py tests/contract/test_home_assistant_browser_auth.py -q -p no:cacheprovider
+ # Small, independent required proof. The full-suite job above can be red on
+ # unrelated baseline failures or take over an hour; neither can skip these
+ # four core contracts. Keep this job name stable for branch protection.
+ contract_guards:
+ name: contract guards (router / voice / parity / language)
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+ steps:
+ - name: Checkout
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ persist-credentials: false
+
+ - name: Set up Python 3.11
+ uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ with:
+ python-version: "3.11"
+
+ - name: Install test dependencies
+ run: python -m pip install -e ".[dev]"
+
+ - name: Run four core contracts
+ run: >-
+ python -m pytest
+ tests/unit/brain/test_routing.py
+ tests/unit/brain/test_output_filter.py
+ tests/unit/sessions/test_hangup_reason_parity.py
+ tests/unit/core/test_turn_language.py
+ -q -p no:cacheprovider
+
# jarvisctl control-CLI unit suite across the three supported desktops.
# jarvisctl is a thin cross-platform HTTP client (paths via platformdirs,
# UTF-8 I/O, no Windows APIs); this job proves it imports + its unit tests
@@ -372,63 +378,6 @@ jobs:
python -c "import jarvis.cli_ctl.__main__"
python -m jarvis.cli_ctl --help
- - name: CLI coverage gate (every route mounted + tagged)
- # Static + stdlib-only: every jarvis/ui/web/*_routes.py router must be
- # mounted in server.py and carry tags=, so every WebUI action stays a
- # reachable, cleanly-grouped `jarvis api <tag>` command. Mirrors the
- # pre-push hook so a contributor without the hook can't bypass it.
- run: python scripts/ci/check_cli_coverage.py
-
- - name: Danger-metadata gate (destructive routes declare x-jarvis-dangerous)
- # Static + stdlib-only: a mutating route whose path matches a
- # destructive marker must carry openapi_extra x-jarvis-dangerous so the
- # CLI dynamic layer + Command Registry gate it. Mirrors pre-push.
- run: python scripts/ci/check_danger_metadata.py
-
- - name: CLI install gate (Install installs, never opens a web page)
- # Static + stdlib-only: a seed CLI with no package manager makes the
- # Install button open the vendor's docs instead of installing, which
- # reads as a broken button. Also catches a `recommended` that names a
- # method the entry never declared.
- run: python scripts/ci/check_cli_install_methods.py
-
- - name: Dead config switch gate (every switch is read by some code)
- # Static + stdlib-only: a config field nothing reads makes jarvis.toml
- # and the settings screen promise behaviour that does not exist (AP-31).
- # Known backlog is baselined; only a NEW one fails. Mirrors pre-push.
- run: python scripts/ci/check_config_switches_wired.py
-
- - name: Silent exception gate (no new invisible failure)
- # Static + stdlib-only: an except that neither logs, re-raises, nor
- # explains itself makes a failure invisible (AP-30). Per-file ratchet —
- # fails only when a file GAINS one. Mirrors pre-push.
- run: python scripts/ci/check_silent_exception_handlers.py
-
- - name: Blocking-route gate (no new async route without an await)
- # Static + stdlib-only: an `async def` handler that never awaits runs
- # its disk I/O ON the shared event loop and blocks every WebSocket,
- # route and brain turn behind it (measured 8.19 s behind one such
- # route, 2026-08-28). Per-file ratchet - fails only when a file GAINS
- # one; the fix is dropping `async` so FastAPI uses the threadpool.
- run: python scripts/ci/check_async_routes.py
-
- - name: WebGL-context gate (every 3D surface gives its context back)
- # Static + stdlib-only: a browser allows ~16 live WebGL contexts and
- # kills the OLDEST to make room, and three.js `dispose()` never returns
- # one — so a scene that mounts without releasing eventually kills a
- # different, innocent scene on the page (AP-32).
- run: python scripts/ci/check_webgl_contexts_released.py
-
- - name: CLI reference drift gate (docs in sync with command tree)
- # Fails if a curated command was added/changed without regenerating
- # docs/jarvis-cli-reference.md. Mirrors the pre-push docgen gate.
- run: python scripts/ci/gen_cli_reference.py --check
-
- - name: Commands reference drift gate (docs in sync with the registry)
- # Fails if a Command-Registry entry was added/changed without
- # regenerating docs/commands-reference.md. Mirrors the pre-push gate.
- run: python scripts/ci/gen_commands_reference.py --check
-
- name: Install base runtime deps for the test suite (robust; no hand-list)
shell: bash
# The cli_ctl unit tests import deeper jarvis modules that transitively
@@ -446,6 +395,75 @@ jobs:
- name: pytest (jarvisctl unit suite)
run: python -m pytest tests/unit/cli_ctl/ -v
+ # Repository-wide static checks report their own result. An unrelated
+ # baseline drift must not make the CLI unit suite appear broken, while any
+ # newly introduced finding remains visible and requires base comparison.
+ code_policy:
+ name: code policy (changed routes / config / handlers)
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ steps:
+ - name: Checkout
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ fetch-depth: 0
+ persist-credentials: false
+
+ - name: Set up Python 3.11
+ uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ with:
+ python-version: "3.11"
+
+ - name: Install package for reference generators
+ run: python -m pip install -e .
+
+ - name: Verify exact-base comparison
+ run: |
+ python -m pip install pytest pytest-asyncio
+ python -m pytest tests/unit/ci/test_changed_baseline_gates.py -q -p no:cacheprovider
+
+ - name: Check all code policies and report every finding
+ shell: bash
+ run: |
+ failed=0
+ for check in \
+ check_cli_coverage.py \
+ check_danger_metadata.py \
+ check_cli_install_methods.py \
+ check_config_switches_wired.py \
+ check_webgl_contexts_released.py; do
+ python "scripts/ci/$check" || failed=1
+ done
+ base="${{ github.event.pull_request.base.sha }}"
+ if [ -z "$base" ]; then
+ base="${{ github.event.before }}"
+ fi
+ if [ -n "$base" ] && [ "$base" != "0000000000000000000000000000000000000000" ]; then
+ python scripts/ci/check_changed_baseline_gates.py --base "$base" || failed=1
+ else
+ python scripts/ci/check_changed_baseline_gates.py || failed=1
+ fi
+ python scripts/ci/gen_cli_reference.py --check || failed=1
+ exit "$failed"
+
+ # Keep the existing branch-protection context stable. This check is always
+ # created and passes only when both independent fast safety jobs pass. The
+ # long broad-suite remains visible without blocking an unrelated scoped PR.
+ test:
+ name: test (ubuntu-latest)
+ needs: [contract_guards, code_policy]
+ if: always()
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - name: Require contract and changed-code policy success
+ env:
+ CONTRACT_RESULT: ${{ needs.contract_guards.result }}
+ CODE_POLICY_RESULT: ${{ needs.code_policy.result }}
+ run: |
+ test "$CONTRACT_RESULT" = success
+ test "$CODE_POLICY_RESULT" = success
+
# Dependency-manifest sync gate (BLOCKING). requirements.in (the source for the
# hash-pinned requirements.txt lockfile) must mirror pyproject.toml
# [project].dependencies exactly. When they drift, an extras-only, torch-pulling
@@ -719,12 +737,17 @@ jobs:
cache-dependency-path: jarvis/ui/web/frontend/package-lock.json
- name: Install locked dependencies
+ id: frontend_deps
run: npm ci
- name: Run frontend tests
run: npm test
- name: Build and verify production assets
+ # A failing test suite must not hide a second, independent build or
+ # bundle-budget regression. The job still fails on the test result.
+ if: always() && steps.frontend_deps.outcome == 'success'
+ id: frontend_build
run: npm run build
# The entry chunk is parsed and executed before the UI paints a single
@@ -738,6 +761,7 @@ jobs:
# to run by hand after touching the startup path. Do not read this step as
# covering the Python side.
- name: Check startup bundle budget
+ if: always() && steps.frontend_build.outcome == 'success'
working-directory: ${{ github.workspace }}
run: python3 scripts/ci/check_frontend_bundle_budget.py
diff --git a/AGENTS.md b/AGENTS.md
index 859c40c0f8..ebd5ec3c00 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -74,19 +74,31 @@ the install base, and "works on my machine" is the defect. (AP-23)
German in files you touch. Runtime output language is decided ONCE per turn by
`jarvis/core/turn_language.py`; no layer re-derives it, all locales are equal.
-**Proportionality — the evidence a change owes scales with what it touches.**
-Name the tier in one line, then owe only that tier.
-**T1 local** (styling, copy, one view, a test, a doc, a refactor behind one call
-site) → nothing extra. A matrix here is noise, not diligence.
-**T2 one surface** (an existing adapter, transport, channel or OS backend,
-shared contract unchanged) → name the cells you touched and what the others do
-(unchanged / emulated / degraded), plus tests for that family.
-**T3 contract** (a capability, shared interface, turn-taking, credentials,
-config schema, a NEW provider/transport/OS backend) → the full treatment: all
-three OSes in the same change behind one capability probe, `tests/contract/`
-per family, `docs/os-parity.md` updated, and a fresh install with ONE arbitrary
-key verified end to end. Unsure between T2 and T3 → it is T3. Over-tiering is
-also a defect.
+**Proportionality.** The agent owns the validation plan and chooses the smallest
+set of checks that can detect a plausible regression from the diff. State the
+scope, what was run, and what remains unverified in the PR. Use these tiers as
+guidance, not as automatic checklists:
+
+- **T1 local:** for copy, styling, docs, one view, or an isolated refactor, run
+ focused checks for that surface. A frontend change still needs a production
+ build and light/dark inspection when its appearance changes.
+- **T2 one surface:** test the affected adapter, transport, channel, or OS
+ backend and its nearest callers. Check other platforms when the changed path
+ can execute there; state why an unavailable platform is unaffected or how it
+ degrades.
+- **T3 shared contract:** prove the changed behavior with contract tests and
+ exercise the affected providers and OSes. Update `docs/os-parity.md` when OS
+ behavior changes. A new provider or credential path needs a fresh-install,
+ one-key proof; a schema-only change does not automatically owe that test.
+
+Escalate evidence when risk crosses a boundary, not because a label is
+ambiguous. Do not claim unrun platforms, devices, or providers were verified.
+If a required check is red on the exact base commit, compare failure identities
+and causes under the same environment. A failure already present on base may
+be reported as a separate backlog item; a new failure or an unexplained change
+in a failing test blocks completion. Counts alone are not a comparison. Do not
+silence a required check, raise a baseline, or bypass branch protection to make
+a PR appear green.
## 3. Architecture you must respect
@@ -148,7 +160,10 @@ Pipeline setup alone approves no visual redesign. Existing runtime contracts sta
Commit each finished step (Conventional Commits). Use the coding agent's
standard Git workflow: do not artificially leave completed work local, and do
not wait for extra PersonalJarvis permission to commit, branch, push, or open
-a pull request. `git pull --rebase --ff-only` first if origin moved. Never
+a pull request. Once the scoped review and required checks pass, the agent may
+merge an ordinary authorized PR without another confirmation; a draft PR stays
+draft until its remaining work is done. `git pull --rebase --ff-only` first if
+origin moved. Never
`--force`, never `--no-verify`. Isolated mission workers must not run git
(`add`/`commit`/`branch`/`checkout`/`push`) — the parent runtime captures the
diff and lands it. Never push from a linked mission worktree. **A push is
@@ -175,18 +190,21 @@ when changed; nothing a year old or older ships as a default.
## 5. Run & test
`pip install -e . --no-deps` + `-r requirements.txt` + `".[dev]"`; launch
-`run.bat` (`--headless` = API only); `ruff check jarvis/ && ruff format jarvis/
-&& mypy jarvis/`; `pytest tests/` with fakes from `tests/fakes/`, never
-`unittest.mock`. New providers pass `tests/contract/`. Four guards must stay
-green and have their own blocking CI step: `test_routing`, `test_output_filter`,
+`run.bat` (`--headless` = API only). Choose focused `pytest` and lint targets
+for the diff; use fakes from `tests/fakes/`, never `unittest.mock`. Run the
+full suite when a change has broad reach or focused tests cannot bound its
+risk. New providers pass their `tests/contract/` family. Four guards remain
+required in CI: `test_routing`, `test_output_filter`,
`test_hangup_reason_parity`, `test_turn_language`.
-Everything else is enforced by a gate in `scripts/ci/` via pre-commit and CI —
-German, private keys, bundle consistency, CLI coverage, danger metadata, unwired
-switches, silent handlers, import cleanliness, the dependency/lockfile matrix,
-and the three mirrors. Don't spend attention re-checking them by hand; a failure
-fails the build. The one exception with no gate: run `check_boot_budget.py`
-yourself after touching startup.
+The commit and push hooks block confirmed secret, private-key, withheld-path,
+language, and broken-bundle additions. CI keeps privacy, repository integrity,
+changed-file code policy, the four contract guards, and the frontend build as
+required checks. Broader tests remain visible evidence. A red non-required job
+is not proof of a new regression or permission to ignore it: triage it against
+the exact base before merging, and fix any new failure.
+Run `check_boot_budget.py` after touching startup; CI cannot measure the live
+voice-ready path.
**Pointers:** [`docs/architecture-overview.md`](docs/architecture-overview.md) ·
[`docs/BUGS.md`](docs/BUGS.md) (symptom → cause) · `docs/adr/` ·
diff --git a/CLAUDE.md b/CLAUDE.md
index 859c40c0f8..ebd5ec3c00 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -74,19 +74,31 @@ the install base, and "works on my machine" is the defect. (AP-23)
German in files you touch. Runtime output language is decided ONCE per turn by
`jarvis/core/turn_language.py`; no layer re-derives it, all locales are equal.
-**Proportionality — the evidence a change owes scales with what it touches.**
-Name the tier in one line, then owe only that tier.
-**T1 local** (styling, copy, one view, a test, a doc, a refactor behind one call
-site) → nothing extra. A matrix here is noise, not diligence.
-**T2 one surface** (an existing adapter, transport, channel or OS backend,
-shared contract unchanged) → name the cells you touched and what the others do
-(unchanged / emulated / degraded), plus tests for that family.
-**T3 contract** (a capability, shared interface, turn-taking, credentials,
-config schema, a NEW provider/transport/OS backend) → the full treatment: all
-three OSes in the same change behind one capability probe, `tests/contract/`
-per family, `docs/os-parity.md` updated, and a fresh install with ONE arbitrary
-key verified end to end. Unsure between T2 and T3 → it is T3. Over-tiering is
-also a defect.
+**Proportionality.** The agent owns the validation plan and chooses the smallest
+set of checks that can detect a plausible regression from the diff. State the
+scope, what was run, and what remains unverified in the PR. Use these tiers as
+guidance, not as automatic checklists:
+
+- **T1 local:** for copy, styling, docs, one view, or an isolated refactor, run
+ focused checks for that surface. A frontend change still needs a production
+ build and light/dark inspection when its appearance changes.
+- **T2 one surface:** test the affected adapter, transport, channel, or OS
+ backend and its nearest callers. Check other platforms when the changed path
+ can execute there; state why an unavailable platform is unaffected or how it
+ degrades.
+- **T3 shared contract:** prove the changed behavior with contract tests and
+ exercise the affected providers and OSes. Update `docs/os-parity.md` when OS
+ behavior changes. A new provider or credential path needs a fresh-install,
+ one-key proof; a schema-only change does not automatically owe that test.
+
+Escalate evidence when risk crosses a boundary, not because a label is
+ambiguous. Do not claim unrun platforms, devices, or providers were verified.
+If a required check is red on the exact base commit, compare failure identities
+and causes under the same environment. A failure already present on base may
+be reported as a separate backlog item; a new failure or an unexplained change
+in a failing test blocks completion. Counts alone are not a comparison. Do not
+silence a required check, raise a baseline, or bypass branch protection to make
+a PR appear green.
## 3. Architecture you must respect
@@ -148,7 +160,10 @@ Pipeline setup alone approves no visual redesign. Existing runtime contracts sta
Commit each finished step (Conventional Commits). Use the coding agent's
standard Git workflow: do not artificially leave completed work local, and do
not wait for extra PersonalJarvis permission to commit, branch, push, or open
-a pull request. `git pull --rebase --ff-only` first if origin moved. Never
+a pull request. Once the scoped review and required checks pass, the agent may
+merge an ordinary authorized PR without another confirmation; a draft PR stays
+draft until its remaining work is done. `git pull --rebase --ff-only` first if
+origin moved. Never
`--force`, never `--no-verify`. Isolated mission workers must not run git
(`add`/`commit`/`branch`/`checkout`/`push`) — the parent runtime captures the
diff and lands it. Never push from a linked mission worktree. **A push is
@@ -175,18 +190,21 @@ when changed; nothing a year old or older ships as a default.
## 5. Run & test
`pip install -e . --no-deps` + `-r requirements.txt` + `".[dev]"`; launch
-`run.bat` (`--headless` = API only); `ruff check jarvis/ && ruff format jarvis/
-&& mypy jarvis/`; `pytest tests/` with fakes from `tests/fakes/`, never
-`unittest.mock`. New providers pass `tests/contract/`. Four guards must stay
-green and have their own blocking CI step: `test_routing`, `test_output_filter`,
+`run.bat` (`--headless` = API only). Choose focused `pytest` and lint targets
+for the diff; use fakes from `tests/fakes/`, never `unittest.mock`. Run the
+full suite when a change has broad reach or focused tests cannot bound its
+risk. New providers pass their `tests/contract/` family. Four guards remain
+required in CI: `test_routing`, `test_output_filter`,
`test_hangup_reason_parity`, `test_turn_language`.
-Everything else is enforced by a gate in `scripts/ci/` via pre-commit and CI —
-German, private keys, bundle consistency, CLI coverage, danger metadata, unwired
-switches, silent handlers, import cleanliness, the dependency/lockfile matrix,
-and the three mirrors. Don't spend attention re-checking them by hand; a failure
-fails the build. The one exception with no gate: run `check_boot_budget.py`
-yourself after touching startup.
+The commit and push hooks block confirmed secret, private-key, withheld-path,
+language, and broken-bundle additions. CI keeps privacy, repository integrity,
+changed-file code policy, the four contract guards, and the frontend build as
+required checks. Broader tests remain visible evidence. A red non-required job
+is not proof of a new regression or permission to ignore it: triage it against
+the exact base before merging, and fix any new failure.
+Run `check_boot_budget.py` after touching startup; CI cannot measure the live
+voice-ready path.
**Pointers:** [`docs/architecture-overview.md`](docs/architecture-overview.md) ·
[`docs/BUGS.md`](docs/BUGS.md) (symptom → cause) · `docs/adr/` ·
diff --git a/scripts/ci/check_changed_baseline_gates.py b/scripts/ci/check_changed_baseline_gates.py
new file mode 100644
index 0000000000..43f45d46cd
--- /dev/null
+++ b/scripts/ci/check_changed_baseline_gates.py
@@ -0,0 +1,187 @@
+"""Gate new static findings while reporting drift already present on the base.
+
+Compare flagged handlers with the exact base commit. A per-file count cannot
+detect one old finding replaced by one new finding, and a file-level exemption
+charges unrelated edits for old drift in the same file. The original ratchets
+still run and log their full findings; this wrapper decides whether a PR added
+one. Missing base or detector errors fail closed.
+"""
+
+from __future__ import annotations
+
+import argparse
+import ast
+import collections
+import os
+import subprocess
+import sys
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[2]
+sys.path.insert(0, str(ROOT))
+
+from jarvis.core.process_utils import ( # noqa: E402
+ NO_WINDOW_CREATIONFLAGS,
+ ensure_standard_streams,
+)
+from scripts.ci import check_async_routes as async_gate # noqa: E402
+from scripts.ci import check_silent_exception_handlers as silent_gate # noqa: E402
+
+REFERENCE_PATHS = {
+ "jarvis/commands/registry.py",
+ "scripts/ci/gen_commands_reference.py",
+ "docs/commands-reference.md",
+}
+
+
+def run(*args: str) -> subprocess.CompletedProcess[str]:
+ return subprocess.run(
+ args,
+ cwd=ROOT,
+ capture_output=True,
+ text=True,
+ encoding="utf-8",
+ errors="replace",
+ env={**os.environ, "PYTHONIOENCODING": "utf-8"},
+ check=False,
+ creationflags=NO_WINDOW_CREATIONFLAGS,
+ )
+
+
+def changed_paths(base: str) -> set[str]:
+ if run("git", "cat-file", "-e", f"{base}^{{commit}}").returncode:
+ raise ValueError(f"Cannot resolve base commit {base!r}.")
+ diff = run("git", "diff", "--name-only", "--diff-filter=ACMRT", base, "HEAD")
+ if diff.returncode:
+ raise ValueError(f"Cannot compare HEAD with base commit {base!r}: {diff.stderr}")
+ return set(diff.stdout.splitlines())
+
+
+def source_at_base(base: str, path: str) -> str:
+ spec = f"{base}:{path}"
+ if run("git", "cat-file", "-e", spec).returncode:
+ return "" # Added file: there can be no grandfathered finding.
+ shown = run("git", "show", spec)
+ if shown.returncode:
+ raise ValueError(f"Cannot read {path} at {base}: {shown.stderr}")
+ return shown.stdout.lstrip("\ufeff")
+
+
+def silent_findings(source: str) -> collections.Counter[str]:
+ tree = ast.parse(source)
+ lines = source.splitlines()
+ found: collections.Counter[str] = collections.Counter()
+
+ class Visitor(ast.NodeVisitor):
+ scope: list[str] = []
+
+ def _scoped(self, node: ast.AST, name: str) -> None:
+ self.scope.append(name)
+ self.generic_visit(node)
+ self.scope.pop()
+
+ def visit_ClassDef(self, node: ast.ClassDef) -> None:
+ self._scoped(node, node.name)
+
+ def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
+ self._scoped(node, node.name)
+
+ def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> None:
+ self._scoped(node, node.name)
+
+ def visit_ExceptHandler(self, node: ast.ExceptHandler) -> None:
+ if not silent_gate._reports(node) and not silent_gate._justified(lines, node):
+ key = ".".join(self.scope) + ":" + ast.dump(node, include_attributes=False)
+ found[key] += 1
+ self.generic_visit(node)
+
+ Visitor().visit(tree)
+ return found
+
+
+def async_findings(source: str) -> collections.Counter[str]:
+ tree = ast.parse(source)
+ return collections.Counter(
+ node.name
+ + ":"
+ + ",".join(ast.dump(dec, include_attributes=False) for dec in node.decorator_list)
+ for node in ast.walk(tree)
+ if isinstance(node, ast.AsyncFunctionDef)
+ and async_gate._is_route_handler(node)
+ and not async_gate._body_awaits(node)
+ )
+
+
+def added_findings(base: str, changed: set[str], gate: str) -> list[str]:
+ findings = silent_findings if gate == "silent" else async_findings
+ paths = (
+ path
+ for path in changed
+ if path.startswith("jarvis/")
+ and path.endswith(".py")
+ and (gate == "silent" or path.startswith("jarvis/ui/web/") and path.endswith("_routes.py"))
+ )
+ added: list[str] = []
+ for path in sorted(paths):
+ head_source = (ROOT / path).read_text(encoding="utf-8-sig", errors="ignore")
+ new = findings(head_source) - findings(source_at_base(base, path))
+ if new:
+ added.append(f"{path}: {sum(new.values())} new {gate} finding(s)")
+ return added
+
+
+def reference_drift_is_new(changed: set[str]) -> bool:
+ return bool(changed & REFERENCE_PATHS)
+
+
+def main() -> int:
+ ensure_standard_streams()
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--base", help="Exact PR base commit; omit for strict full scan")
+ args = parser.parse_args()
+ try:
+ changed = changed_paths(args.base) if args.base else None
+ except ValueError as exc:
+ print(f"FAIL: {exc}", file=sys.stderr)
+ return 2
+
+ failed = False
+ for gate, script, baseline in (
+ ("silent", "check_silent_exception_handlers.py", "silent-handlers-baseline.json"),
+ ("async", "check_async_routes.py", "async-routes-baseline.json"),
+ ):
+ result = run(sys.executable, f"scripts/ci/{script}")
+ print(f"[{script}]\n{result.stdout}{result.stderr}")
+ if result.returncode not in (0, 1):
+ failed = True
+ continue
+ if changed is None:
+ failed |= result.returncode != 0
+ continue
+ if f"scripts/ci/{script}" in changed or f"scripts/ci/{baseline}" in changed:
+ failed |= result.returncode != 0
+ continue
+ try:
+ additions = added_findings(args.base, changed, gate)
+ except (SyntaxError, ValueError, OSError) as exc:
+ print(f"FAIL: cannot compare {gate} findings: {exc}")
+ failed = True
+ continue
+ if additions:
+ print("FAIL: " + "; ".join(additions))
+ failed = True
+ elif result.returncode:
+ print("BASELINE: all flagged findings existed at the exact base commit.")
+
+ reference = run(sys.executable, "scripts/ci/gen_commands_reference.py", "--check")
+ print(f"[gen_commands_reference.py]\n{reference.stdout}{reference.stderr}")
+ if reference.returncode:
+ if reference.returncode != 1 or changed is None or reference_drift_is_new(changed):
+ failed = True
+ else:
+ print("BASELINE: command registry and generated reference are unchanged.")
+ return int(failed)
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/tests/unit/ci/test_changed_baseline_gates.py b/tests/unit/ci/test_changed_baseline_gates.py
new file mode 100644
index 0000000000..119876203a
--- /dev/null
+++ b/tests/unit/ci/test_changed_baseline_gates.py
@@ -0,0 +1,52 @@
+"""Exact-base gate comparison detects replacements as well as count increases."""
+
+import pytest
+
+from scripts.ci.check_changed_baseline_gates import (
+ async_findings,
+ changed_paths,
+ reference_drift_is_new,
+ silent_findings,
+)
+
+
+def test_silent_handler_line_shift_is_not_new() -> None:
+ base = "def action():\n try:\n work()\n except ValueError:\n pass\n"
+ head = "# Moved down one line\n" + base
+ assert silent_findings(head) - silent_findings(base) == {}
+
+
+def test_replacing_a_silent_handler_fails_even_at_the_same_count() -> None:
+ base = "def action():\n try:\n work()\n except ValueError:\n pass\n"
+ head = base.replace("ValueError", "RuntimeError")
+ assert sum((silent_findings(head) - silent_findings(base)).values()) == 1
+
+
+def test_justified_handler_removes_a_finding() -> None:
+ base = "def action():\n try:\n work()\n except ValueError:\n pass\n"
+ head = base.replace(
+ " pass", " # Optional probe may fail without affecting startup.\n pass"
+ )
+ assert silent_findings(head) == {}
+
+
+def test_new_blocking_route_detected_without_counting_existing_one() -> None:
+ base = "@router.get('/old')\nasync def old():\n return read_disk()\n"
+ head = base + "@router.get('/new')\nasync def new():\n return read_disk()\n"
+ assert sum((async_findings(head) - async_findings(base)).values()) == 1
+
+
+def test_retargeted_blocking_route_is_new_even_with_the_same_name() -> None:
+ base = "@router.get('/old')\nasync def route():\n return read_disk()\n"
+ head = base.replace("'/old'", "'/new'")
+ assert sum((async_findings(head) - async_findings(base)).values()) == 1
+
+
+def test_reference_drift_is_blocking_only_when_its_inputs_change() -> None:
+ assert not reference_drift_is_new({"jarvis/ui/web/agent_chat_routes.py"})
+ assert reference_drift_is_new({"jarvis/commands/registry.py"})
+
+
+def test_missing_base_fails_closed() -> None:
+ with pytest.raises(ValueError, match="Cannot resolve base"):
+ changed_paths("missing-base-commit")