Skip to content

Auto-continue round-finished issues up to MAX_AUTO_CONTINUATIONS #202

Closed

Description

@lbacik

What to build

An operator setting, MAX_AUTO_CONTINUATIONS, lets the agent pick up round-finished issues on its own, with no human requeue, up to N automatic continuations in a row. A human requeue (re-applying ready-for-agent) resets the count and grants another N rounds. The default 0 keeps today's behaviour: continuing after a handoff always needs a human decision.

Eligibility

An issue is eligible for automatic continuation when all of these hold:

  • it carries round-finished and not ready-for-agent
  • it is open and unassigned, has a non-empty body and has no open native blockers (the same rules as the runnable queue)
  • its automatic-continuation count (see the blocking ticket) is below MAX_AUTO_CONTINUATIONS

Claiming works as it does today: assign, remove round-finished, and take the existing continuation path (restored branch, starting prompt enriched with the handoff note). Brakes that already exist stay in place:

  • a handoff with zero commits becomes no_changes and never re-adds round-finished, so the loop stops
  • a human can stop automatic continuation at any time by removing round-finished

Ordering

Continuations go first. Issues eligible for automatic continuation are claimed before ordinary ready-for-agent issues, so a started branch doesn't wait behind new work. Within each group the order is FIFO by creation date. A ready-for-agent issue that is also a continuation (a human requeue after a handoff) stays in the ordinary group.

Operator-only setting

MAX_AUTO_CONTINUATIONS is read only from the operator's .env. The repository profile keeps rejecting unknown keys, for the same reason as ADR 0004: the profile lives in the target repository, so an agent-written PR could raise its own round limit. The value must be a non-negative integer; anything else fails at startup with a configuration error.

next issue priority

The operator next issue command uses the same eligibility rule. It accepts a round-finished target within budget. When the budget is used up, it rejects the target with a visible reason that names the limit, for example "automatic continuation limit reached (2/2)".

Handoff reporting

When MAX_AUTO_CONTINUATIONS > 0, every handoff result comment says where the issue stands, for example "automatic continuation 1/2 used; the agent will continue automatically". The handoff that uses up the budget says the issue now needs a human requeue. This text is written once, when the handoff is released, never on queue polls. Claiming an issue for automatic continuation emits an observability event (auto_continuation_claimed) with the issue number and the count.

Docs

  • A new ADR records the policy change: continuing after a handoff no longer always needs a human, within an operator-set limit, with the reasoning and the brakes above.
  • Operator onboarding ("Continuation requires a human decision"), the README, the triage-labels doc and .env.example describe the new setting and how round-finished behaves under it.

Acceptance criteria

  • MAX_AUTO_CONTINUATIONS is loaded from the environment (default 0, non-negative integer, invalid values fail at startup), and the repository profile refuses it as a key
  • With 0, the runnable queue, claims, next issue and handoff comments behave exactly as before
  • With N > 0, a round-finished issue whose automatic-continuation count is below N is in the runnable queue and gets claimed. Claiming removes round-finished and starts the existing continuation path
  • With N > 0, a round-finished issue whose count has reached N is not eligible and stays labelled round-finished
  • Issues eligible for automatic continuation are ordered before ready-for-agent issues, FIFO by creation date within each group
  • Revalidation at claim time (claim_next and claim_verified) applies the same rule, so an issue whose budget ran out, or that a human relabelled, between the queue read and the claim is skipped
  • next issue accepts a round-finished target within budget and rejects one past budget with a reason naming the limit (k/N)
  • With N > 0, handoff result comments report the count (k/N), and the handoff that uses up the budget says a human requeue is needed
  • Claiming for automatic continuation emits an auto_continuation_claimed event
  • End-to-end test with N=2: an issue that keeps handing off is continued automatically twice and then waits. A human re-applying ready-for-agent resets the count and allows two more automatic rounds
  • New ADR added. Onboarding, README, triage-labels doc and .env.example updated

Blocked by

Activity

  1. added
    ready-for-agentFully specified implementation issue ready for an unattended agent
    on Oct 11, 2026
  2. self-assigned this
    on Oct 11, 2026
  3. lbacik commented on Oct 11, 2026

    @lbacik
    OwnerAuthor

    Agent Attempt Result: handoff

    Branch: agent/issue-202
    PR: none
    Handoff note commit: 74d961069cb80eb6ca360dfb14c8ef02e5482444

    Evidence

    • Check command: UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev ruff check && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev pytest && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py313 uv run --python 3.13 --extra dev pytest → exit code None
    • Review cycles: 0/2
    • Review findings: all clear

    Details

    Handoff note: issue #202

    • issue: 202
    • started_at: 2026-10-11T10:30:00Z
    • reason: token_soft_threshold
    • last_work_commit: 43b5f51

    Summary

    Implemented the MAX_AUTO_CONTINUATIONS core path (commit 43b5f51 on
    agent/issue-202, on top of #201's merged HEAD 8d95b44). RuntimeConfig
    gains max_auto_continuations parsed from .env via a new
    _non_negative_integer helper (default 0; invalid values raise
    ConfigurationError); the repository profile still rejects it as an unknown
    key. GitHubTracker accepts the budget, exposes
    is_auto_continuation_eligible (zero budget short-circuits before any
    comment reads), orders continuations before ordinary ready-for-agent
    issues in runnable_queue (FIFO within groups; human requeues stay
    ordinary), and revalidates at claim time in claim_next with a budget-aware
    ineligibility_reason ("automatic continuation limit reached (k/N)" when
    exhausted). AgentLifecycle threads the budget through submit_next_issue
    and _claim_prioritized_locked, emits auto_continuation_claimed on FIFO
    and priority automatic claims, and appends a standing line (k/N, plus a
    human-requeue notice when the budget is exhausted) to handoff details once
    at release — the publisher is untouched. FakeTracker gains auto_counts
    plus automatic_continuation_count; __main__.py wires the setting
    end-to-end. Lint (ruff check) is clean and the existing config/tracker
    suites pass (104 tests).

    Remaining work

    1. Write tests/test_auto_continuations.py: config defaults/validation +
      profile refusal; queue ordering (continuations first, FIFO within groups,
      human-requeued stays ordinary); claim_next picks in-budget / skips
      over-budget (incl. claim-time relabel and count-change-between-reads);
      next issue accept within budget + reject over budget with (k/N);
      handoff comment lines (progress + exhausted) and silence at N=0;
      auto_continuation_claimed on FIFO + priority claims; N=2 e2e (two auto
      continuations then wait; human requeue grants two more). Key harnesses:
      make_lifecycle/issue() in tests/test_next_issue.py,
      FakeTransport/FakeCommentTransport/issue() in
      tests/test_github_tracker.py, marker helpers in
      simple_coding_agent/recovery.py (requeue-source: human|automatic),
      _claim_prioritized_locked semantics at lifecycle.py:2869.
    2. Docs: new docs/adr/0005-*.md; update
      docs/agents/operator-onboarding.md, README.md,
      docs/agents/triage-labels.md, .env.example.
    3. Run targeted test files, then the full suite once, then /code-review,
      address findings, and commit (with Co-Authored-By: Claude Code <noreply@anthropic.com> trailer) on agent/issue-202.

    Evidence

    • Commit 43b5f51 (5 files, +267/-24): simple_coding_agent/config.py,
      github_tracker.py, lifecycle.py, __main__.py, tests/fakes.py.
    • Full prior-context transcript:
      /home/agent/.claude/projects/-data-repo/ce15b452-2e76-4739-b989-575fbcb9c956.jsonl
    • Verified: ruff check simple_coding_agent/ tests/fakes.py clean;
      pytest tests/test_config.py tests/test_github_tracker.py → 104 passed.
    • One fix applied during the attempt: removed an unused READY_FOR_AGENT
      import in lifecycle.py (ruff F401).
  4. added
    round-finishedAgent round finished; requires human evaluation to continue
    and removed
    ready-for-agentFully specified implementation issue ready for an unattended agent
    on Oct 11, 2026
  5. removed their assignment
    on Oct 11, 2026
  6. added
    ready-for-agentFully specified implementation issue ready for an unattended agent
    on Oct 11, 2026
  7. self-assigned this
    on Oct 11, 2026
  8. removed
    round-finishedAgent round finished; requires human evaluation to continue
    on Oct 11, 2026
  9. added 2 commits that reference this issue on Oct 11, 2026
  10. lbacik commented on Oct 11, 2026

    @lbacik
    OwnerAuthor

    Agent Attempt Result: complete

    Branch: agent/issue-202
    PR: #210

    Evidence

    • Check command: UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev ruff check && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev pytest && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py313 uv run --python 3.13 --extra dev pytest → exit code 0
    • Reviews performed: 1
    • Review repair cycles: 0/2
    • Review findings: not collected

    Details

    Claude SDK completed the implementation workflow.

  11. removed
    ready-for-agentFully specified implementation issue ready for an unattended agent
    on Oct 11, 2026
  12. removed their assignment
    on Oct 11, 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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions