Skip to content

feat(roadmap): long-running tasks: progress-based deadlines instead of a fixed two hours #3063

Closed

Description

@dan-petty

What happened

The runner Job has a fixed deadline of 7200 s and one Job per repository. A large item (a refactor of 40 files, a migration, a slow test run) either fits in two hours or stops. The generation cap (#2881) already ended a 25-minute runaway; there is no rule that lets a run that makes progress continue.

What should happen

  • The deadline extends while the heartbeat shows progress (a green sub-step, a tool call with a new result) up to a per-item ceiling set in config. A run with no progress for a set time ends.
  • Resource requests follow the item: memory and CPU class chosen from the plan's size, with the largest limit 8 Gi as today unless config raises it.

Acceptance criteria

  • A replay run of 3 hours that makes progress finishes; a replay that makes none ends at the stall time.
  • Both the extension step and the ceiling are settings.
  • The Job spec shows the deadline in force, and the trace shows each extension.
  • The 8 Gi memory limit is unchanged by default.

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).

Proposed design

Problem statement

The runner Job has a fixed 7200 s deadline. A large item that makes steady progress is killed at two hours. The project needs a progress-based deadline that extends while the run shows progress, ends when it stalls, and sizes resources to the item.

Acceptance criteria

Requirement: progress-based deadline extension

The runner Job deadline SHALL extend by the configured extension step each time the Service detects a progress event, up to the configured ceiling.

Scenario: replay with progress over 3 hours

  • WHEN a replay run makes a progress event at least once per stall window for 3 hours
  • THEN the run finishes and the Job does not end by deadline

Requirement: stall detection

The runner Job SHALL end when no progress event is detected for the configured stall time.

Scenario: replay with no progress

  • WHEN a replay run produces no progress event for the stall time
  • THEN the Job ends by its deadline and the Service records the stall

Requirement: configurable extension and ceiling

The extension step and the ceiling SHALL be settings in the roadmap configuration file.

Scenario: config values are read at Job creation

  • WHEN the Service reads the roadmap configuration and creates a Job
  • THEN the extension step and ceiling values from the config are used for deadline management

Requirement: deadline visibility in spec and trace

The Job spec SHALL show the deadline in force, and the trace SHALL record each extension event.

Scenario: trace records an extension

  • WHEN the Service extends the Job deadline after a progress event
  • THEN the trace contains a line with the new deadline value and the reason for the extension

Requirement: default memory limit unchanged

The default memory limit SHALL remain 8 Gi unless the configuration raises it.

Scenario: default config produces 8 Gi limit

  • WHEN the configuration does not set a memory limit override
  • THEN the Job spec requests 8 Gi of memory

Existing Tool Considered

No check has run. No open, maintained tool or library provides progress-based deadline extension for a Kubernetes Job. Kubernetes sets a fixed activeDeadlineSeconds and offers no built-in extend-on-progress feature. The project builds its own logic in the Service. Written cost: about 2500 tokens to build, keep and fix the progress detection, deadline extension, config plumbing and trace logging, over 2 to 3 hours elapsed.

Key questions

  • How does the Service extend the Job deadline when progress is detected?: The Service updates the Job's activeDeadlineSeconds field via the Kubernetes API each time it detects a progress event. The Service already creates the Job and tracks step completion, so it has both the K8s API access and the progress signal. (best practice) [sources: CONTEXT.md]
    • Chosen: Service updates activeDeadlineSeconds via K8s API. The Service already creates the Job and tracks step progress. It has K8s API access. No new component is needed.
    • Rejected: Sidecar container watches progress and extends deadline. Adds a second container to the pod. The sidecar would need its own K8s API access and a shared progress channel. More moving parts for the same result.
    • Rejected: Custom Kubernetes controller or operator. A new deployment to build, test and maintain. Overkill for one Job type in one cluster.
  • What is the default stall time (no-progress window before the Job ends)?: 300 seconds (5 minutes). A step that is running a tool call or a model call should produce a result within 5 minutes. A longer window risks wasting cluster resources on a truly stuck run. (best practice) [sources: CONTEXT.md]
    • Chosen: 300 s (5 min). Catches a stuck run quickly. A single tool call or model call should not exceed 5 minutes. Configurable to raise it.
    • Rejected: 600 s (10 min). More tolerant, but a truly stuck run wastes 10 minutes of cluster time before ending.
    • Rejected: 120 s (2 min). Too aggressive. A slow model call or a large file write could exceed 2 minutes and trigger a false stall.
  • What is the default extension step (how much to add per progress event)?: 600 seconds (10 minutes). Each progress event extends the deadline by 10 minutes. This keeps the deadline close to the work while giving enough headroom for the next step. (best practice) [sources: CONTEXT.md]
    • Chosen: 600 s (10 min). Gives enough headroom for the next step after a progress event. Keeps the deadline close to the work.
    • Rejected: 300 s (5 min). Tighter, but a step that starts after a progress event may need more than 5 minutes.
    • Rejected: 1800 s (30 min). Too generous. A stuck run after a progress event would waste 30 minutes.
  • What is the default ceiling (maximum total deadline)?: 14400 seconds (4 hours). The current fixed deadline is 7200 s. A ceiling of 4 hours allows a large item to finish while still bounding the maximum cluster time. Configurable to raise it. (best practice) [sources: CONTEXT.md]
    • Chosen: 14400 s (4 h). Double the current fixed deadline. Allows a large item to finish. Bounded so a runaway does not hold a pod indefinitely.
    • Rejected: 7200 s (2 h, same as today). No improvement over the current fixed deadline. Defeats the purpose of the change.
    • Rejected: 28800 s (8 h). Too long. A run that needs 8 hours is likely stuck or mis-sized. The generation cap (fix(roadmap): cap output and deadline of a step model call #2881) already handles runaway generation.
  • Where do the new settings live?: In .github/roadmap.toml under the roadmap.implement table, alongside the existing roadmap.implement.in_runner setting. Keys: deadline_stall_seconds, deadline_extension_seconds, deadline_ceiling_seconds, memory_limit_gib. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md, CONTEXT.md]
    • Chosen: .github/roadmap.toml under roadmap.implement. The existing roadmap settings live here. ADR 0004 cites .github/roadmap.toml for release_copilot_passes. CONTEXT.md cites roadmap.implement.in_runner. Consistent location.
    • Rejected: A separate config file for runner settings. Adds a new file to manage. The settings are small and belong with the other roadmap.implement keys.
  • How are memory and CPU requests chosen from the plan size?: The Service reads the number of files in the plan. Small (5 or fewer files): 2 Gi memory, 1 CPU. Medium (6 to 20 files): 4 Gi memory, 2 CPU. Large (more than 20 files): 8 Gi memory, 4 CPU. The 8 Gi cap is the default maximum. The config key memory_limit_gib can raise it. (best practice) [sources: CONTEXT.md]
    • Chosen: Three tiers by file count (2 Gi / 4 Gi / 8 Gi). Simple, predictable, and matches the body's requirement that the largest limit is 8 Gi by default. The file count is already known from the plan.
    • Rejected: A single fixed 8 Gi for all items. Wastes cluster memory on small items. The body asks for sizing by plan size.
    • Rejected: A continuous scale from 1 Gi to 8 Gi. Harder to reason about and test. Three tiers cover the range with less complexity.
  • What counts as a progress event for the heartbeat?: A green sub-step (a task group completing successfully) or a tool call returning a new result. The Service already tracks step completion and tool call results as part of the implement job. [sources: CONTEXT.md]

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/medium
    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 removes a hard stop for legitimate long runs but does not block any current workflow.
    • Value: Medium. It unblocks large refactors, migrations, and slow test runs that exceed two hours of steady progress.
    • Effort: Medium. It needs heartbeat progress tracking, a configurable ceiling, a deadline extension loop, and resource sizing tied to plan size.
    • Related: feat(roadmap): durable runs: a step survives an eviction, an OOM or a restart #3062, which asks for a different change. Both deal with runner Job lifecycle, the 7200 s deadline, and heartbeats, but #3062 delivers survival after eviction or OOM while the candidate delivers deadline extension while progress is made.
  3. added
    priority/p2-medium
    on Nov 1, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  5. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 853987e (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Staged: branch feat/3063-long-running-tasks-progress-based-deadlines, draft pull request #3196. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. placeholder: 4021 tokens

    The plan run made 6 model request(s), and used 280131 input tokens and 1110 output tokens. The tool calls, in order:

    1. search_code({"text":"activeDeadlineSeconds"})
    2. list_files({"directory":"src/devops_cli/roadmap"})
    3. read_file({"path":"src/devops_cli/roadmap/implement_submit.py"})
    4. read_file({"path":"k8s/devops/cronjob-runner.yaml"})
    5. repo_map({"directory":"src/devops_cli/roadmap"})
    6. search_code({"text":"activeDeadlineSeconds"})
    7. search_code({"text":"devops-cli-runner"})
    8. read_file({"path":"src/devops_cli/roadmap/implement_outside.py"})

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • spec_delta_wrong at specs, capability roadmap-implement-runner: The added requirement is placeholder text. No test can assert its scenario. The plan does not carry over the requirements from the issue: extension, stall, settings, trace and 8 Gi. Evidence: "placeholder SHALL placeholder."
    • criterion_dropped at groups: The one group has no task for progress-based extension, stall end, settings for step and ceiling, deadline in Job spec, trace of extensions, or the 8 Gi default. Evidence: "Both the extension step and the ceiling are settings."
    • verify_form at group 1: The command openspec validate --strict only checks the spec files. It does not run any code or test of the group. Evidence: "openspec validate --strict"
    • other at group 1: The group changes the module that starts a runner Job from a workstation. That module holds no deadline, progress or resource logic. The implementation text is only a placeholder and the plan gives no reason for this file. Evidence: "src/devops_cli/roadmap/implement_outside.py"
  7. added a commit that references this issue on Nov 2, 2026
  8. removed
    status/ready
    on Nov 2, 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/mediumpriority/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