Skip to content

feat(roadmap): add the brain due predicate to due_jobs #6596

Open

Description

@dan-petty

Problem

The owner approved the pipeline split on 2026-11-13 (tracker #5482). In that design, no job writes a due mark, and due_jobs of #5504 is the only source of due work. So #4687 removes the due marks brain-repair and brain-consolidate. Work that a run leaves then waits for the next daily run of brain-daily.

ADR 0023 names two triggers between the daily runs:

No due predicate gives these triggers now. But the first trigger needs none for the index of #4676 (#7320): the sync reads a missing marker, or a marker of another schema, as an empty watermark, and the next alternatives round copies each check again (src/devops_cli/roadmap/brain_index.py:117, src/devops_cli/roadmap/brain_sync.py:219). #5502 names the brain due predicate in the job table.

Scope

Acceptance criteria

  • Test first: a test of due_jobs gives the repair task for a missing index marker and for a marker with an old schema. The test fails on the base.
  • A test: due_jobs gives the consolidate task while an unjudged shortlist remains. It gives no brain task when the marker is current and each shortlist has a verdict.
  • A test: the sweep creates at most one run of each brain task in one day.
  • uv run devops docs check passes.

Dependencies

Source

Source: #4624

Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches returned only generic scheduling and deadline-check documentation, nothing that derives due work from a project's index marker or unjudged shortlists. The predicate belongs in the project's own due_jobs, as the issue body already records.

Lacks:

  • No tool reads a Valkey index marker to make repair due
  • No tool marks consolidate due from shortlists without a verdict
  • No tool reuses the sweep's last-success mark for one run a day

Proposed design

Problem statement

Add the brain due predicate to due_jobs for the repair and consolidate tasks. The pipeline split removes the due marks, so no due predicate makes these tasks due between the daily brain-daily runs. ADR 0023 gives two triggers: a missing or old index marker, and shortlists with no verdict.

Acceptance criteria

Requirement: Repair task due from a missing index marker

due_jobs SHALL return the repair task when the index marker of the repository is missing.

Scenario: Missing index marker

  • WHEN The test calls due_jobs for a repository whose index marker is missing.
  • THEN The call returns the repair task, and the same test fails on the base commit because due_jobs returns no repair task.

Requirement: Repair task due from an old index schema

due_jobs SHALL return the repair task when the index marker holds a schema older than the current schema.

Scenario: Old index schema

  • WHEN The test calls due_jobs for a repository whose index marker holds a schema older than the current schema.
  • THEN The call returns the repair task, and the same test fails on the base commit because due_jobs returns no repair task.

Requirement: Consolidate task due from an unjudged shortlist

due_jobs SHALL return the consolidate task while at least one shortlist holds no verdict.

Scenario: One shortlist with no verdict

  • WHEN The test calls due_jobs with a current index marker and one shortlist that holds no verdict.
  • THEN The call returns the consolidate task.

Requirement: No brain task from a current brain

due_jobs MUST return no brain task when the index marker is current and each shortlist holds a verdict.

Scenario: Current marker and judged shortlists

  • WHEN The test calls due_jobs with a current index marker and each shortlist holding a verdict.
  • THEN The call returns neither the repair task nor the consolidate task.

Requirement: One run of each brain task a day

The sweep SHALL create a run of the due brain task only, and at most one run of each brain task in one day.

Scenario: Both brain tasks stay due

  • WHEN The test calls the sweep selection twice in one UTC day while the repair task stays due and one shortlist holds no verdict.
  • THEN The first call creates one run of the repair task and one run of the consolidate task, and the second call creates no run of either task.

Requirement: The workflow document names the brain predicate

docs/ROADMAP_WORKFLOW.md MUST name the brain due predicate of due_jobs and the two triggers that it reads.

Scenario: Docs check after the document edit

  • WHEN A developer runs uv run devops docs check after the workflow document names the brain due predicate.
  • THEN The command exits 0 and reports no error.

Existing Tool Considered

The alternatives check of 2026-11-27 in the issue body records the verdict none and names no tool. The change builds the predicate in due_jobs itself. Cost: about 80,000 tokens to build, about 15,000 tokens for each later fix, and about 4 hours of elapsed time.

Key questions

  • Does due_jobs exist at the base commit, and who calls it?: Yes. due_jobs exists, and fix_checks_row.py is its caller. [sources: src/devops_cli/roadmap/fix_checks_row.py]
  • Where does the brain due predicate live?: Add one branch to due_jobs. The existing caller fix_checks_row.py already asks due_jobs, so one function holds every due rule. (best practice) [sources: src/devops_cli/roadmap/fix_checks_row.py, docs/ROADMAP_WORKFLOW.md]
    • Chosen: A branch in due_jobs. The caller fix_checks_row.py already asks due_jobs, so one function holds every due rule.
    • Rejected: A new module for the brain due work. It puts the due rules in two places and adds a second caller path.
    • Rejected: The rule inside the sweep row. The row would hold the rule, and no other caller could ask it.
  • How does the repair predicate read the index marker?: Read the index marker from the project brain in Valkey. A missing marker and a marker of another schema make the repair task due. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/brain_index.py:117, src/devops_cli/roadmap/brain_sync.py:219]
    • Chosen: Read the Valkey index marker. CONTEXT.md says Valkey holds the project brain, and the predicate reads the live state with no network call.
    • Rejected: Read the durable copies over GitHub. A predicate on each sweep tick would make GitHub requests for each repository.
    • Rejected: Read a local cache file. A local file is not the live marker and can be stale after a loss of valkey-roadmap.
  • Where does the consolidate predicate read unjudged shortlists?: Read the latest consolidate plan file under .data/roadmap/consolidate/. Count the shortlists with no verdict. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, CONTEXT.md]
    • Chosen: Read the latest consolidate plan file. The consolidate command writes its plan to that file, and the plan is the record of the shortlists.
    • Rejected: Read the project brain in Valkey. The project brain holds the alternatives index, not the consolidation shortlists.
    • Rejected: Query GitHub for open items. It would make requests on each sweep tick and would not hold the judge verdicts.
  • How does the sweep keep at most one run of each brain task in one day?: Read the last-success mark that the sweep writes for each job. Create a run of a brain task only when the task is due and the mark holds an earlier UTC day. (best practice) [sources: CONTEXT.md, docs/ROADMAP_WORKFLOW.md]
    • Chosen: The last-success mark of the task. CONTEXT.md says the sweep writes the last success of each job, so the mark holds the day of the last run.
    • Rejected: A new per-day key in Valkey for each task. It keeps a second record of a fact that the last-success mark already holds.
    • Rejected: A query of the open runs of the task. The sweep would ask GitHub on each tick and for each repository.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5504, #4574, #4687

Activity

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

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

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (3)

    Searches run:

    • open source maintenance job scheduler conditional trigger index health marker, results: 5
    • Python library schedule jobs with custom due predicate at most once a day, results: 5
    • Dagster asset check trigger run when index stale schema mismatch, results: 5

    Sources:

  5. devops-cli-service commented on Nov 22, 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.

  6. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor

    Design check, 2026-11-26

    Body, 1 correction: the sync of #4676 rebuilds the index after a loss. A missing marker, or a marker of another schema, gives an empty watermark (src/devops_cli/roadmap/brain_index.py:117-122). The next alternatives round then copies each check, at most 500 in one round (src/devops_cli/roadmap/brain_sync.py:219-245, #7320).

    So a rebuild of the item, tool and reference entries starts with no predicate. The sync does not rebuild insights (#4687, #4693). The consolidate predicate is not changed.

    Refine block: it says that Valkey holds the index marker and the shortlists. The marker is the hash brain-sync in valkey-roadmap. Not verified: where the shortlists are.

    Dependencies: #5504 and #4574 are open. due_jobs does not exist yet. run_due_jobs is at src/devops_cli/roadmap/run.py:2260.

    Open question: the scope uses the tasks of #4687 (open). The Dependencies do not name it.

  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.

  8. devops-cli-service commented on Nov 28, 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/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions