Skip to content

fix(roadmap): a new runner image clears only a stop that it can fix #3481

Closed

Description

@dan-petty

Problem

A new runner image clears each stop that the Service set, whatever the cause (stop_clear.py, rule digest). The docstring says Never a loop. But 15 release commits came in the window 2026-11-03T15:05Z to 2026-11-04T15:05Z, so the rule acts as a loop. The clears put old items first again, and new items wait. priority_order (stage.py:462) sorts by priority, then by the lowest number.

Caveat: the token share is sound. The hour share and the throughput claim are confounded with the GPU period before about 03:00Z. The mean reply of qwen3-coder:30b was 396 s and 362 s in the 2 h buckets to 03:05Z, then 5.7 to 17.3 s. Jobs of 125 to 161 minutes occur only before 03:00Z, and the digest Jobs at 18:02Z and 20:40Z alone take 5.2 of the 11.3 h. The one-image period held 19 Jobs. At those Job times, 8 hours hold about 3. So faster replies explain part of that result.

After 11-03T17:42Z no commit changed the shell policy or the step prompt: #3359 changed the policy at 17:15Z and #3361 changed the prompt at 17:42Z. No commit in the window changed the gateway route. So after the first image with those commits, a clear could not fix a cause in those files. Other code on the failure path did change (#3361, #3366).

Expected

A clear by digest runs only for a stop whose class has the action retry. A setting limits the attempts for each item and for each class. ci_infra gets this limit now, because lost tests are ci_infra today and that class has the action retry. Inside one priority, the next round takes an item with no attempt before a retried item.

No rule reads the files that an image changed. The Service holds only digests, and no image.revision label exists, so no map from a digest to commits exists.

This amends a default recorded in #2908 and delivered by #2912.

Acceptance criteria

  • A test: a new digest alone does not clear a stop of class plan_defect, refused_tool, premise_false or test.
  • A test: implement: retry still clears such a stop.
  • A test: a stop at the attempt limit stays until implement: retry, also for class ci_infra.
  • A test: inside one priority, a round takes the new item before the retried item.
  • A test: a round takes a retried item of a higher priority before a new item of a lower priority.
  • A test: a clear writes at most one comment for each item in a day.
  • k8s/README.md step 16 and docs/ROADMAP_WORKFLOW.md state the rule.
  • git grep "Never a loop" src/devops_cli/roadmap/stop_clear.py finds nothing.

Existing tool considered

Project code covers the need: _new_digest, is_service_stop, ACTION_BY_CLASS, priority_order and the record key implement.failure.

Dependencies

Related

Related: #3053, #3098, #3066, #2967, #2908, #2912

Proposed design

Problem statement

The digest-clear rule clears every stop when a new runner image rolls out. It loops on old items and spends tokens and hours on causes that the image cannot fix. The change limits a digest clear to stop classes with the action retry, adds attempt limits, orders new items before retried items within a priority, and caps clear comments.

Acceptance criteria

Requirement: Digest clear uses retry classes

The Service SHALL clear a stop by digest only when the stop class has the action retry.

Scenario: Non-retry class

  • WHEN A new runner image rolls out and the stop class is plan_defect, refused_tool, premise_false or test.
  • THEN The Service leaves the item Blocked and clears no stop.

Requirement: Digest clear for retry class

The Service SHALL clear a stop by digest when the stop class has the action retry and the attempt limits allow a clear.

Scenario: Retry class under the limit

  • WHEN A new runner image rolls out and the stop class is provider, timeout or ci_infra, and the item and class counts are below their limits.
  • THEN The Service clears the stop one time and records the class and digest.

Requirement: Explicit retry clears any stop

A trusted implement: retry comment MUST clear a stop of any class.

Scenario: Retry comment on non-retry class

  • WHEN A trusted person comments implement: retry after the stop comment for class plan_defect, refused_tool, premise_false or test.
  • THEN The next implement round clears the stop and sets the item Ready or Planned.

Requirement: Class attempt limit holds stop

The Service MUST leave a stop Blocked when the class digest-clear count reaches its setting.

Scenario: Class attempt limit reached

  • WHEN A stop of class ci_infra has reached the class digest-clear limit and a new runner image rolls out.
  • THEN The Service leaves the stop Blocked until a trusted implement: retry comment.

Requirement: Item attempt limit holds stop

The Service MUST refuse a digest clear when the item digest-clear count reaches its setting.

Scenario: Item attempt limit reached

  • WHEN An item has reached the item digest-clear limit and a stop of a retry class has a new runner image.
  • THEN The Service leaves the stop Blocked until a trusted implement: retry comment.

Requirement: New item before retried item

Within one priority, the implement round MUST take an item with no digest-clear attempt before an item with a digest-clear attempt.

Scenario: Same priority order

  • WHEN Two items of the same priority are eligible, and one has a digest-clear attempt and the other has none.
  • THEN The round takes the item with no attempt first.

Requirement: Higher priority retried item first

The implement round MUST take a retried item of a higher priority before a new item of a lower priority.

Scenario: Priority beats attempt state

  • WHEN A retried item has a higher priority than a new item of a lower priority.
  • THEN The round takes the retried higher-priority item first.

Requirement: One clear comment per day

A digest clear MUST write at most one comment for an item in a 24-hour window.

Scenario: Second clear in one day

  • WHEN The Service clears the same item a second time within 24 hours.
  • THEN The Service writes no second clear comment and records the clear in the job record.

Requirement: Documentation states the rule

k8s/README.md step 16 and docs/ROADMAP_WORKFLOW.md SHALL state the class-action rule, the attempt limits, the comment cap and the order.

Scenario: Documentation check

  • WHEN A reader opens step 16 or the stop and retry path.
  • THEN The text states that only retry classes clear by digest, the limits, and the order within a priority.

Requirement: Docstring text removed

The file src/devops_cli/roadmap/stop_clear.py MUST NOT contain the text Never a loop.

Scenario: Grep check

  • WHEN A developer runs git grep "Never a loop" src/devops_cli/roadmap/stop_clear.py.
  • THEN The command finds no match.

Requirement: No image file inspection

The digest-clear rule MUST NOT inspect the files that a runner image changed.

Scenario: Only digests available

  • WHEN The Service compares the old and new runner image digests.
  • THEN The rule uses the stop class and the attempt record and reads no image content.

Existing Tool Considered

No alternatives check has run. The need is covered by existing project code: _new_digest and is_service_stop in src/devops_cli/roadmap/stop_clear.py, ACTION_BY_CLASS in src/devops_cli/roadmap/failure.py, priority_order in src/devops_cli/roadmap/stage.py:462, and the implement.failure record key. The change extends this code and adds no external tool. No new tool is built, so no token or elapsed-time build cost applies.

Key questions

  • Which stop classes may a digest clear clear?: Only the classes whose action is retry: provider, timeout and ci_infra. A trusted implement: retry comment still clears any class. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, src/devops_cli/roadmap/failure.py, src/devops_cli/roadmap/stop_clear.py]
    • Rejected: All stop classes. It recreates the loop because a new image cannot fix a plan, premise or tool refusal.
    • Chosen: Classes with action retry. The action table already states whether a new attempt can help.
    • Rejected: Explicit allowlist in stop_clear.py. It duplicates ACTION_BY_CLASS and can drift from the failure table.
  • What limit applies to digest clears?: Use a per-class limit of 1 and a per-item limit of 3. Both limits are settings. Each retry class gets one automatic clear, and an item can spend one clear on each retry class. (best practice) [sources: k8s/README.md, docs/ROADMAP_WORKFLOW.md]
    • Chosen: Per-class limit 1 and per-item limit 3. It bounds the loop and still lets each retry class recover one time.
    • Rejected: Single limit of 1 for all. It can block a second retry class that a new image could fix.
    • Rejected: No limit. It keeps the loop that the issue reports.
  • How does the job record track digest clears?: Record a list in implement.digest_clears. Each entry holds the class, the image digest and the time. The item total is the list length, and the class total is the count of entries for that class. (best practice) [sources: docs/ROADMAP_WORKFLOW.md]
    • Chosen: List of clear entries. It gives the counts and an audit trail of each class and digest.
    • Rejected: Two counters only. It loses the class and digest history that a later round needs to explain the limit.
  • How does priority_order place a retried item?: Sort by priority first, then by whether the item has a digest-clear attempt with no attempt first, then by issue number. (best practice) [sources: src/devops_cli/roadmap/stage.py:462, docs/ROADMAP_WORKFLOW.md]
    • Chosen: Priority first, then attempt state, then number. It keeps priority as the first rule and takes new items before retried items inside one priority.
    • Rejected: Attempt state before priority. It would take a lower-priority new item before a higher-priority retried item.
    • Rejected: Issue number only. It keeps the old-item bias that the issue reports.
  • How does the Service avoid more than one clear comment per day?: Record implement.digest_clear_commented_at in the job record. Write the comment only when the time is absent or older than 24 hours, then set the time to now. The clear still records its attempt. (best practice) [sources: k8s/README.md, docs/ROADMAP_WORKFLOW.md]
    • Chosen: Record the comment time. It costs no request and survives a restart.
    • Rejected: Search issue comments for a marker. It costs a request for each clear and is fragile.
  • Does the rule inspect the files that a runner image changed?: No. The Service holds only image digests and no image.revision label, so it cannot map a digest to commits. The rule uses the stop class and the attempt record. [sources: k8s/README.md, src/devops_cli/roadmap/stop_clear.py]
  • Which documents must change for this rule?: Update k8s/README.md step 16 and docs/ROADMAP_WORKFLOW.md. Remove the text Never a loop from the stop_clear.py docstring. [sources: k8s/README.md, docs/ROADMAP_WORKFLOW.md, src/devops_cli/roadmap/stop_clear.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#3476

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 4, 2026
  2. dan-petty commented on Nov 4, 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/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P1-High. Documented waste of 22 Jobs and half of input tokens from clears that cannot fix the cause.
    • Value: High. Stops the loop of unproductive clears and lets new items run instead of old ones.
    • Effort: Medium. The code has the needed helpers; the change is a rule edit plus attempt-limit setting and ordering tweak.
    • Related: feat(roadmap): a stop sets status/blocked and a new runner image clears it once #2912, which asks for a different change. #2912 established that a new runner image clears a stop once; the candidate restricts that clear to stops whose class has the retry action.
  3. added
    priority/p1-high
    on Nov 4, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 4, 2026
  5. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    The stage job returned the item to New. The premise of the issue does not hold at the staging commit, so the job planned no change and opened no pull request.

    Evidence:

    placeholder

  7. added
    status/new
    and removed
    status/ready
    on Nov 4, 2026
  8. added
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 4, 2026
  9. removed
    status/in-review
    on Nov 4, 2026
  10. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-04 22:29 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/p1-highscope/roadmapsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions