Repository navigation
Description
Problem Description
A Jev reply that does not hold every asked answer stops the whole intake round. With roadmap.intake.jev: shadow, ADR 0019 rule 6 and the spec of #4395 say: "A Jev error or timeout SHALL change nothing". The code does not do this for a partial reply or for an answer of the wrong kind.
src/devops_cli/roadmap/intake/intake_jev_shadow.py,_duplicate: the guard_answer_of(response, f"duplicate_of_{each.number}", object)cannot fail, becauseisinstance(None, object)isTrue.best_neighbourinsrc/devops_cli/roadmap/intake/intake_jev.pythen readsresponse.answers[...]directly and reads.noul. A missing answer raisesKeyError. An answer of a different kind raisesAttributeError.ShadowIntakeModel.observationcatches only(*FAILED, ShadowError)._shadow_markruns outside thetryblock of_Planner._proposeinintake.py. Thus the error stopsplan_intake, and the refine deferral plan stops too.
Mode on has the same gap. proposal_from reads response.answers[name] in _choice and _level, and JevIntakeModel.propose catches only (*FAILED, JevUnusableError). Mode on is not live now.
The trigger is possible. The TypeSafe provider (pydantic_ai/models/typesafe.py) passes on only the answers that the backend sends. The library's own agent path (pydantic_ai/models/decision.py, _fanned_in) raises UnexpectedModelBehavior for the same case.
Reproduction Steps
- Make a
ProposalRequestwith one nearest item (number 7). - Give
ShadowIntakeModel.observationaDecisionResponsethat haspriority,valueandeffort, and noduplicate_of_7. - Run
plan_intakewith theRoadmapfake oftests/support/roadmap_intake.py, once with modeoffand once with modeshadow, with the same partial reply.
Expected vs Actual Behavior
Expected: the candidate is placed as with mode off, no mark intake.jev_shadow is written, and each asked field counts jev_error in devops_cli_roadmap_intake_jev_fields_total. In mode on, the proposal falls back to the triage model and the fields count fallback.
Actual: step 2 raises KeyError: 'duplicate_of_7'. Step 3 gives off: ['place', 'place'] and shadow: plan_intake raised KeyError 'duplicate_of_1'.
Environment Diagnostics
devops-cli v0.110.0 (merge commit 6cf9251 of #4438). Python 3.14. The error does not depend on the host.
Logs, Traces, or Terminal Output
$ python -c "print(isinstance(None, object))"
True
observation: ESCAPED fail-open guard: KeyError 'duplicate_of_7'
off: ['place', 'place']
shadow: plan_intake raised KeyError 'duplicate_of_1'
Proposed fix
Fix the cause in one place. Add one checked accessor in intake_jev.py that reads an answer by name and kind, and raises UnexpectedModelBehavior when the answer is missing or of the wrong kind, as the library does in _fanned_in. UnexpectedModelBehavior is in FAILED, so both modes already catch it. Use it in _choice, _level and best_neighbour, so that both modes read answers the same way. Use _DUPLICATE_PREFIX from intake_jev.py and do not repeat the literal in the shadow module. Then remove the no-op guard in _duplicate.
Tests first:
- Shadow: a Jev reply with no
duplicate_of_<n>answer. The candidate is placed as withoff, no mark is written, and each asked field countsjev_error. - Shadow: a
duplicate_of_<n>answer of a wrong kind (for example aChoiceAnswer) gives the same result. - On: a reply with no
priorityanswer falls back to the triage model, and each field countsfallback.
Fix this before a person adds jev: shadow to the live ConfigMap.
Pre-Submission Checklist
- No sensitive credentials, private keys or internal tokens are in this report.
- I searched the existing issues and pull requests. No duplicate exists.
Source: #4438
Proposed design
Problem statement
A partial or wrong-kind Jev reply does not stop the intake round. The decision model raises UnexpectedModelBehavior before intake reads the reply, and FAILED holds that error, so both modes fail open. The shadow module still holds a guard that checks nothing: _answer_of(response, f"duplicate_of_{each.number}", object) cannot fail, because isinstance(None, object) is true. Its docstring also says that a missing answer raises ShadowError, but only the choice and score answers are checked. The change removes the dead guard and makes the docstring true.
Acceptance criteria
Requirement: Shadow duplicate check
The shadow duplicate check SHALL read the nearest item only through best_neighbour from intake_jev.py, and SHALL NOT hold a duplicate_of_ literal or an answer guard of kind object.
Scenario: Shadow duplicate answer name
- WHEN A test reads
_duplicateinintake_jev_shadow.py. - THEN The function calls
best_neighbour, holds noduplicate_of_literal, and holds no_answer_ofcall whose kind isobject.
Requirement: Shadow answer error
observation_of SHALL raise ShadowError when a choice or score answer is missing or has a wrong kind.
Scenario: Missing priority answer
- WHEN
observation_ofreceives a response with nopriorityanswer. - THEN
observation_ofraisesShadowError.
Requirement: Shadow docstring
The docstring of observation_of SHALL name ShadowError as the error of a missing or wrong-kind choice or score answer, and SHALL state that the decision model refuses a partial reply.
Scenario: Docstring names the error and the model check
- WHEN A test reads the docstring of
observation_of. - THEN The docstring names
ShadowErrorand does not say that a missing duplicate answer raises it.
Existing Tool Considered
No alternatives check has run. pydantic-ai covers the need: SystemOneModel.decide raises UnexpectedModelBehavior when the names or the kinds of the answers differ from the questions. FAILED holds that error, so both intake modes fail open. The library lacks a public checked accessor for a DecisionResponse. The change builds no new code: it removes a dead guard of about 3 lines and corrects one docstring, about 10 minutes of elapsed time and no token cost to keep.
Key questions
- Does this item add the checked answer accessor, or remove the dead guard?: Remove the dead guard. The decision model closes the path, so the item adds no accessor. The change removes the no-op loop in
_duplicateand corrects the docstring ofobservation_of. (best practice) [sources: src/devops_cli/roadmap/intake/intake_jev_shadow.py, src/devops_cli/roadmap/intake/intake_jev.py, src/devops_cli/ai/pydantic_ai_bridge.py]- Chosen: Remove the dead guard and correct the docstring. The library refuses a partial reply before intake reads it, so an accessor would serve a closed path (AGENTS.md rule 2). The dead guard checks nothing and the docstring overstates the check.
- Rejected: Add the checked accessor as the body proposes. No fail-to-pass test is possible. The decision model raises
UnexpectedModelBehaviorfirst, and a scratch run with the Jev edge fake placed both candidates in all four cases. - Rejected: Close the item as not planned. The dead guard and the wrong docstring remain. A small cleanup delivers both.
- What does the Jev decision model do with a reply that misses an answer or gives an answer of a wrong kind?:
SystemOneModel.decideraisesUnexpectedModelBehaviorwhen the answer names differ from the question names, or when an answer is not of the kind of its question. The project buildsSystemOneModelfor each Jev name and neverTypeSafeModel.FAILEDholdsUnexpectedModelBehavior, so both intake modes catch it. [sources: src/devops_cli/ai/pydantic_ai_bridge.py, src/devops_cli/ai/jev.py, src/devops_cli/roadmap/intake/intake_jev.py] - Which error does shadow mode raise for a missing or wrong-kind choice or score answer, and where is it caught?:
ShadowError.ShadowIntakeModel.observationcatches(*FAILED, ShadowError), logs one warning, and countsjev_errorfor each asked field. [sources: src/devops_cli/roadmap/intake/intake_jev_shadow.py] - What does mode
ondo with a partial reply?:JevIntakeModel.proposecatches(*FAILED, JevUnusableError)and falls back to the triage model. It countsfallbackfor each asked field. [sources: src/devops_cli/roadmap/intake/intake_jev.py] - Where must the name of a duplicate answer come from?:
intake_jev.py._DUPLICATE_PREFIXbuilds the name in_questionsand inbest_neighbour, and the shadow module repeats no literal. (best practice) [sources: src/devops_cli/roadmap/intake/intake_jev.py, src/devops_cli/roadmap/intake/intake_jev_shadow.py]- Chosen: Use
_DUPLICATE_PREFIXinintake_jev.pyonly. One definition serves both modes. The removal of the shadow loop removes the last literal. - Rejected: Repeat
duplicate_of_in the shadow module. It keeps two sources for the same name and keeps the dead guard. - Rejected: Build the name in a new shared module. It adds a module for one constant.
- Chosen: Use
- Does this item block the setting
roadmap.intake.jev: shadowin the live ConfigMap?: No. A person can setjev: shadownow. A partial or wrong-kind reply changes nothing, because the decision model raisesUnexpectedModelBehaviorand the shadow mode countsjev_error. (best practice) [sources: src/devops_cli/roadmap/intake/intake_jev_shadow.py, src/devops_cli/roadmap/intake/intake_jev.py]- Chosen: Set
jev: shadownow. Both modes already fail open on a partial or wrong-kind reply. - Rejected: Wait for the checked accessor. The library closes the path, so the accessor is not needed.
- Chosen: Set
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-11: in-use.
The item already names this tool.
Tool: pydantic/pydantic-ai (https://github.com/pydantic/pydantic-ai), MIT, last activity 2026-11-11, maintained.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.A KeyError stops the entire intake round and must be fixed before shadow mode goes live.Prevents a crash that would block all intake when shadow mode is enabled.Add one accessor, use it in three call sites, remove one no-op guard, and add three tests.Both concern the Jev shadow intake mode, but #4395 adds the mode while this candidate fixes a crash in its error handling.devops-cli-service commentedon Nov 11, 2026
Status set to Ready at c653bde (see proposed design in issue body).
dan-petty commentedon Nov 11, 2026
The premise does not hold on the real model
A partial Jev reply, or an answer of the wrong kind, does not stop the intake round. The library refuses such a reply before intake reads it. This item does not block
roadmap.intake.jev: shadowin the live ConfigMap.Evidence
pydantic_ai.models.system_one.SystemOneModel.create_jev_modelcallsresolve_pydantic_ai_model, and_jev_decision_modelinsrc/devops_cli/ai/pydantic_ai_bridge.pybuilds the model for each name that_is_jev_decision_nameaccepts:typesafe:…,system-one:…, and a gateway route oftypesafe/jev-…. No path of the project buildspydantic_ai.models.typesafe.TypeSafeModel, the provider that the issue names.SystemOneModel.decide(pydantic-ai-slim 2.59.0, the locked version) raisesUnexpectedModelBehaviorwhen the names of the answers are not the names of the questions (parsed.answers.keys() != questions.keys()). It raises the same error when an answer is not of the kind of its question (isinstance(answer, NoulAnswer)for aNoulQuestion, and the same check for a choice and a score).UnexpectedModelBehavioris inFAILED, soShadowIntakeModel.observationandJevIntakeModel.proposecatch it.main(6cf78e7) with the Jev edge faketests/support/fakes/jev.py, which is a transport under the realSystemOneModel:shadow: the fake drops eachduplicate_of_<n>answer, or sends achoiceanswer in its place;on: the fake drops thepriorityanswer, or sends an answer of the wrong kind.In all four runs,
plan_intakeplaces both candidates ([place, place]). Result:4 passed.ShadowIntakeModel.observationaDecisionResponsethat the test makes by hand. That skips the check of the library, so it does not show a fault on the real path.Thus no fail-to-pass test with the Jev edge fake is possible. The checked accessor would be code for a path that the library already closes (AGENTS.md rule 2), so I did not build it.
What remains
_answer_of(response, f"duplicate_of_{each.number}", object)in_duplicateofintake_jev_shadow.pychecks nothing, becauseisinstance(None, object)is true. A cleanup can remove the loop. The docstring ofobservation_ofsays that a missing answer raisesShadowError; that is true only for the choice and score answers.offoronin YAML stops the settings load).Proposal: close this item as not planned, or re-scope it to the removal of the no-op loop.
devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 2f6114f (see proposed design in issue body).
devops-cli-service commentedon Nov 11, 2026
Alternatives check: in-use
Reason: pydantic-ai is the library the project already uses for the Jev decision step, and its decision model refuses a reply whose answers are missing or of the wrong kind by raising UnexpectedModelBehavior before intake reads the response; that error sits in the project's FAILED tuple, so shadow mode counts jev_error and mode
onfalls back, which is exactly the fail-open behaviour the issue asks for. The only gap is that the library exposes no public checked accessor for a DecisionResponse, so the deadobject-kind guard and the overstated docstring in the shadow module stay as a small cleanup rather than a bug fix.The item already names this tool.
Tool: pydantic/pydantic-ai (https://github.com/pydantic/pydantic-ai)
Covers:
Lacks:
objectand a docstring that overstates what raises ShadowErrorTools considered:
Searches run:
Sources:
Checked on 2026-11-11. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 14, 2026
Released in v0.143.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.143.0
devops-cli-service commentedon Nov 14, 2026
Live since 2026-11-14 21:08 UTC