## Summary
Allow all five shipped agents to inherit an OAuth-backed host model,
including OpenAI Codex, by validating the inherited model binding with
the runtime credential check after parent session overrides.
- Reuse the launcher's inheritance decision in setup and update its
English/Chinese message.
- Preserve raw provider settings, routing, reasoning effort and product
limits. OAuth tokens remain in the host credential store.
- Cover OAuth aliases, access/refresh tokens, missing or malformed
credentials, custom token paths, parent bindings and independent agent
keys. Remove the old API-key-only gate exemptions from the auth contract
test.
## Type
- [x] Fix
- [ ] Feature
- [ ] Docs
- [ ] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
Selected regression tests: **321 passed, 48 deselected** on Windows with
Python 3.12. The selection focuses on inheritance and excludes untouched
POSIX permission/pruning scenarios.
```powershell
uv run --no-sync pytest tests/test_config_product_render.py tests/test_subagent_vendored_agents.py tests/test_cli_subagent_setup.py tests/test_provider_auth_method.py tests/test_providers_factory.py tests/test_openai_codex_provider.py tests/test_providers_oauth_login.py tests/test_i18n_prompts.py tests/test_i18n_boundary.py -q -o addopts='' -p no:cacheprovider -k '(not test_config_product_render or inherit_llm or launchers_inherit_oauth or launchers_own_keys or secret_slots or env_wins or dig_and_put) and not prune and not backup and not locks_it_down and not test_a_page_sign_in_runs_the_real_driver_and_leaves_the_token_owner_only' --cov=raven.config.product_render --cov=raven.agent.subagent.vendored_agents --cov=raven.cli.subagent_setup --cov=raven.i18n --cov-branch --cov-report=json:C:/Users/Administrator/AppData/Local/Temp/raven_issue809_coverage_final.json --cov-report=term-missing:skip-covered
```
The following checks passed: Ruff across the repository, formatting
(2149 files), relevant type checks, all 10 import contracts, commit
messages, source language and file/asset checks.
```powershell
uv run --no-sync ruff check raven evolver agents plugins-dist tests scripts docs-site
uv run --no-sync ruff format --check raven evolver agents plugins-dist tests scripts docs-site
uv run --no-sync ty check raven/config/product_render.py raven/agent/subagent/vendored_agents.py raven/cli/subagent_setup.py
uv run --no-sync lint-imports
uv run --no-sync python scripts/check_commit_messages.py main..HEAD
uv run --no-sync python scripts/check_source_language.py main..HEAD
uv run --no-sync python scripts/check_large_files.py main..HEAD
```
Changed-line coverage: **100% (22/22 executable lines)** after
normalizing the Windows report's path separators.
```powershell
uv run --no-sync python -c "import json,pathlib; p=pathlib.Path('C:/Users/Administrator/AppData/Local/Temp/raven_issue809_coverage_final.json'); d=json.loads(p.read_text(encoding='utf-8')); d['files']={k.replace(chr(92), '/'):v for k,v in d['files'].items()}; p.with_name('raven_issue809_coverage_posix.json').write_text(json.dumps(d), encoding='utf-8')"
uv run --no-sync python scripts/coverage_gate.py --coverage-json C:/Users/Administrator/AppData/Local/Temp/raven_issue809_coverage_posix.json diff --base-ref main --head HEAD --threshold 90
```
Full local CI remains unverified: `make ci` could not run because make
is unavailable. Existing POSIX file-permission tests fail on Windows.
`uv run --no-sync deptry raven` reports 12 missing optional channel
dependencies in this environment.
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [x] User-facing docs or screenshots are updated when needed
## Risk
Inheritance now refuses an unavailable selected model even when an
unrelated provider has an API key. API-key and independent-agent-key
paths remain covered. Credential validation only reads stored OAuth
credentials; it does not sign in or serialize tokens. Revert this change
to restore the previous inheritance gate.
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
## Related Issues
Fixes#809
---------
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: KT <74288668+0xKT@users.noreply.github.com>
The test suite covers the CLI, provider routing, context assembly, memory,
channels, sandbox behavior, TUI RPC contracts, and proactive engine flows.
Running Tests
Run the default suite from the repository root:
uv run pytest
For focused work, target the relevant file or marker:
uv run pytest tests/test_cli_doctor_commands.py
uv run pytest -m "not real_llm"
The suite runs on four workers by default (-n 4 in addopts), which takes it
from about ten minutes to two. Two things that costs you, both undone by -n0
on the command line:
uv run pytest -n0 --pdb tests/test_cli_doctor_commands.py
--pdb refuses to start under the workers: --pdb is incompatible with distributing tests. There is no debugger to attach to, since the test runs in
a child process.
Output is no longer in file order. Reading a run top to bottom, or
comparing two runs line by line, wants -n0 as well.
Tests should avoid live network calls by default. When a test needs external
services or a real model, guard it behind an explicit marker or environment
variable so CI and local contributors get deterministic results.
Coverage Governance
Raven uses three related checks:
Coverage measures line and branch execution across the default Python
suite. It is the broad health signal for the production raven/ package.
Diff coverage measures executable lines added or modified relative to the
PR target branch. Comments, deleted lines, and non-executable lines are not
part of its denominator. The initial threshold is 90%.
The ratchet compares total line and branch coverage with the audited
baseline in .github/coverage-baseline.json. Neither metric may decline by
more than 0.05 percentage points. This protects the established level without
pretending the current project is already near 100%.
Run the same coverage command used by CI:
make coverage
PYTHON_VERSION defaults to the CI version (3.12) and is shared by all
Python Make targets. It can be overridden for exploratory compatibility runs,
for example make coverage PYTHON_VERSION=3.13; only the configured CI matrix
version may produce an authoritative baseline.
The command prints missing lines and creates coverage.xml, coverage.json,
and htmlcov/. Open htmlcov/index.html in a browser for line-by-line detail.
Generated reports are ignored by git.
After running coverage, use the local gates:
make coverage-summary
make coverage-diff COVERAGE_BASE_REF=origin/main
make coverage-ratchet
make coverage-baseline-check COVERAGE_BASE_REF=origin/main
The summary prints separate total line and branch percentages plus the ten
lowest-covered production files. A diff failure lists every uncovered changed
line as path:line. A ratchet failure prints the current value, baseline,
change in percentage points, and the files with the largest declines.
The CI unit job runs the default suite once and reuses its data for all gates.
It uploads XML, JSON, and HTML reports even when tests or a gate fail. Diff
coverage runs only for pull requests because a push has no PR target branch;
push builds still enforce the overall ratchet.
Baseline updates
make coverage-baseline-candidate creates
coverage-baseline-candidate.json from the current report. The tracked
bootstrap baseline is accepted only after the introducing PR reproduces it in
Python 3.12 Ubuntu CI within the ratchet tolerance. After bootstrap, the
baseline must only be replaced with a candidate downloaded from a successful
main CI run. Review the reference commit and totals in the candidate before
replacement. Never edit the percentages by hand or lower the baseline to make
a change pass. PR CI compares a proposed baseline with the target branch and
rejects any decrease in either line or branch coverage.
Scope and exclusions
The default coverage suite excludes tests marked integration or e2e, plus
tests/integration/, because they require real services, credentials,
subprocess stacks, VMs, or network access and are not deterministic unit-CI
inputs. Provider cases that require live credentials remain skipped.
All production Python under raven/ is measured except:
raven/__main__.py and evolver/__main__.py, which only forward their
module entry points.
Type-checking-only blocks and if __name__ == "__main__" launcher blocks are
excluded as non-runtime paths. No low-coverage feature module is omitted.