Skip to content

feat(roadmap): fit soft-cap values and cuts from measured outcomes #4871

Open

Description

@dan-petty

Problem or Motivation

Phase B of the owner rule: after a job holds 80%, its caps and restrictions are tuned from real performance. The soft-cap values and the model cuts start as seeds and defaults (cut 0.5, p90 ask 728 s, Wilson seeds from 42 records). #3241 and #4218 tune the tool answer caps of the planner and do not cover these points.

Proposed Solution & Architectural Design

A weekly fit that reuses the issue stewards calibration code (no second calibrator): join the decision and outcome lines of 14 days (28 when samples are few); fit each point's cut with the ADR 0020 bar (>= 30 labelled outcomes, >= 10 per label, halves check); fit soft values as the 0.95 quantile of passed runs only with n >= 59, and count runs that a cap stopped as right-censored (statsmodels SurvfuncRight); refit the per-code fix rates (Wilson). A value moves at most 25% per run; a pinned setting always wins; hard ceilings stay reviewed repository values, and the fit only proposes a new ceiling in a PR. Output: a PR that updates the cuts and defaults data files, and a log line per signal (value, source fitted or default, n, window). Runs only for a job that holds 80% (#4845); when a job loses its hold, its points go to mode rule at their last values.

Target Subsystem

SDLC, Git & PR Governance (roadmap decision points and their fits).

Existing Tool Considered

The calibration code of #4817 (no second calibrator); statsmodels proportion_confint (Wilson) and SurvfuncRight. Cost to build: about 1.5M tokens, 1 day.

Acceptance Criteria

  • On a fixture with n < 30 the source stays default.
  • On a fixture with censored runs the quantile is not lower than the passed-runs quantile.
  • A test: a value never moves more than 25% in one run.
  • A test: a pinned setting wins.
  • The fit opens no PR for a job under 80%.

Dependencies

#4845 shows that the job holds 80%; #4847; #4851; #4817 (the issue stewards calibration code).

Related: #3241 and #4218 (planner tool answer caps), #4410 (no mode on without a fitted cut).

Source: #4843

Alternatives check of 2026-11-21: in-use.
The repository already uses this tool.
Tool: statsmodels (https://pypi.org/project/statsmodels), BSD-3-Clause, last activity 2026-08-30, maintained.
Reason: Searches found no tool that runs a weekly outcome-driven fit; statsmodels, already in the repository, supplies the Wilson interval and the censored 0.95 quantile, but the join, gates, clamp and PR delivery are project glue.

Covers:

  • Wilson interval for each per-code fix rate
  • Survival fit that counts cap-stopped runs as right-censored
  • 0.95 quantile from the survival curve

Lacks:

  • 14-day or 28-day join of decision and outcome lines
  • ADR 0020 bar of 30 outcomes, 10 per label, halves check
  • 25% per-run clamp and pinned-value precedence
  • Hard-ceiling proposal in a pull request
  • 80% hold gate and fallback to the rule resolver
  • One log line per signal with value, source, n, window

Proposed design

Problem statement

Phase B of the owner rule tunes the caps and restrictions of a job after it holds 80%. The soft-cap values and the decision-point cuts still start as seeds and defaults: cut 0.5, p90 ask 728 s, and Wilson seeds from 42 records. One weekly fit joins decision and outcome lines, fits the cuts and soft values from measured outcomes, and proposes each value change in one pull request. It keeps a default or a pinned value when the evidence is too small, and it opens no pull request for a job under the hold.

Acceptance criteria

Requirement: Outcome floor keeps the default

The fit SHALL keep a decision point at its default value when the point holds fewer than 30 labelled outcomes.

Scenario: Twenty-nine labelled outcomes

  • WHEN A fixture holds 29 labelled outcomes for one decision point.
  • THEN The fit writes the source as default for that point and changes no cut value.

Requirement: Label floor keeps the default

The fit SHALL keep a decision point at its default value when one label of the point holds fewer than 10 outcomes.

Scenario: Nine outcomes in one label

  • WHEN A fixture holds 40 labelled outcomes with 9 in the review label.
  • THEN The fit writes the source as default for that point.

Requirement: Held-out half keeps the default

The fit SHALL keep the default when the cut fitted on one fixed half misses the point's bar on the other half.

Scenario: Held-out half misses the bar

  • WHEN A fixture fits a cut on the first half that misses the point's bar on the second half.
  • THEN The fit keeps the default and writes the held-out result to the log.

Requirement: Cap-stopped runs are censored

The soft-value fit SHALL count a run that a cap stopped as a right-censored observation in SurvfuncRight.

Scenario: One cap-stopped run

  • WHEN A fixture holds passed runs and one run that a cap stopped at a lower value.
  • THEN The fitted 0.95 soft value is not lower than the quantile of the passed runs alone.

Requirement: Soft-value floor

The fit SHALL fit a soft value only when the window holds at least 59 runs for the signal.

Scenario: Fifty-eight runs

  • WHEN A fixture holds 58 runs for one signal.
  • THEN The fit writes the source as default for that signal.

Requirement: Per-run clamp

A fitted value SHALL move at most 25% from its previous value in one run.

Scenario: A fit jump of 60%

  • WHEN A fixture produces a fitted value 60% above the previous value.
  • THEN The fit writes the previous value times 1.25 and writes a log line for the clamp.

Requirement: Pinned value wins

A pinned setting MUST win over a fitted value.

Scenario: Pinned point

  • WHEN A fixture pins a point and the fit produces a different value.
  • THEN The fit writes the pinned value and writes the source as pinned to the log.

Requirement: Wilson fix rate

The fit SHALL refit each per-code fix rate with a Wilson interval from proportion_confint.

Scenario: Twenty-two fixes in 25 attempts

  • WHEN A fixture holds 22 fixes in 25 attempts for one code.
  • THEN The fit writes the point 0.88 and the interval [0.70, 0.96].

Requirement: Hard ceiling stays reviewed

The fit SHALL keep each hard ceiling at its reviewed repository value and only propose a new ceiling in the pull request.

Scenario: Soft value above the ceiling

  • WHEN A fixture gives a soft value above the hard ceiling.
  • THEN The cuts file keeps the ceiling and the pull request body proposes the new ceiling.

Requirement: No pull request under the hold

The fit SHALL open no pull request for a job that does not hold 80%.

Scenario: Job grade 70

  • WHEN A fixture gives the job a grade of 70.
  • THEN The fit opens no pull request and writes to the log that the job lost its hold.

Requirement: Rule resolver at the last value

The fit SHALL leave each point of a job that lost its hold at its last value and SHALL let its rule resolver answer.

Scenario: Hold lost between runs

  • WHEN A fixture moves the job grade from 80 to 70 between two runs.
  • THEN Each point of the job keeps its last value and the rule resolver answers for it.

Requirement: One log line per signal

The fit SHALL write one log line per signal with its value, its source, n and the window.

Scenario: One signal

  • WHEN The fit runs on a fixture with one signal.
  • THEN The log line holds the value, the source fitted or default, n and the window.

Requirement: Pull request holds the change

The fit MUST write each value change in a pull request and never on the default branch.

Scenario: One cut change

  • WHEN The fit changes one cut on a fixture.
  • THEN One pull request holds the new value and the default branch is unchanged.

Requirement: Window widens when samples are few

The fit SHALL join decision and outcome lines over 14 days, and over 28 days when the 14-day window holds fewer than 30 labelled outcomes.

Scenario: Few outcomes in 14 days

  • WHEN A fixture holds 20 labelled outcomes in 14 days and 40 in 28 days.
  • THEN The fit uses the 28-day window and writes that window to the log.

Requirement: One calibrator

The fit SHALL reuse halves, fit_cuts and evaluate_cuts of decision_fit.py and MUST NOT add a second calibrator.

Scenario: One fit module

  • WHEN The change adds the weekly fit.
  • THEN The fit imports halves, fit_cuts and evaluate_cuts from decision_fit.py and adds no second fit module.

Existing Tool Considered

statsmodels (https://pypi.org/project/statsmodels), BSD-3-Clause, is in use and maintained. The alternatives check in the issue body gives what it covers and lacks. The proposal uses statsmodels for the Wilson interval and the censored 0.95 quantile. It adds the project glue that the check lists as lacking. The body gives about 1.5M tokens and 1 day to build and keep that glue.

Key questions

  • Which library gives the Wilson interval and the censored 0.95 quantile?: statsmodels 0.15.0 is a locked dependency. The repository already calls proportion_confint with the wilson method for a Wilson interval in job_grade.py. statsmodels also supplies SurvfuncRight for a survival fit with right-censored observations and its quantile. The proposal uses that class for the censored 0.95 quantile. [sources: pyproject.toml, src/devops_cli/roadmap/job_grade.py, docs/guidelines/agentic-jobs.md]
  • Which sample gate decides that the fit sets a point's cut?: The point's ADR 0020 bar: at least 30 labelled outcomes with at least 10 of each label. The cut fitted on one fixed half must also meet the bar on the other half. Below the bar the point keeps its default value. The fit reuses halves, fit_cuts and evaluate_cuts of decision_fit.py. (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_fit.py]
    • Chosen: ADR 0020 bar: 30 outcomes, 10 per label, held-out halves. The project records the per-point bar and the held-out halves. decision_fit.py already implements the fit, the score and the split.
    • Rejected: A fixed floor of 59 runs for every fit. 59 is the floor of the soft value. A cut fit with 30 labelled outcomes has enough labels.
    • Rejected: No floor. A fit on few outcomes follows noise and moves a cut with no evidence.
  • What does the halves check compare?: It fits the cut on one fixed half of the labelled cases. It scores the cut on the other half with evaluate_cuts. It repeats with the halves swapped. The fit keeps the default when the cut misses the point's bar on the half that was not fitted. It does not compare two fitted cuts. [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_fit.py]
  • How does the soft-value fit treat a run that a cap stopped?: As a right-censored observation in SurvfuncRight. The 0.95 soft value comes from the survival curve. The fit uses the lower bound that a cap stop gives instead of dropping the run or counting it as a failure. (best practice) [sources: docs/guidelines/agentic-jobs.md]
    • Chosen: SurvfuncRight with cap-stopped runs censored. A cap stop gives a lower bound on the run. The survival fit uses that bound.
    • Rejected: Drop the cap-stopped runs. It biases the quantile low, because the longest runs are the ones a cap stopped.
    • Rejected: Count the cap-stopped runs as failures. A cap stop is not a failed run.
  • Which window does the join use?: 14 days, widened to 28 days when the 14-day window holds fewer than 30 labelled outcomes. The 14-day window gives two 7-day grade windows. The project measured labelled checkpoints over 14 days in pilot 3. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, docs/roadmap/job-success.md, 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]
    • Chosen: 14 days, and 28 days when samples are few. It keeps the weekly fit responsive and still gives enough outcomes after a change. The project measured labelled checkpoints over 14 days in pilot 3.
    • Rejected: Always 28 days. It reacts slowly to a regression.
    • Rejected: Always 14 days. It gives too few outcomes after a change.
  • How does the fit deliver a new value?: As one pull request that updates the cuts and defaults data files. The fit never pushes to the default branch. A person merges the pull request. (best practice) [sources: CONTEXT.md, docs/adr/0004-ci-is-the-authoritative-gate.md, docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md]
    • Chosen: One pull request with the new values. ADR 0004 gates the merge on the required checks. A person merges.
    • Rejected: Commit to the default branch. It bypasses the required checks and the review.
    • Rejected: Write the values at runtime in a config store. It leaves no record in git and no review of the new value.
  • What happens to a point when its job loses the 80% hold?: The point keeps its last value and its rule resolver answers. The fit opens no pull request for it. A decision point's modes are off, shadow and on, so rule is the resolver that answers and not a mode. (best practice) [sources: docs/roadmap/job-success.md, docs/guidelines/agentic-jobs.md, 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/job_grade.py]
    • Chosen: Rule resolver at the last value. A lost hold means the fitted value is not trusted. The last value keeps the behavior known.
    • Rejected: Keep the fitted value in shadow mode. It keeps a value that the lost hold no longer supports.
    • Rejected: Reset the point to its seed default. It discards measured values that the job can use again when it regains the hold.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4817, #4847

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 refines existing caps for jobs that already hold 80%, so it improves accuracy but does not block a release or fix a defect.
    • Value: Medium. It reduces over-cutting and under-cutting for decision points, but only for jobs that already meet the 80% hold threshold.
    • Effort: Medium. The body estimates about 1.5M tokens and 1 day of work, reusing existing calibration code.
    • Related: feat(roadmap): split thresholds come from measured job history #4817, which asks for a different change. Both fit parameters from measured job outcomes and share the calibration code, but #4817 computes split thresholds while the candidate fits soft-cap values and model cuts.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches found no maintained tool that performs this fit end to end — joining decision and outcome lines, applying the ADR 0020 labelling bar and the 25% per-run clamp, then opening a PR. statsmodels, which the issue itself names, supplies the statistical primitives the fit rests on: Wilson intervals for the per-code fix rates and a survival fit that treats cap-stopped runs as right-censored, so the rest is project-specific glue over it.

    The repository already uses this tool.

    Tool: statsmodels (https://pypi.org/project/statsmodels)

    • License: BSD-3-Clause
    • Last activity: 2026-08-30
    • Maintained: yes

    Covers:

    • Wilson interval for a proportion (proportion_confint), for the per-code fix rates
    • Survival-function estimation with right-censored observations (SurvfuncRight), so runs a cap stopped are counted as censored
    • Quantile of a fitted survival curve, for the 0.95 soft value of passed runs

    Lacks:

    • The 14-day (28-day when samples are few) join of decision and outcome lines
    • The ADR 0020 labelling bar of >= 30 labelled outcomes and >= 10 per label, with the halves check
    • The rule that a value moves at most 25% per run and that a pinned setting wins
    • Proposing a new hard ceiling in a PR, with hard ceilings kept as reviewed repository values
    • The per-signal log line (value, source fitted or default, n, window)
    • The 80% hold gate and the move of points to rule mode at their last values when the hold is lost

    Tools considered:

    Searches run:

    • statsmodels SurvfuncRight right-censored quantile proportion_confint Wilson, results: 5
    • python library fit decision threshold from labelled outcomes calibration, results: 5
    • scikit-survival python package Kaplan-Meier censored, results: 5
    • statsmodels documentation survival analysis censored data, results: 5
    • open source tool automatically tune thresholds from outcome data with censoring, 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. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at ca62d6a while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/roadmap/decision_point.py, src/devops_cli/roadmap/decision_registry.py.

  7. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 9f40f15 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/roadmap/decision_fit.py.

  8. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies 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/mediumpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions