Skip to content

feat(roadmap): add the soft-cap and fix-check chain to decision points #4847

Done

Description

@dan-petty

Problem or Motivation

The owner asks that a cap becomes a soft cap that a decision model extends while a run makes progress, and that a refusal first runs a fixable check. ADR 0020 puts the rule first and refuses mode on with no fitted cut; the chain calls decide_all, which is not safe from the sync PrepareTools hook; the point timeout is 30 s against a gateway p99 of 0.5 s over 3,027 Jev requests; and devops_cli_decision_point_total has a bound of 60 series that about 4 more points fill. The only extension today, implement.extension (#4394, #4464), is a constant rule outside the registry.

Proposed Solution & Architectural Design

Extend the existing ResolverChain (decision_point.py); build no second framework.

  1. Guards first, resolver guard, final: extensions used < max; value + step <= hard ceiling; one more step fits each outer limit with a margin (item or step seconds, window share <= 0.75, item tokens); no Service drain; no exact loop (same call and answer 4 times, or the same failing call 3 times); no stuck or never finding.
  2. Modes off, shadow, rule (the rule acts, the model is recorded) and on.
  3. Mode on before the fit: yes when the rule says yes or the model is at or above the default cut 0.5; the model never removes a yes of the rule.
  4. After the fit (>= 30 labelled outcomes, >= 10 per label, halves check): the model with its fitted cut, the rule on model failure. Where today's code extends by a rule, the rule's yes always stands.
  5. Noul questions through decide_with_jev, timeout 5 s, counts-only digest.
  6. Record the rule and model answers on each decision and an outcome line per extended or repaired run; new counters devops_cli_roadmap_cap_decisions_total{point,resolver,result}, _cap_outcomes_total{point,result}, _fix_checks_total{site,path,resolver}, _fix_rounds_total{site,result} with a series bound test.
  7. First point: implement.extension (the feat(roadmap): extend a step budget when the run makes progress #4464 rule stays; the model can add the one +50% extension up to 16,000,000 tokens).
  8. Amend ADR 0020 for the cap and fix families in the same PR (parent chore(roadmap): track the decision model workflows #4408).

Target Subsystem

SDLC, Git & PR Governance (roadmap decision points, implement extension, ADR 0020).

Existing Tool Considered

The existing ADR 0020 ResolverChain in decision_point.py (no second framework), pydantic-ai DecisionModel and Jev through decide_with_jev, the OpenHands StuckDetector thresholds as the pattern for the loop guard, and prometheus_client counters. Cost to build: about 1.5M tokens, 1 day.

Acceptance Criteria

  • Tests with a fake decision model: model error or a 5 s timeout -> rule; a guard stop -> resolver guard and no model request; mode rule -> the rule acts and the model answer is recorded; mode on unfitted -> rule no with model 0.7 extends, rule yes with model 0.2 extends.
  • A test: no point passes its hard ceiling.
  • A test: a step that today's feat(roadmap): extend a step budget when the run makes progress #4464 rule extends is extended in every mode except off.
  • A test: the counters stay under their series bounds.
  • A test: no decide_all call from a tool thread.
  • ADR 0020 states the order and the fit bar.

Dependencies

None.

Related: #4408 (decision model workflows; parent of the ADR 0020 amendment), #4394 and #4464 (the implement extension of today).

Source: #4843

Alternatives check of 2026-11-21: none.
Tool: none found.
Reason: Searches found only LLM output-validation and agent-platform libraries: guardrails-ai validates model output, pydantic-ai supplies the model client, and OpenHands' stuck detector is an internal loop guard. None supplies the guard order, modes, fitted-cut gate or roadmap counters.

Lacks:

  • No soft-cap extension of a point's hard ceiling
  • No off, shadow, rule and on modes with a fitted-cut gate
  • No rule-versus-model record or roadmap decision counters
  • No drain, loop and outer-limit guard order for a decision chain

Proposed design

Problem statement

Roadmap decision points stop at a hard cap and have no soft cap that a decision model can extend. The resolver chain runs the rule first and stops, so no mode lets the model add an extension, and a point with no cuts file cannot run in shadow or on (the settings refuse both), so the model's answers cannot even be collected before a fit. A cut in a constant is a guess that ADR 0020 refuses. The point timeout is 30 s against a measured gateway p99 of 0.5 s over 3,027 Jev requests, so a slow gateway holds the synchronous PrepareTools hook. The only extension today, implement.extension (#4394, #4464), is a constant rule outside the registry. #5272 has landed, so the chain now sends its request on the process portal and devops_cli_decision_point_total is bounded at 92 series. This change adds the guards, a rule mode that runs a point before its fit, the fit gate, a 5 s timeout, the record fields, the series bound and the first point, and amends ADR 0020. The fix-check chain is deferred to its own issue because the body gives no rule for when the check runs, what it repairs or how a round ends.

Acceptance criteria

Requirement: Guard order

The resolver chain SHALL run its guards before the rule and the model and SHALL stop at the first guard that fails.

Scenario: Guard stop

  • WHEN a guard stops the chain
  • THEN the decision records the resolver fallback with the band none and the name of the guard, and the chain sends no model request.

Requirement: Outer limits

The chain SHALL stop an extension when one more step does not fit each outer limit with its margin: the step or item seconds, the window share of 0.75, or the item tokens.

Scenario: Window share at the margin

  • WHEN the next step would take the window share above 0.75
  • THEN the guard stops the chain and no extension occurs.

Requirement: Loop guard

The chain SHALL stop an extension when the same call and answer repeat four times or the same failing call repeats three times.

Scenario: Repeated call

  • WHEN the digest holds the same call and answer four times
  • THEN the guard stops the chain and no extension occurs.

Requirement: Service drain

The chain SHALL not extend a run while the Service drains.

Scenario: Drain

  • WHEN the Service is draining
  • THEN the guard stops the chain and no extension occurs.

Requirement: Hard ceiling

The chain SHALL stop an extension whose value plus its step would pass the hard ceiling of its point.

Scenario: Ceiling reached

  • WHEN the next extension would pass the hard ceiling
  • THEN the guard stops the chain and no extension occurs.

Requirement: Rule before the fit

Before a fitted cut exists, the chain SHALL let only the rule act and SHALL record the model's answers with no band.

Scenario: Mode rule with no cuts file

  • WHEN a point with no cuts file runs in the mode rule
  • THEN the settings accept the mode, the rule gives the band, and the model's answers are recorded with no band.

Requirement: Fit bar

The model SHALL act only with a cut fitted on at least 30 labelled outcomes, at least 10 per label and a passing halves check.

Scenario: Fit below the bar

  • WHEN a point has 29 labelled outcomes
  • THEN the model stays recorded in shadow and the rule gives the band.

Requirement: Model fallback

When the model fails or does not answer within 5 s, the chain SHALL use the rule.

Scenario: Model timeout

  • WHEN the model does not answer within 5 s
  • THEN the chain records the rule's band and counts the timeout in the failed counter.

Requirement: Rule extension stands

Where the proven rule extends a step, the chain SHALL keep that extension in every mode except off.

Scenario: Rule extension in shadow

Requirement: One counter and both answers

The chain SHALL record the rule's band and the model's band on each decision and SHALL count each decision in the one decision counter.

Scenario: Series bound

  • WHEN the tests register every point and every mode
  • THEN the counter stays at or under its declared bound of 110 series and the record holds both bands.

Requirement: Sync-safe call

The chain SHALL return a band when the synchronous PrepareTools hook calls it inside a running event loop.

Scenario: Call inside a running loop

  • WHEN a test calls decide from inside a running event loop
  • THEN the chain returns a band and raises no running-loop error.

Requirement: First point

The implement.extension point SHALL use the chain and keep the #4464 rule.

Scenario: Model adds the second extension

  • WHEN the rule has extended the step to 12,000,000 tokens and the model is at or above its fitted cut
  • THEN the chain adds one more +50% extension up to the 16,000,000 ceiling.

Requirement: ADR 0020

ADR 0020 SHALL state the guard order, the four modes, the fit bar and the series bound.

Scenario: ADR text

  • WHEN the change merges
  • THEN ADR 0020 names the guard order, the modes off, shadow, rule and on, the fit bar and the bound of 110 series.

Existing Tool Considered

No open, maintained tool or library covers the need. The alternatives check of 2026-11-14 compared pydantic-ai (MIT, https://pypi.org/project/pydantic-ai) and guardrails-ai (Apache-2.0, https://pypi.org/project/guardrails-ai): guardrails-ai validates LLM output against schemas and offers no cap, mode or fit handling, and pydantic-ai supplies the model client only. No library supplies the guard order, the four modes, the fitted-cut gate, the record of both answers or the roadmap counters. The change extends the project's own ResolverChain in src/devops_cli/roadmap/decision_point.py and builds no second framework. The written cost to build, keep and fix that code until it matches the tool is about 1.5M tokens and 1 day.

Key questions

  • Which resolver acts before the cuts are fitted?: Only the rule acts, in the mode rule. The model answers and its answers are recorded with no band, which is the data of the next fit. There is no default cut: mode on is refused for a point with no fitted cuts file, and a cut in a constant is a guess that a test refuses. (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:64, 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:70, src/devops_cli/roadmap/decision_table.py:47]
  • What bar must a cut pass before the model acts?: At least 30 labelled outcomes, at least 10 per label, and the halves check of ADR 0019 rule 4: fit on one half and report on the other, with the halves swapped. A model error or a 5 s timeout falls back to the rule. (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:166, 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:70]
    • Chosen: 30 outcomes, 10 per label, halves check. The project's bar for a cut on labelled data (ADR 0020:166) and the split of ADR 0019 rule 4 (ADR 0020:70).
    • Rejected: Any fitted cut. A small sample overfits, and the halves check on the other half is what catches it.
  • How does a point run before it has a cuts file, when the settings refuse shadow and on without one?: With a fourth mode, rule: it needs no cuts file, the rule acts, and the model answers with its answers recorded and no band. check_modes accepts rule without a cuts file. Without it, implement.extension cannot be registered before a fit, so no model answer is ever collected and no fit can exist. (best practice) [sources: src/devops_cli/roadmap/decision_table.py:23, src/devops_cli/roadmap/decision_table.py:25, src/devops_cli/roadmap/decision_point.py:94, 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:64]
  • Does the proven rule's extension act in shadow and in rule?: Yes. The feat(roadmap): extend a step budget when the run makes progress #4464 rule is the only resolver of implement.extension with a measure (0 errors on 33 checkpoints from 28 items), and it extends today, so the chain keeps its extension in every mode except off. In shadow that is also the meaning of ADR 0020: the workflow acts as with off, and off is the rule. (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:32, 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:60, docs/ROADMAP_WORKFLOW.md:430]
    • Chosen: The rule's extension stands in every mode except off. The rule is measured and acts today; recording it in shadow only would regress a 0-error rule.
    • Rejected: The rule is recorded only in shadow, like the model. It drops the one extension with 33 measured checkpoints for the sake of the mode label.
  • What timeout bounds a cap decision?: A new constant CONST_ROADMAP_DECISION_POINT_TIMEOUT_SECONDS = 5.0, ten times the measured gateway p99 of 0.5 s over 3,027 Jev requests, set as DecisionPoint.timeout of the cap points. The chain keeps decide_all, which takes the timeout and sends the point's questions in one request; decide_with_jev has no timeout parameter. A timeout falls back to the rule. (best practice) [sources: src/devops_cli/config/constants.py:3950, src/devops_cli/roadmap/decision_point.py:134, src/devops_cli/ai/jev.py:223, src/devops_cli/roadmap/decision_point.py:365]
    • Chosen: 5 s, a new decision-point constant. Ten times the measured p99 leaves room for gateway variance and frees the sync hook quickly.
    • Rejected: Keep 30 s. Sixty times the p99; a slow gateway holds the synchronous PrepareTools hook for a whole Jev timeout.
    • Rejected: 1 s. Twice the p99 leaves no room for a slow gateway and would fall back on ordinary variance.
  • Do the cap decisions need their own counters?: No. The decision and its outcome are already carried by devops_cli_decision_point_total, the decision record and the outcome record, and devops_cli_roadmap_implement_extension_total counts each extension as extended or halted. The new record fields rule_band, model_band and guard hold what the body wanted from _cap_decisions_total and _cap_outcomes_total. Only the fix counters are new, and they go with the deferred fix-check issue. (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:92, 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:88, docs/ROADMAP_WORKFLOW.md:430]
    • Chosen: Reuse the decision counter, the records and the extension counter. ADR 0020 section 7 keeps one counter for one decision point, and the outcome record is the label source.
    • Rejected: Add devops_cli_roadmap_cap_decisions_total and _cap_outcomes_total. Two more counters for one decision point, against ADR 0020:92, and each adds label sets that no bound covers.
  • What is the series bound after the new mode and the first cap point?: 110: the 92 of ADR 0020 section 7, plus 18 for implement.extension (7 in shadow and 7 in on for a rule and a model, and 4 in rule for the three rule bands and the fallback none). CONST_ROADMAP_DECISION_POINT_MAX_SERIES, ADR 0020 section 7 and docs/TELEMETRY.md state the arithmetic, and the bound test reads the constant. (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:92, src/devops_cli/config/constants.py:3959, docs/TELEMETRY.md:139, src/devops_cli/roadmap/decision_point.py:153]
    • Chosen: Raise the constant to 110 with the arithmetic stated. The new point and the new mode write series, so the guard on the catalogue must name the new total, as fix(roadmap): decision points need cuts for shadow and run in async code #5272 did for 60 to 92.
    • Rejected: Keep 92 and count the rule mode in the extension counter only. It splits one point's decisions over two counters and hides the rule-mode decisions of the chain.
  • How does a guard stop appear in the decision counter?: As the resolver fallback with the band none, with the name of the guard in the new record field guard. A guard stop means the workflow does what it does today, which is the fail-back of ADR 0020, so it adds no resolver label and no series. (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:62, src/devops_cli/roadmap/decision_point.py:102]
    • Chosen: Resolver fallback plus the guard field. The guard stops the extension, so the workflow does what it does today, which is the fallback of ADR 0020:62; the log names the guard.
    • Rejected: A new Resolver.GUARD value. Two more series for each cap point in the counter, for a cause that the record already names.
  • Does the chain still depend on fix(roadmap): decision points need cuts for shadow and run in async code #5272?: No. fix(roadmap): decision points need cuts for shadow and run in async code #5272 has landed: decide and adecide send the request on the one portal of the process, the cuts load before the request, and the series bound is 92. The dependency is removed. [sources: src/devops_cli/roadmap/decision_point.py:290, src/devops_cli/roadmap/decision_point.py:390, src/devops_cli/config/constants.py:3959, openspec/changes/archive/2026-11-14-5272-decision-points-need-cuts-for-shadow/proposal.md]
  • Is the fix-check chain in scope for this change?: No. The body names a fixable check before a refusal and two counters but gives no rule for when the check runs, what it repairs or how a round ends. The fix-checks step of ADR 0021 section 8 gives one failed check per head with rounds left, and it is the starting point of the new issue. The soft-cap chain lands without it. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:190, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:210]
    • Chosen: Defer the fix-check chain. The body gives no rule that a test can check, so the soft-cap chain can reach Ready alone.
    • Rejected: Design the fix-check chain here. It invents a rule that the owner did not state and doubles the change.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    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 extends an existing decision-point mechanism with a new soft-cap and fix-check behaviour, not a critical defect.
    • Value: Medium. It lets a decision model extend a cap dynamically and run a fixable check before refusal, improving roadmap job completion.
    • Effort: Medium. The body states about 1.5M tokens and 1 day of work, covering guards, modes, fitting, counters, and an ADR amendment.
    • Related: chore(roadmap): track the decision model workflows #4408, which asks for a different change. Both work on the decision-model workflow in the roadmap subsystem; #4408 is the parent tracker while the candidate is a specific implementation of the soft-cap and fix-check chain.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Evidence from the decision-model study (2026-11-12)

    The study of how the decision model helps the workflows recommends against item 3 of this design: "Mode on before the fit: yes when the rule says yes or the model is at or above the default cut 0.5".

    Recommendation: before the fit, only the rule acts, and the model stays in shadow (or in the mode rule of item 2). The model acts only with its fitted cut (item 4).

    Also related: #5272 fixes the framework gaps that this design names. decide no longer calls asyncio.run, shadow needs a cuts file, and the series bound becomes 92.

    The owner decides.

  6. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: Searches for a library that enforces a soft cap with model-driven extension, modes, guards and a fix-check chain surfaced only generic validation/guard tooling (e.g. guardrails-ai, which validates LLM output against schemas) and the model/counter libraries the issue already uses, and none of them manages roadmap caps, fits or per-point outcomes. The need is a change to the project's own ResolverChain in decision_point.py — soft cap, guard order, off/shadow/rule/on modes, fitted cuts, sync-safe calls and bounded counters — which no external tool provides as a whole or in part.

    Tool: none found

    Lacks:

    • No library implements a soft cap that a decision model extends step by step up to a hard ceiling
    • No library supplies the guard order (resolver guard, no Service drain, no exact loop, no stuck/never-finding) around a project's own resolver chain
    • No library supplies the off / shadow / rule / on modes with rule answers recorded and the rule's yes standing
    • No library fits a cut on labelled halves and gates the model on it, nor records the rule and model answer per decision
    • No library provides the roadmap-specific outcome lines and the new bounded counters
    • guardrails-ai validates LLM output and offers no cap, mode or fit handling

    Tools considered:

    Searches run:

    • Python library detect repeated identical tool calls loop stuck detector agent, results: 5
    • open source library dynamic token budget cap extension guard rails for LLM agent decision points, results: 5
    • pydantic-ai budget cap usage limits agent run, results: 5
    • OpenHands StuckDetector repeated action observation loop detection, results: 5
    • OpenHands All-Hands-AI GitHub repository agent framework, results: 5
    • Python circuit breaker library pybreaker feature flag gradual rollout percentage, results: 5
    • guardrails-ai python library validate LLM output guardrails, 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.

  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 72e062d (see proposed design in issue body).

    Moved to new items: #5840.

  9. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 25, 2026
  10. removed
    status/in-review
    owner/agent
    on Nov 25, 2026
  11. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-25 06:00 UTC

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/mediumpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions