Skip to content

feat(roadmap): the refine judge asks the decision model before a refusal #4867

Open

Description

@dan-petty

Problem or Motivation

After #4798 merges with the fixable check of its scope comment, the refine judge classes its findings with rules only. Owner requirement 4 asks for the decision model on the closed choice 'can one repair round fix this?' at every refusal site.

Proposed Solution & Architectural Design

Point refine.judge_fixable (#4847): Jev (Noul: yes/no with a probability) 'fixable' on the counts of the #4798 classes; the #4798 rule is the fallback and, before the fit, a yes of the rule stands. Record the path and the result.

Target Subsystem

SDLC, Git & PR Governance (roadmap refine judge).

Existing Tool Considered

The #4847 chain and Jev through decide_with_jev. Cost to build: about 0.3M tokens, 2 hours.

Acceptance Criteria

  • A test with a fake model: model yes and rule no -> agent round; model error -> rule.
  • Each decision writes the decision line and the counter.

Dependencies

#4847; #4798 with the fixable check of its scope comment, merged first.

Source: #4843

Alternatives check of 2026-12-01: in-use.
The repository already uses this tool.
Tool: pydantic/pydantic-ai (https://github.com/pydantic/pydantic-ai), MIT, last activity 2026-12-01, maintained.
Reason: Hold: #4798 and #4847 are unmerged. Searches found no tool for the fixable rule, the decision line or the counter; pydantic-ai, already in use, covers only the typed Noul request that #5897 defers.

Covers:

  • Typed Noul model request through the existing decide_with_jev chain
  • Structured yes/no answer with a probability
  • Model errors return to the caller for the rule fallback

Lacks:

Proposed design

Problem statement

Add the deterministic #4798 fixable rule to the refine judge; hold the decision-point registration and its model request in #5897. The refine judge now refuses a proposal after the maximum tries with no fixable check. The rule must run before the refusal and give one repair round when the open findings are fixable. The decision point and its Noul model need #4847 and a fitted cuts file.

Acceptance criteria

Requirement: Fixable rule gives one repair round

The refine judge SHALL run the #4798 fixable check on the open findings before it records a refusal at CONST_ROADMAP_REFINE_MAX_TRIES.

Scenario: A fixable finding gets one repair round

Requirement: Rule no fails the item

The refine judge SHALL record refine.next_step failed when the #4798 fixable check answers no.

Scenario: A not-fixable finding fails the item

Requirement: The rule decision is recorded

The refine judge SHALL write one decision line that names refine.judge_fixable, the rule resolver and the result for each rule decision.

Scenario: The line records the rule result

  • WHEN A test runs a rule decision and reads the captured log.
  • THEN One line names refine.judge_fixable, rule and the result fixable or not_fixable.

Existing Tool Considered

pydantic/pydantic-ai is in use (verdict in-use). The alternatives check in the issue body gives what it covers and lacks. The deferred model request uses it through decide_with_jev for the typed Noul request. The rule chain, fitted cuts, decision line and counter remain project code. Written cost: about 0.3M tokens and 2 hours.

Key questions

  • Where does the fixable rule run?: The rule runs in src/devops_cli/roadmap/refine/refine_judge.py and src/devops_cli/roadmap/refine/refine.py, before the refusal at CONST_ROADMAP_REFINE_MAX_TRIES. [sources: src/devops_cli/roadmap/refine/refine_judge.py, src/devops_cli/roadmap/refine/refine.py, src/devops_cli/config/constants.py:3751]
  • What does a fixable rule answer do?: A fixable answer gives one repair round and sets refine.next_step to retry. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py, src/devops_cli/roadmap/refine/refine_judge.py]
    • Chosen: Use retry for a fixable finding. The issue asks for one repair round before the item fails.
    • Rejected: Use failed for every refusal. This option gives no repair round and ignores the fixable rule.
  • What does a not-fixable rule answer do?: A not-fixable answer sets refine.next_step to failed and starts no repair round. (best practice) [sources: src/devops_cli/roadmap/refine/refine.py, src/devops_cli/roadmap/refine/refine_judge.py]
    • Chosen: Use failed for a not-fixable finding. A repair round cannot fix the open findings, so the item fails.
    • Rejected: Use retry for every refusal. This option spends a round on findings that the rule marks not fixable.
  • Which model does the deferred decision point ask?: The point uses the model that ai.decision_model names. With the setting empty, the point sends no model request and the rule answer stands. (best practice) [sources: docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md, src/devops_cli/roadmap/decision_point.py]
    • Chosen: Use ai.decision_model. ADR 0020 makes this setting the single model choice for a decision point.
    • Rejected: Hardcode a model name. A hardcoded name bypasses the setting and its validation.
  • Does the decision model override a no of the fix(roadmap): refine sends a judge refusal to an agent round #4798 rule?: No. ADR 0020 puts the rule before the model. The model runs only after a fitted cuts file and with the point mode shadow or on. (best practice) [sources: docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md, src/devops_cli/roadmap/decision_point.py, src/devops_cli/roadmap/decision_step.py:138]
    • Chosen: Rule first, model after a fit. ADR 0020 stops the chain at the first resolver and adds a model only when measured.
    • Rejected: Model first, rule as fallback. This option contradicts the resolver chain in ADR 0020.
  • How does the point map the Noul probability to a yes or no?: The cuts file of refine.judge_fixable gives the band through Thresholds and band_of. The judge uses no fixed 0.5 threshold. (best practice) [sources: docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md, src/devops_cli/roadmap/decision_step.py:138, src/devops_cli/roadmap/decision_step.py:163, src/devops_cli/roadmap/decision_point.py]
    • Chosen: Use the cuts file. ADR 0020 section 3 makes the cut data in the repository with the model and its fit.
    • Rejected: Use a fixed 0.5 threshold. A constant is a guess, and ADR 0020 section 3 says a test refuses it.
  • How does the decision point record the result?: The point writes one decision line and adds one to devops_cli_decision_point_total when its mode is shadow or on. The rule-only part writes the line; feat(roadmap): register the refine judge fixable decision point #5897 adds the point counter. (best practice) [sources: docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4798, #4847

Moved to new items

#5897

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It refines an existing judge path and has a rule fallback, so it is not blocking but improves accuracy.
    • Value: Medium. It adds a model-based fixable signal that can reduce false refusals, but the rule already covers the case.
    • Effort: Low. The body states about 0.3M tokens and 2 hours of work.
    • Related: fix(roadmap): refine sends a judge refusal to an agent round #4798, which asks for a different change. Both work on the refine judge fixable step; #4798 delivers the rule and agent-round routing, this candidate adds a model call that precedes the rule as a pre-check.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches returned only generic LLM gateways and model-server images, which route or serve model calls but implement no refine-judge decision point, no rule-before-model fallback, and no decision line or counter. The need is a project-internal change to the #4847 decide_with_jev chain and the #4798 fixable classes, so no external open, maintained tool covers it.

    Tool: none found

    Lacks:

    • Asking a decision model the closed question 'can one repair round fix this?' at each refine-judge refusal site
    • Keeping the fix(roadmap): refine sends a judge refusal to an agent round #4798 rule as the fallback and letting a rule yes stand before the fit
    • Recording the decision path and the result, with the decision line and the counter
    • Integration with the project's own refine.judge_fixable / decide_with_jev decision-point chain

    Searches run:

    • Jev Noul model yes/no probability decision, results: 5
    • open source library LLM closed question yes/no probability with rule fallback, results: 5
    • DSPy classifier rule fallback LLM decision, results: 5
    • pydantic-ai structured output binary classification yes no probability, results: 5
    • dspy github stanford-nlp, results: 5
    • instructor structured outputs LLM python library github, results: 5
    • dan-petty devops-cli roadmap refine judge, results: 5
    • litellm, results: 5
    • baml boundary typed LLM functions classifier, results: 5
    • dspy, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  6. dan-petty commented on Nov 15, 2026

    @dan-petty
    OwnerAuthor

    Cannot be built as written: depends on unmerged issue #4847, and #4847 refined design explicitly deferred the fix-check chain from scope. Returned per AGENTS.md Rule 2.

  7. added
    status/ready
    and removed
    status/new
    on Nov 15, 2026
  8. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at ca62d6a (see proposed design in issue body).

    Moved to new items: #5897.

  9. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: none, no tool. A person decides what the new result means for the item.

    Searches (6)

    Tools considered:

    Searches run:

    • pydantic-ai structured output typed model calibrated probability decision, results: 5
    • LLM decision model yes/no with probability fallback to rule engine library, results: 5
    • pydantic-ai github repository, results: 5
    • "decide_with_jev" Noul decision model, results: 5
    • DSPy classifier probability calibration, results: 5
    • pydantic-ai, results: 5

    Sources:

  10. added
    owner/agent
    on Nov 28, 2026
  11. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor

    Returned per AGENTS.md Rule 2: #4867 specifies running 'the #4798 fixable check on the open findings before it refuses a proposal at the cap' (Dependencies: '#4847; #4798 with the fixable check of its scope comment, merged first'). Verified against origin/main (6e7cd2b): #4798 (openspec/changes/archive/2026-11-12-4798-refine-judge-refusal-agent-round/proposal.md, commit e4fc6a9 / #4874) only implemented routing JUDGE_REFUSED to NextStep.RETRY up to CONST_ROADMAP_REFINE_MAX_TRIES (3) and never built the deterministic fixable check described in #4798's scope comment (git ls-files missing_path refutation, input-gap rerun, or placeholder not_fixable check) in src/devops_cli/roadmap/refine/refine.py or refine_judge.py. #4847 (model-after-rule chain) is also unmerged and #5897 (refine.judge_fixable registration) remains New. Re-open or update once the prerequisite deterministic fixable check is implemented in its own issue.

  12. added
    status/new
    and removed
    status/ready
    on Nov 28, 2026
  13. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Owner question: See Suspected block and Watched files in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  14. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  15. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowowner/agentpriority/p2-mediumscope/roadmapsource/agentstatus/readytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions