Repository navigation
Record Jev's profile suggestion in shadow mode (#39) - #45
Conversation
An opt-in observer, `code_cycle.routing.jev.mode: shadow` (default `disabled`), asks Jev which of `cheap_coder` or `deep_coder` it would pick for `implement` and `resolve` stages, and records the answer beside the rules' choice. It is not a ProfileSelector: nothing it returns reaches route(), target resolution, fallback or dispatch. - The request carries only allowlisted scalar pre-routing signals from telemetry.PRE_ROUTING_SIGNALS plus the role, with a fixed choice question. No prose, paths, diffs, repo/task/cycle ids or outcomes. - The key comes only from JEV_API_KEY at call time and goes only in the Authorization header. Disabled builds no client and makes no request; a missing key records `unavailable`. - Failures are closed categories (unavailable, timeout, rate_limited, http_error, invalid_response); no remote text is kept, and none stops or changes the stage. The call is bounded by timeout_seconds (<= 10). - Telemetry schema 4 adds `shadow` rows with the rules' profile, the suggestion, agreement, confidence, per-option probabilities and the requested/resolved Jev model, correlated by (cycle_id, stage_seq) and listed by cycle_outcome(). They hold no signals and no outcomes, and first_pass_rate never reads them as the implementer. - code_cycle.routing and code_cycle.routing.jev refuse unknown keys; the mode, model and timeout are validated before any stage runs. Standard library only; no new dependency. Closes #39
[CCR-20260923-001] · senior_reviewer · openai/gpt-6→? · ? · schema:1Review summaryReviewed the complete PR 45 diff from FindingsNone. Security triage and auditThe deterministic security gate did not match any changed path, filename, or PR label. The reviewer-triggered security audit ran because this change sends pre-routing data and an environment credential to an external API. The audit covered the signal allowlist, request construction, A synthetic local 307 response was exercised against the transport: Validation and checks
Unverified items and residual riskThe live Jev API and the Python unit suite were not independently exercised. The PR description’s test result remains unverified here; the active GitHub checks cover package validation and installers. VerdictAPPROVED — no open blocking findings; all reported GitHub checks passed. |
Implements #39 (#39).
What changes in behaviour
code_cycle.routing.jevblock:mode: disabled|shadow(defaultdisabled),model(onlytypesafe-ai/jev),timeout_seconds(default 3, at most 10). Unknown keys undercode_cycle.routingandcode_cycle.routing.jevare now refused before any stage runs.shadow, after animplementorresolvestage has been routed, dispatched and recorded,CycleRecorderasks Jev (POST https://www.jevai.org/api/v1/decisions, typedchoicequestion) to pickcheap_coderordeep_coder. It records the answer on a separateshadowtelemetry row. The adapter (scripts/jev_shadow.py) is an observer, not aProfileSelector: nothing it returns reachesroute(), target resolution, fallback or dispatch.telemetry.PRE_ROUTING_SIGNALS(Añadir señales tipadas y estrictamente pre-routing a telemetry #35) plus the role. No prose, paths, diffs, repo/task/cycle ids, outcomes or secrets.JEV_API_KEYat call time and placed only in theAuthorizationheader. It is never stored in config, rows or logs.unavailable. Timeout, 429, 5xx, other HTTP errors and invalid responses each map to one closedjev_statuscategory. No remote text is kept. The cycle's real decision is unchanged in every case.shadowrows carryjev_rule_profile,jev_suggested_profile,jev_agreement,jev_confidence,jev_probability_<option>,jev_model_requested,jev_model_resolved/jev_model_resolution(resolved only when reported, and stored by name only when known), andjev_duration_ms. They are correlated by(cycle_id, stage_seq)with dispatch features and Registrar outcomes estructurados y correlacionables de cada ciclo #37 outcomes but never mixed with them.cycle_outcome()lists them undershadows, andfirst_pass_ratenever reads a shadow row as the implementer. Probabilities outside [0, 1] are refused.Verification
python3 -m unittest discover -s tests: 580 tests, OK. This includes 27 new tests intests/test_jev_shadow.py, covering config validation, the payload allowlist, key handling, response parsing and failure categories, disabled mode with no client or network, a disagreeing suggestion that leaves the dispatch identical, shadow rows free of signals and outcomes, and correlation.python3 scripts/validate-package.py: VALID.Residual risk
data.answers.profile.{choice, confidence, probabilities}, optionaldata.model) comes from the public docs. If the real shape differs, every shadow recordsinvalid_responseand the cycle is unaffected.timeout_seconds.Closes #39