Skip to content

fix(roadmap): the stage job stages no item (placeholder replies) #4204

Closed
2 of 2 issues completed
Closed

Description

@dan-petty

Problem

On 2026-11-09 the stage job of the roadmap Service stages no item. Prometheus gives, for the 24 hours up to 01:16 UTC: staged 0, failed 83, skipped 863. Before, staged was 40 on 2026-11-02, 38 on 2026-11-03, 17 on 2026-11-04, 8 on 2026-11-05 and 0 on the two days after. The model of the stage slot is deepseek-v4.1-flash-1017.

The Service log shows 25 rounds in 24 hours with the text "the stage job failed for N item(s)" for dan-petty/devops-cli. 15 of the 25 rounds hold a StructuredOutputValidationError ("1", "3", "8" or "9 schema violation(s)"). In the 25 rounds, 89 item failures name 42 distinct items. The same items fail again at each retry: #3243 and #3258 (both 5 times), #3389 and #3395 (5 times), #3069, #3076, #3258 and #4028 (4 times each). The circuit breaker then suspends the row, so the job spends its rounds on items that fail in the same way.

Cause: the model sends a reply of placeholders, and the gates refuse it right. About half of the RoadmapStageError failures show one pattern. The reply holds the text x or placeholder in why, existing_tool, feasibility, the task of group 1 and the path in changes. Each such reply fails 6 gates at once: placeholder text, text of 1 character, a task of one word, a verify command that is x, a path with no file, and no spec delta. The same reply is sent again in the second try. The pattern starts at 02:11 UTC on 2026-11-08, before the gates that were added that day (#4157, #4159, #4164, #4166, #4168, #4170), so a new gate did not cause it. The gates content (#3200 and #3367) and form refuse a reply that has no plan in it. Their refusals are right.

Gate refusals, from devops_cli_roadmap_stage_gate_refusals_total (the series exists since about 23:15 UTC on 2026-11-08, after the rollout of #4176, so the 24 hour and the 7 day windows give the same numbers: about 106 refused replies in 2 hours): content 22.7, spec-delta 19.5, paths 15.6, trace 13.5, form 12.1, citation 9.1, criteria 7.9, constants 3.0, eval-replay 2.8. The gates content, form, paths and spec-delta together are 66 percent, and a placeholder reply trips each of them.

Two other, smaller causes show in the log:

Evidence that the cause is not the poor input: #3612, #3069 and #3243 are all items that the job refused, and #3069 and #3243 have since closed by merged pull requests (#4185 and #4190). The issue bodies are 9 to 17 KB, as large as the bodies of items that the job stages.

Evidence for the model: the sample in #3566 on 2026-11-05 shows the same fault: "One of the two probe runs gave a plan with the placeholder x in every text field", and that run offered no tool in its second request because the messages reached the window. The ConfigMap now sets context_window: 256000 for the slot analysis, so the window may not be the cause today. This is not verified.

Expected

The stage job stages most of the items that it takes in a round, and a reply of placeholders does not use up the retry of the item.

Acceptance criteria

  1. The Service logs, for each refused reply, the size of the request in tokens, the number of the request in the plan run, and whether a tool was offered. kubectl -n devops logs deploy/roadmap-service | grep "stage reply refused" prints these three values for a refused reply. It prints nothing today.
  2. A refused reply is kept under the data directory of the Service, with the key of the item, for 7 days, as the gated plan is (feat(roadmap): keep the gated stage plan as a file #4167). kubectl -n devops exec deploy/roadmap-service -- ls /home/devops/.data/roadmap/stage/dan-petty/devops-cli lists a file for a refused reply. It lists only the file of a plan that passed the gates today (3612.json).
  3. A reply in which every text of the plan is a placeholder ends the plan run at once and counts as the result degenerate, not a second try that sends the same request. uv run devops roadmap eval stage --model deepseek-v4.1-flash-1017 reports the number of such replies, and it reports 0 for the golden cases. Today the report has no such count.
  4. sum by (result) (increase(devops_cli_roadmap_stage_total[24h])) shows staged above 0 for each 24 hours in which an item is Ready and has a plan that passes the gates. Today the sum is staged 0, failed 83.
  5. The cause of the placeholder reply is found and named in this issue: window, toolset, the output tool of the structured reply, or the model. The fix removes it. If it is the model, the stage slot names another model, as the owner decision of 2026-11-07 (feat(k8s): the Service uses one model for every chat slot #3874) allows ("undo it when most steps work most of the time").

Scope of the delivery (pull request #4260)

The pull request delivers these criteria:

  • 1, the log fields. The line is stage reply refused: item=#<n> request=<n> input_tokens=<n> tools_offered=<bool> result=<refused|degenerate>.
  • 2, the kept refused reply, with one change. The file is roadmap/stage/<owner>/<repo>/<n>.refused.json. It holds the first and the second refused reply with their problems. The staging of the item deletes it. The 7-day age limit is removed from the criterion: its premise is false, because the plan file of feat(roadmap): keep the gated stage plan as a file #4167 has no age limit either (it goes when the item is staged or its input changes). The refused file has a size bound instead.
  • 3, the degenerate result for a reply that is a placeholder in every text, in the stage metric and in the line "how the cases ended" of devops roadmap eval stage.

Criteria 4 and 5 are not delivered here. #4205 holds them, and merged changes removed the causes: the gateway answered behind a fallback model (#4216), the reference reason could be null (#4215), the reply was cut at 4096 output tokens (#4224), the window estimate dropped the tools too early (#4238), and tool calls were joined (#4243). The check of criterion 4 needs a day of Service data after the rollout. If staged stays 0 then, a person reopens #4205 with the kept refused replies as evidence.

A schema violation (StructuredOutputValidationError) is not a refused reply. The reply does not reach the gates, so it is out of this delivery.

Existing tool considered

  • pydantic-ai output validators with ModelRetry (the library already in use) cover a retry of an invalid reply. They do not tell why the reply is empty.
  • devops roadmap eval stage --model <group> (the replay) measures the rate of such replies on the golden cases. The step needs the count of acceptance criterion 3.
  • The metrics of feat(telemetry): step seconds and a gate counter for the stage row #4066 and feat(telemetry): send stage step seconds and gate refusal counts #4176 (devops_cli_roadmap_stage_gate_refusals_total, devops_cli_roadmap_step_seconds) show which gate refuses, and they do not show the cause of a refused reply. devops_cli_roadmap_step_seconds returned no series in Prometheus on 2026-11-09 for either row, so the step times are not verified.
  • No tool is built here: the first step is to log and keep what the job refuses.

Cost

Tokens to build: about 150,000 for the log fields, the kept reply and the degenerate result with tests. Tokens to keep: low, the reply file has an age limit. Tokens to fix: unknown until the cause is known; one eval run with deepseek-v4.1-flash-1017 costs about 0.002 USD a call (README, item 19 of the Roadmap service). Elapsed time: about 3 hours to build, plus one day of Service data to read.

Related

#3566 (cloud baseline of the stage eval; the sample that shows the placeholder reply), #3394 and #3395 (placeholder checks in the plan; #3395 fails in the stage job today), #3387 (an item whose plan fails the check), #3037 (the planner cannot read code), #4167 (the plan file), #4176 (the metrics), #3478 (devops roadmap repair, set back items that a placeholder reply stalled), #4060 (class-based retry).

Proposed design

Problem statement

The stage job stages no item because the model often sends a reply of placeholders, and the gates refuse it. The Service does not log the request size, the request number or tool availability for a refused reply. It also keeps no refused reply, so the cause cannot be read. This change adds those records and ends an all-placeholder run at once as degenerate. A follow-up issue uses the records to remove the cause.

Acceptance criteria

Requirement: Refused reply log fields

The stage job SHALL log one stage reply refused record for each refused model reply, with the request token count, the request number in the plan run, and whether a tool was offered.

Scenario: A refused reply is logged

  • WHEN The stage job refuses a model reply for an item.
  • THEN The log holds one stage reply refused record with the item key, the request token count, the request number and the tool-offered flag.

Requirement: Kept refused reply

The stage job SHALL save each refused model reply under the Service data directory at the stage record path of its item, and SHALL remove the file after 7 days.

Scenario: A refused reply is kept for 7 days

  • WHEN The stage job refuses a model reply for an item.
  • THEN The stage record directory holds the reply file, and the cleanup removes it when the file is older than 7 days.

Requirement: Degenerate reply ends the run

The stage job SHALL end a plan run at once with the result degenerate when the reply is a placeholder in every plan text field, and SHALL NOT send the same request again.

Scenario: An all-placeholder reply is not retried

  • WHEN The model replies to a stage request with x or placeholder in why, existing_tool, feasibility, the first task and a changes path.
  • THEN The plan run ends after one model call with the result degenerate, and the retry path is not used.

Requirement: Eval degenerate count

The stage eval command SHALL report the number of degenerate replies for the model under test, and SHALL report zero for the golden cases.

Scenario: Golden cases report zero

  • WHEN uv run devops roadmap eval stage --model deepseek-v4.1-flash-1017 runs on the golden cases.
  • THEN The report holds a degenerate count of 0.

Requirement: Separate degenerate metric

The stage metric SHALL count a degenerate reply under result="degenerate" and SHALL keep staged separate from failed.

Scenario: A degenerate reply is counted

  • WHEN A stage run ends with a degenerate reply.
  • THEN devops_cli_roadmap_stage_total{result="degenerate"} increases by 1, and devops_cli_roadmap_stage_total{result="staged"} does not change.

Existing Tool Considered

No alternatives check has run. pydantic-ai output validators with ModelRetry are already in use. They retry an invalid reply but record no request size, request number or tool availability. They also detect no all-placeholder reply. The project builds these fields, the kept reply and the degenerate result itself.

The written cost is about 150,000 tokens to build and test. The cost to keep is low, because the reply file has a 7-day age limit. The cost to fix is unknown until the cause is known. The elapsed time is about 3 hours, plus one day of Service data to read.

Key questions

  • Where should the stage job keep a refused reply, and for how long?: Keep it in the existing stage record directory under the Service data directory, keyed by item, with the same 7-day age limit as the gated plan. (best practice) [sources: src/devops_cli/roadmap/stage/stage_plan_record.py, src/devops_cli/roadmap/stage/stage.py]
    • Chosen: Reuse the stage record directory with a 7-day age limit. It matches the gated plan record (feat(roadmap): keep the gated stage plan as a file #4167), and one cleanup path serves both files.
    • Rejected: Write to a new directory with no age limit. It adds a second retention rule and can grow without bound.
    • Rejected: Log the reply and keep no file. The log has no full reply, so the cause cannot be read.
  • How should the stage job detect an all-placeholder reply before the gates?: Reuse the existing placeholder and minimum-length checks in stage_validate.py. Treat the reply as degenerate when the placeholder checks fail in every plan text field. (best practice) [sources: src/devops_cli/roadmap/stage/stage_validate.py, tests/roadmap/stage/test_roadmap_stage_gates.py]
    • Chosen: Reuse the existing placeholder checks. One rule set keeps the gates and the degenerate result aligned.
    • Rejected: Add a second keyword list. Two lists drift and give different results.
    • Rejected: Let the gates run and count their refusals. The run still retries and spends the item.
  • Should a degenerate reply use the existing retry or end the run?: End the plan run after the first degenerate reply with the result degenerate. Do not send the same request again. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, tests/roadmap/stage/test_roadmap_stage_retry.py]
    • Chosen: End at once with degenerate. The body shows the same reply returns on the second try, so a retry cannot help.
    • Rejected: Use the existing retry. It spends the retry and the item fails again.
    • Rejected: Treat it as failed. The metric then hides a distinct model fault.
  • What fields should a refused reply log?: Log the item key, the request token count, the request number, the tool-offered flag and the result on one stage reply refused line. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/ai/client/structured.py]
    • Chosen: One structured log line with the fields. The acceptance check can grep one line, and the fields answer the window and toolset questions.
    • Rejected: Metrics only. Metrics cannot hold the request number or the item key at low cardinality.
    • Rejected: The full reply in the log. The reply is large and can hold secrets; the file is the record.
  • Should degenerate be a new result in the stage metric and the eval report?: Add degenerate as a distinct result in both the stage metric and the eval report. Keep failed for gate and schema refusals. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/stage/stage_eval_run.py]
    • Chosen: Add a distinct degenerate result. It separates this model fault from other failures and meets the metric and eval criteria.
    • Rejected: Count it as failed. It hides the placeholder rate and gives no count for the eval.
    • Rejected: Count it as skipped. The item was not skipped; the model replied.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Sub-issues

Sub-issues

2 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 9, 2026
  2. dan-petty commented on Nov 9, 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. The stage job produced zero staged items for several days, so the core function of the roadmap Service is down.
    • Value: High. Users depend on the stage job to move items forward; zero output blocks the entire roadmap pipeline.
    • Effort: Medium. Multiple causes are identified (model prompt, retry logic, logging), but each is a targeted change in the stage slot and its retry path.
    • Related: fix(roadmap): a placeholder reply of a model moves no item #3478, which asks for a different change. Both concern placeholder text in the stage job, but #3478 stops the system from accepting placeholders as valid results, while this candidate stops the model from producing them and prevents the retry loop from exhausting all rounds.
  3. added
    priority/p1-high
    on Nov 9, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 9, 2026
  5. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

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

    Moved to new items: #4205.

  6. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 9, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 9, 2026
  8. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor
  9. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-09 21:49 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