Skip to content

feat(roadmap): one research unit runs its steps just in time #5513

Open

Description

@dan-petty

Problem or Motivation

The alternatives row runs on items that can wait for weeks (the model-lane row takes 719 min for a pass), so its result is old when stage runs. References (#4672) has no unit. Refine has no barrier, so it can run again after each research result. The approved pipeline split design (tracker #5482) runs one research unit for each item, just in time.

Proposed Solution & Architectural Design

Target Subsystem

Roadmap Service and roadmap jobs (src/devops_cli/roadmap/, the research unit).

Acceptance Criteria

  • Test first: due_jobs selects only the window items and P0 items. The test fails on the base.
  • A test: refine is not due until each step has a result or a typed failure.
  • A test: a refine write makes no research step due.
  • Live proof: after the merge and the release, the unit runs as the App in mode plan on the next 5 items of the stage window. A comment on this issue gives the result lines with tokens and cost_usd_micros for each step.

Existing Tool Considered

alternatives.py, stage_references.py, page_fetch.py and SearXNG exist, and Argo semaphores are installed. Build: 300,000 to 600,000 agent tokens and 1 to 1.5 days.

Related

Tracker #5482, Phase 6. Depends on #4573, #4672, #5512, #5506 and #5504. #4676, #4682, #4864, #4960, #5049, #4624, #2951.

Source: #5482

Alternatives check of 2026-11-30: in-use.
The repository already uses this tool.
Tool: Argo Workflows (https://github.com/argoproj/argo-workflows), Apache-2.0, last activity 2026-11-29, maintained.
Reason: Argo Workflows, which the project already uses, supplies the semaphore, the step order and the pod template. No tool supplies the stage-window due selection, the outside-hash freshness or the refine barrier.

Covers:

  • Semaphore that limits concurrent workflows
  • DAG and step dependencies in one workflow
  • Pod template for a two-container step

Lacks:

  • Selection of stage-window and P0 items only
  • Per-step record keyed by the outside hash
  • Refine barrier over all research steps

Proposed design

Problem statement

The alternatives row can wait weeks, so its result is old when stage runs. References has no unit. Refine has no barrier, so it can run again after each research result. The change adds one research unit for each item, with just-in-time due rules, per-step result records, and a refine barrier.

Acceptance criteria

Requirement: Research due selection

The roadmap due selector SHALL select only next-stage-window items and P0 items with no current-hash result, and SHALL run the 30-day alternatives recheck only in the window.

Scenario: Window and P0 items are due

  • WHEN due_jobs runs on a fixture with 30 stage-window items, one P0 item with no current-hash result, one P1 item outside the window, and one 30-day recheck item outside the window.
  • THEN It returns the 30 window items and the P0 item, and no other item.

Requirement: Research step result record

Each research step SHALL write a research.<step> record with its at time and the current outside hash.

Scenario: Alternatives step writes its record

  • WHEN The alternatives step completes for an item with outside hash H.
  • THEN The research.alternatives record holds the completion time and H.

Requirement: Refine barrier

The refine due check SHALL return true only when every research step for the current hash has a result or typed failure and one result is newer than refine.at.

Scenario: A missing step result blocks refine

  • WHEN One research step for the current outside hash has no result and no typed failure.
  • THEN The refine due check returns false.

Requirement: Refine write does not trigger research

A refine write SHALL NOT set any research step due mark.

Scenario: Refine write leaves research due marks clear

  • WHEN Refine writes its result for an item after all research steps are current.
  • THEN No research.<step> due mark exists for that item.

Requirement: Pending a person after the merge

The released research unit MUST run as the App in mode plan on the next 5 items of the stage window.

Scenario: Live plan-mode run

  • WHEN After the merge and the release, a person runs the released unit as the App in mode plan on the next 5 items of the stage window.
  • THEN The live proof shows one result line for each step with tokens and cost_usd_micros, and the issue comment holds them.

Existing Tool Considered

The alternatives check in the issue body records in-use for argoproj/argo-workflows (Apache-2.0, maintained). The repository already uses Argo Workflows. The block lists what the tool covers and lacks. The proposal uses Argo Workflows for the covered parts. It adds the per-item due rules, outside-hash freshness, typed failures and refine barrier as roadmap code in src/devops_cli/roadmap/. The token cap is deferred to a separate issue.

Key questions

  • Which tool runs the research unit's semaphore, step order and pod template?: Use argoproj/argo-workflows. The alternatives check in the issue body records in-use. Argo Workflows supplies the covered parts that the block lists. The roadmap code adds the per-item due rules, outside-hash freshness, typed failures and refine barrier. (best practice) [sources: CONTEXT.md, AGENTS.md, src/devops_cli/roadmap/alternatives.py]
    • Chosen: argoproj/argo-workflows. The repository already uses it. It covers the semaphore, step order and pod template. The alternatives check records in-use.
    • Rejected: temporalio/temporal. It adds a durable workflow engine for a small per-item scheduler and does not remove the custom due rules.
    • Rejected: custom scheduler. It rebuilds semaphore and step dependencies that Argo Workflows already provides.
  • How does due_jobs choose the research window?: It selects the next stage window, about 30 items in stage selection order, plus P0 items with no result for the current outside hash. The 30-day alternatives recheck runs only in the window. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/fix_checks_row.py:5]
    • Chosen: Stage window plus P0. It keeps research just in time and still covers critical items.
    • Rejected: All items. It runs research on items that can wait for weeks and spends tokens early.
    • Rejected: Fixed interval only. It makes the result old when stage runs.
  • How does a research step record its result and failure?: Each step writes research.<step> with its at time and the current outside hash. A typed failure writes the same key with a failure class and no result. The refine barrier treats the typed failure as complete. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/fix_checks_row.py:5]
    • Chosen: Valkey research.<step> record. Valkey already holds the due marks and shared roadmap state.
    • Rejected: Issue comment. A comment is not machine state and is slow to read.
    • Rejected: Separate database table. It adds a store where Valkey already holds the state.
  • When is refine due after research?: Refine is due when every research step for the current hash has a result or typed failure, and one result is newer than refine.at. (best practice) [sources: CONTEXT.md]
    • Chosen: All steps current and one newer than refine.at. It prevents refine from running before every step is current and still lets it run after new research.
    • Rejected: Any step newer than refine.at. It lets refine run before all steps finish.
    • Rejected: Fixed interval after the last step. It can run on old results or wait after a current result.
  • How does a refine write avoid making research due?: A refine write updates refine.at only. It sets no research.<step> due mark. (best practice) [sources: CONTEXT.md]
    • Chosen: Update refine.at only. It stops the refine-research loop.
    • Rejected: Recompute all research due marks. It makes research due after each refine write.
  • Which pod template runs the research unit?: Use the two-container template from feat(roadmap): the model container of a unit holds no credential #5506. (best practice) [sources: CONTEXT.md]

Fit

Fits in one pull request.

Suspected block

Stage and implement funnel steps reach band 70.

Dependencies

#4573, #4672, #5512, #5506, #5504

Watched files

A commit on the default branch that changes one of these files starts the next refine round.

  • src/devops_cli/roadmap/job_funnel.py

Activity

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

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: Searches found no research-unit tool; Argo Workflows, the project's existing engine and semaphore source, supplies semaphore-limited concurrency and step dependencies, but the per-item due rules, hash freshness and token caps stay custom.

    The repository already uses this tool.

    Tool: argoproj/argo-workflows (https://github.com/argoproj/argo-workflows), Apache-2.0, last activity 2026-11-17, maintained.

    Covers:

    • Semaphore research 1 caps concurrent research units
    • Step dependencies sequence alternatives before references
    • Two-container pod template for the unit
    • Cron schedules for the 30-day alternatives recheck

    Lacks:

    • Per-item due from stage window and P0 marks
    • Outside-hash freshness and typed failure records in Valkey
    • Per-item token cap from measured cost
    • Refine due rule comparing step results with refine.at
    Searches (7)

    Tools considered:

    Searches run:

    • workflow orchestration per-item just-in-time scheduling dependency barrier research steps, results: 5
    • Argo Workflows semaphore concurrency limit cron workflow steps, results: 5
    • argoproj argo-workflows github semaphore synchronization workflow, results: 5
    • Temporal durable workflow per-entity task queue budget cap github, results: 5
    • Argo Workflows, results: 5
    • Prefect workflow orchestration documentation, results: 5
    • argo workflows synchronization semaphore steps DAG docs, results: 5

    Sources:

    A person decides what this check of 2026-11-17 means for the item.

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

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

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files 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/highpriority/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