Skip to content

feat(roadmap): several implement Jobs can run at once, on disjoint files #3064

Closed

Description

@dan-petty

What happened

The Service makes one runner Job per repository at a time. With 29 planned items waiting and Jobs of about 8 to 18 minutes, the queue empties at the speed of one item per round.

What should happen

  • A scheduler picks up to N items at once when their change folders name disjoint file sets (from the plan's Changes: lines) and priorities allow, with fairness among repositories and a cluster resource check.
  • Items that overlap run one after the other. The claim, the lock by Job label and the request budget stay the rule.

Acceptance criteria

  • A replay with two items of disjoint files starts two Jobs; two items that share a file start one.
  • N is a setting (default 1).
  • The GitHub request budget and the model lane limit still hold.
  • A test proves that a merge conflict between two Jobs of one round cannot happen for disjoint files.

Related: tracker for this set (filed with it), #2908 (issue workflow), #2867 (draft PR evaluator), #3005 (task kind), #3010 to #3015 (plan gates), #2919 (stuck-item metrics), #2953 (Ollama parser).

Alternatives check of 2026-11-04: partly.
Tool: hatchet-dev/hatchet (https://github.com/hatchet-dev/hatchet), MIT, last activity 2026-11-04, maintained.

Proposed design

Problem statement

The Service creates one implement Job per repository at a time. Planned items wait in a single queue per repository, and a round takes 8 to 18 minutes for each item. The change lets the implement round of a repository create up to N Jobs at once for items whose change folders name disjoint files, while the per-item claim and Job label, the GitHub request budget, the model call limit and a namespace resource quota still hold.

Acceptance criteria

Requirement: Parallel limit setting

The Service SHALL read the setting roadmap.implement.max_parallel_jobs and SHALL use 1 when the setting is absent.

Scenario: Default limit

  • WHEN the configuration has no roadmap.implement.max_parallel_jobs value
  • THEN the implement round reports a limit of 1 and creates at most one implement Job.

Requirement: Disjoint selection

The implement round SHALL select two or more items of one repository in one round only when their normalized Changes: file sets are disjoint.

Scenario: Two disjoint items

  • WHEN two eligible items of one repository have change folders whose Changes: lines name no common path and no parent-child path pair
  • THEN the round returns two Jobs for that round.

Requirement: Overlap serialization

The implement round MUST select only one of two items when their Changes: file sets share a path or a parent-child path pair.

Scenario: Two overlapping items

  • WHEN two eligible items of one repository share one changed path
  • THEN the round returns one Job and leaves the other item for a later round after the first Job ends.

Requirement: Repository fairness

The Service SHALL keep one implement round per repository on the repository's own status-lane worker, so a repository with N running Jobs does not delay another repository's round.

Scenario: Two repositories

  • WHEN repository A has N running implement Jobs and repository B has an eligible item
  • THEN repository B's round creates its Job without waiting for repository A's Jobs.

Requirement: Priority order

The implement round SHALL take a higher-priority item before a lower-priority item of the same repository.

Scenario: P1 before P2

  • WHEN one repository has a P1 item and a P2 item and the limit is 1
  • THEN the round selects the P1 item.

Requirement: Namespace quota

The Service MUST create an implement Job only when the namespace devops ResourceQuota admits its CPU and memory requests, and MUST leave the item for the next sweep when the API server refuses the create.

Scenario: Quota refusal

  • WHEN the namespace quota has no room for another runner Job and the round selects an item
  • THEN the round records no created Job, releases the claim, leaves the item eligible for the next sweep and does not fail the row.

Requirement: Claim and Job label

The Service SHALL create no second Job for an item that has a claim or a running Job that carries the item's label.

Scenario: Claimed item

  • WHEN an eligible item has a claim or a running Job with its item label
  • THEN the round skips that item and creates no Job for it.

Requirement: Request and lane gates

The implement round MUST reuse the existing GitHub request budget and the Service model call limit, and MUST add no second budget and no second model slot.

Scenario: No budget

  • WHEN the GitHub request budget has no room for the round's next request
  • THEN the round creates no Job and the request waits for the window as it does today.

Requirement: Merge conflict proof

The test suite SHALL prove with a recorded git scenario, replayed through git_fake, that two branches from one base commit that change disjoint files merge without a conflict.

Scenario: Disjoint branch merge

  • WHEN the test replays the recorded scenario of two branches from one base commit that change disjoint files and merges one into the other
  • THEN the merge exits 0 and the merged tree holds both changes.

Requirement: Replay

A replay test SHALL start two Jobs for two disjoint items of one repository and one Job for two items of one repository that share a file.

Scenario: Replay of both cases

  • WHEN the replay runs the implement round with limit 2 for a disjoint pair and for an overlapping pair
  • THEN the disjoint pair creates two Jobs and the overlapping pair creates one Job.

Requirement: Glossary update

The change SHALL update the Runner term in CONTEXT.md to allow several Jobs for one repository when their file sets are disjoint.

Scenario: Glossary check

  • WHEN the change is applied
  • THEN CONTEXT.md states the per-item Job rule and the disjoint-file rule.

Existing Tool Considered

Hatchet (https://github.com/hatchet-dev/hatchet), MIT, maintained, covers a configurable concurrency limit (max_runs), round-robin concurrency groups and rate limits. It lacks reading the plan's Changes: lines, computing disjoint file sets, a merge-conflict guarantee for disjoint files, cluster resource-aware scheduling and native GitHub request-budget and model-lane semantics; the namespace ResourceQuota is a Kubernetes feature, not Hatchet. The Service must build the plan-aware predicate and the per-item selection. The written cost is about 150,000 tokens to build, 30,000 tokens per year to keep and fix, and 3 engineer-days.

Key questions

  • Does the current implement round create one Job for the first selected item of a repository?: Yes. run_implement_round plans with DEFAULT_ROADMAP_IMPLEMENT_LIMIT (1), returns waiting while any Job of the repository label is running, and creates the Job for plan.selected[0]. The module says a Job of the repository that has not ended blocks the round. [sources: src/devops_cli/roadmap/implement/implement_submit.py:24, src/devops_cli/roadmap/implement/implement_submit.py:523, src/devops_cli/roadmap/implement/implement_submit.py:547, src/devops_cli/config/defaults.py:907]
  • Where does the Service read the plan's Changes: lines?: group_files reads the Changes: code spans of each task group, and StageGroup.changes holds them as repository-relative paths with no ..; tasks_on_default and tasks_at read the tasks.md of a Planned or Staged item. [sources: src/devops_cli/roadmap/plan_read.py:269, src/devops_cli/roadmap/stage/stage_change.py:496, src/devops_cli/roadmap/stage/stage_change.py:301, src/devops_cli/roadmap/planned.py:102]
  • Should the Service adopt Hatchet for the parallel implement scheduler?: No. The alternatives check rates Hatchet 'partly': it is MIT and maintained and covers a concurrency limit, round-robin concurrency groups and rate limits, but it does not read the plan's Changes: lines, compute disjoint file sets, guarantee a merge for disjoint files, enforce a namespace quota, or speak the GitHub request budget and model lane. Extend the implement round and keep the plan-aware predicate there. (best practice) [sources: https://github.com/hatchet-dev/hatchet, https://docs.hatchet.run/v1]
    • Rejected: Adopt Hatchet for the whole scheduler. It cannot read Changes: lines, compute disjoint file sets, prove a merge, or enforce a namespace quota; the custom predicate would still be needed.
    • Chosen: Extend the implement round and reuse its claim, budget and lane gates. It keeps the existing rules and adds only the plan-aware predicate and the per-item selection.
    • Rejected: Use a Kubernetes Job queue alone. It has no plan-aware overlap, priority order or per-item claim.
  • Which component selects the items in one round?: The implement row of each repository (run_implement_round), which the status-lane worker runs once per repository. The round selects up to N disjoint items of that repository. ADR 0021 makes the sweep the one creator of units of work, and the Service already runs one status-lane worker per repository. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:83, src/devops_cli/roadmap/implement/implement_submit.py:523, src/devops_cli/roadmap/run.py:1751]
    • Chosen: Extend the implement row of each repository. It already reads the plans, the claims and the Jobs, and the Service runs one status-lane worker per repository.
    • Rejected: Add a separate global scheduler service. It needs a store and a clone for every repository in one round, and duplicates the per-repository claim and job-record model.
    • Rejected: Let the Kubernetes scheduler choose. It cannot see plans, claims or priorities.
  • How does the scheduler decide that two items are disjoint?: Read every Changes: line from each item's change folder with group_files. Normalize each path to a repository-relative path; the plan reader already refuses an absolute path and a ... Treat a parent directory and its child as overlapping. Two items are disjoint only when their path sets have no common path and no parent-child pair. (best practice) [sources: src/devops_cli/roadmap/plan_read.py:269, src/devops_cli/roadmap/stage/stage_change.py:301]
    • Chosen: Parse Changes: lines before selection. The issue names these lines, group_files already reads them, and the check runs before a Job starts.
    • Rejected: Compare git diff after both branches exist. The round must decide before it creates the Jobs.
    • Rejected: Ask a model. The result must be deterministic and testable.
  • What is the name of the N setting, and what is its default?: Use roadmap.implement.max_parallel_jobs with a default of 1, and the generated variable DEVOPS_CLI_ROADMAP_IMPLEMENT_MAX_PARALLEL_JOBS. It sits beside max_memory_limit under roadmap.implement, and 1 keeps the current DEFAULT_ROADMAP_IMPLEMENT_LIMIT behavior. (best practice) [sources: src/devops_cli/config/settings.py:1133, src/devops_cli/config/defaults.py:907, docs/ENV_VARS.md:123]
    • Chosen: roadmap.implement.max_parallel_jobs. It says what it limits, follows the roadmap.implement.* names, and 1 keeps the current behavior.
    • Rejected: roadmap.implement.concurrency. It is ambiguous with the model call concurrency.
    • Rejected: Environment variable only. It breaks the existing configuration pattern.
  • How does the scheduler keep fairness among repositories?: N is per repository. The Service runs one status-lane worker per repository, so each repository gets its own N and no repository waits for another repository's Jobs; the namespace ResourceQuota bounds the total across repositories. Inside a repository the round takes items in priority_order (priority, digest clear, issue number). A global round-robin scheduler is rejected because it would need one store and one clone for every repository in a single round, which the per-repository worker model does not provide. (best practice) [sources: src/devops_cli/roadmap/run.py:1751, src/devops_cli/roadmap/implement/implement_submit.py:523, src/devops_cli/roadmap/stage/stage.py:729]
    • Chosen: Per-repository N on independent workers. Each repository gets the same N, and the Service already runs one status-lane worker per repository, so no repository waits for another's Jobs.
    • Rejected: A global round-robin scheduler across repositories. It needs a store and a clone for every repository in one round, which the per-repository worker model does not provide.
    • Rejected: Strict global priority. A repository with many high-priority items starves the others.
  • How does the scheduler perform the cluster resource check?: Use a namespace ResourceQuota on requests.cpu and requests.memory in devops, and let the API server enforce it when the Service creates a Job. The Kubernetes documentation fetched on 2026-11-12 shows that a create whose requests exceed the quota is refused with a Forbidden error. A refusal releases the claim, leaves the item for the next sweep and does not fail the round. The Service does not read node allocatable: its Role grants no nodes access, and a client-side free-capacity read races with other pods. (best practice) [sources: https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/, k8s/devops/roadmap-service/role.yaml:17, k8s/devops/roadmap-service/admissionpolicy.yaml:17]
    • Chosen: Namespace ResourceQuota enforced by the API server. The API server refuses a Job whose requests exceed the quota atomically; the Service needs no nodes read and no racy free-capacity calculation.
    • Rejected: Pre-check from node allocatable. The Service's Role grants no nodes access, and the read races with other pods and namespaces.
    • Rejected: Rely on the Kubernetes scheduler. A Job can stay Pending and hold the item, which the issue rejects.
    • Rejected: Use a static maximum. It ignores the real capacity.
  • How do claims and Job labels prevent duplicate work when one repository can run several Jobs?: Keep the claim and the job record per item: _create claims the item with service_claim and records implement.job, and creates no Job for an item that already has either. Add an item label to the Job beside the repository label, so the round lists the Jobs of the item as ADR 0021 requires. Replace the repository-wide waiting rule with the disjoint-file rule for different items. (best practice) [sources: src/devops_cli/roadmap/implement/implement_submit.py:470, src/devops_cli/roadmap/implement/implement_submit.py:464, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:84, CONTEXT.md:126]
    • Chosen: Per-item claim and Job label plus the disjoint predicate. It prevents duplicate work and allows disjoint items in one repository.
    • Rejected: Keep the repository-wide single-Job lock. It blocks the feature.
    • Rejected: Remove claims and labels. It lets two Jobs work on one item.
  • How does the scheduler keep the GitHub request budget and the model lane limit?: Reuse the existing gates: the GitHub session checks RequestBudget before each request, and the Service sets service.model_call_concurrency at start. The implement round adds no second budget and no second model slot; a round that has no budget room creates no Job. Each runner Job keeps one model call in flight, as ADR 0021 requires. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:114, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:118, src/devops_cli/server/service.py:790, src/devops_cli/server/service.py:797]
    • Chosen: Reuse the existing gates. The issue says these rules stay, and the round already asks the budget for each request.
    • Rejected: Map them to Hatchet rate limits. Hatchet has no native GitHub request-budget or model-lane semantics.
    • Rejected: Add a second global budget. It duplicates the existing rule.
  • How does the test prove that two Jobs on disjoint files cannot conflict?: Record a scenario with the real git in tests/support/git_scenarios.py: two branches from one base commit change disjoint files, and one merges into the other. Replay it through git_fake and assert that the merge exits 0 and the merged tree holds both changes. Add a scheduler property test that every pair selected in one round has an empty file-set intersection. Tests start no real git; the recorder is the one place that does. (best practice) [sources: docs/TESTING.md:80, tests/support/git_scenarios.py:532]
    • Chosen: Recorded git scenario plus scheduler property test. It checks git's real merge behavior through the recorded scenario and the scheduler predicate, without starting real git in a test.
    • Rejected: Real git merge in the test. docs/TESTING.md says tests start no real git; the recorder is the one place that does.
    • Rejected: Mock merge test. It does not prove git behavior.
    • Rejected: Scheduler set test alone. It does not prove that git merges the result.
  • Which documentation change is required?: Update the Runner term in CONTEXT.md to say the Service creates no second Job for an item, and may create several Jobs for one repository when their file sets are disjoint. (best practice) [sources: CONTEXT.md:146]
    • Chosen: Update CONTEXT.md. The Runner term states the current single-Job rule and must match the new behavior.
    • Rejected: Leave the glossary unchanged. It would contradict the new behavior.
    • Rejected: Add a new ADR. The change follows ADR 0021 and needs no new architecture decision.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/high
    on Nov 1, 2026
  2. dan-petty commented on Nov 1, 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 raises throughput of the roadmap queue but the system works without it, so it is not a P1 blocker.
    • Value: Medium. Faster queue drainage benefits the team's delivery cadence but does not change correctness.
    • Effort: High. A new scheduler, concurrency control, fairness rule, cluster resource check, and a merge-conflict test are all required.
  3. added
    priority/p2-medium
    on Nov 1, 2026
  4. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at a9d6d9f until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • The proposal has no problem statement, no acceptance criterion with its requirement, scenario, WHEN and THEN, or no answer to the existing-tool question. State the problem, the requirements with their scenarios, and the open tool that covers the need or the cost of building it.
  5. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Tool: hatchet-dev/hatchet (https://github.com/hatchet-dev/hatchet)

    • License: MIT
    • Last activity: 2026-11-04
    • Maintained: yes

    Covers:

    • A configurable concurrency limit (max_runs) can provide the setting for N parallel runs.
    • Group round-robin concurrency keyed on an input such as the repository provides fairness among repositories.
    • Rate limits can cap request frequency, so the GitHub request budget and model lane limit can be mapped onto them.
    • A durable task queue with retries can hold the queued implementation work.

    Lacks:

    • It does not read the plan's Changes: lines or compute disjoint file sets, so the scheduler's overlap predicate must still be built in the Service.
    • It cannot guarantee or test that two Jobs on disjoint files will not produce a merge conflict; that check remains custom.
    • It has no cluster resource-aware scheduling, so the cluster resource check is not covered.
    • It has no native GitHub request budget or model-lane semantics; these must be expressed as its rate and concurrency limits.

    Searches run:

    • open source scheduler run jobs in parallel on disjoint files avoid merge conflicts
    • workflow orchestrator concurrency limit per resource fairness priority queue open source
    • parallel coding agents git worktrees disjoint files scheduler merge conflict prevention
    • merge queue tool parallel pull requests disjoint files conflict detection open source
    • Hatchet docs rate limits priority concurrency group round robin
    • Argo Workflows parallelism limit priority synchronization semaphore mutex docs

    Sources:

    Checked on 2026-11-04. A person decides what this means for the item. The check changes no label and closes no issue.

  6. added
    status/ready
    and removed
    status/new
    on Nov 12, 2026
  7. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 2bd87bc (see proposed design in issue body).

  8. added
    owner/service
    on Nov 13, 2026
  9. 5 remaining items

  10. added 2 commits that reference this issue on Nov 14, 2026
  11. added
    status/planned
    and removed
    status/ready
    on Nov 14, 2026
  12. added
    status/in-progress
    and removed
    status/planned
    on Nov 22, 2026
  13. added
    status/in-review
    and removed
    status/in-progress
    on Nov 22, 2026
  14. devops-cli-service commented on Nov 22, 2026

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

    @devops-cli-service
    Contributor

    Live since 2026-11-22 23:51 UTC

  16. removed
    status/in-review
    on Nov 22, 2026
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/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions