Skip to content

docs(adr): add ADR 0085, serve changed Jira issues oldest first - #9815

Draft
jwm4 wants to merge 2 commits into
mainfrom
claude/adr-jira-poll-oldest-first
Draft

jwm4 wants to merge 2 commits into
mainfrom
claude/adr-jira-poll-oldest-first

Conversation

@jwm4

@jwm4 jwm4 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Summary

This is the short amendment to ADR 0160 that I said I would write when I closed #9505. It adds ADR 0085, which stops the jira-poll driver from losing requests to its row limit and its random pick: one poller per repository reads every issue that changed within the driver's 24-hour backfill window, oldest change first.

It is a decision record only. The implementation is a separate change.

Related Issue

None. Related work:

  • #9166 added ADR 0160, which this partially supersedes. ADR 0160 records starvation beyond the first M results as unmitigated.
  • #9505 proposed replacing ADR 0160 outright and was withdrawn. This PR amends ADR 0160 instead and leaves the durable design to the entity-based work (ADR 0098, ADR 0149).
  • #9746 is the GitHub hand-off loss that ADR 0085 names in its Consequences and leaves to a separate change.
  • #9751 tracks the implementation. #9758 implements ADR 0160's activity filter and checkpoint clause, which this ADR keeps.
  • #7527 changes the same search code and adds a five-page cap, which this ADR removes. The two need to be sequenced.

Changes

  • New ADR 0085. One poller per repository. The pool is every issue that matches the query and changed within the backfill window, in ascending order of updated, with no row limit. The random pick and the per-issue lock are removed. Before it reads an issue's comments and history, the driver confirms that it can write to the issue, as the lock write did. A cycle in which every issue fails that check ends in an error, as today.
  • One configuration key. tracker.jira.poll.max_dispatches_per_cycle (default 100, from 1 to 250) replaces both keys of ADR 0160, neither of which shipped.
  • Two more stops per cycle. 768 KB of serialized batch on the GitHub target, and five minutes.
  • Status notes on ADR 0160 and ADR 0063 that point to ADR 0085.
  • docs/architecture.md: the Jira poll entries reflect the target state.

Unchanged: change detection, bot filtering, authorization, the 24-hour window with its clamps, and ADR 0160's activity filter and checkpoint clause.

Defaults that change

These land with the ADR unless a reviewer objects in review:

  • A cycle dispatches up to 100 records, where today it processes 5 issues.
  • The per-issue lock is no longer read or written. A scheduler other than the managed ones must keep two cycles for one repository from overlapping.
  • A sort clause in the configured query is dropped, because the driver sets the search's sort order itself. The default query no longer carries one.

What it does not fix

  • Requests are still lost when issues change faster than the driver can process them within 24 hours, or when the poller is stopped for longer than that.
  • The GitHub hand-off can still lose a whole batch (#9746). A checkpoint commit that fails after the write check passed has the same effect for the issues whose commits succeeded.
  • An issue the driver cannot write to is checked again every cycle until its change leaves the window, and its requests are not served. It takes no room from other issues.
  • An editor who keeps rewinding checkpoints on issues near the front of the line can hold newer requests back. The random pick did not allow that. The ADR accepts it and extends the Jira guide's rule that Edit Issues on a polled project is part of the trust boundary.

Evidence for the claims about current behaviour

Checked at 5f6c718f8361.

Claim in the ADR Where
The driver reads the first M results (50) internal/jirapoll/poller.go L89-L90 (default), L414 (SearchIssues(ctx, jql, p.opts.M))
It drops locked issues, then picks N at random (5) internal/jirapoll/poller.go L92-L93, L146, L152, L458
The backfill window is 24 hours, and an older checkpoint is clamped to it internal/jirapoll/poller.go L98-L99; internal/jirapoll/lock.go L231-L232
ADR 0160 is not implemented no max_issues_per_cycle or max_candidates in any Go or YAML file
The managed GitHub job runs one cycle at a time, every five minutes, with a 15-minute timeout internal/scaffold/fullsend-repo/templates/jira-poll-per-repo.yaml L23, L30-L32, L38
The managed GitLab job runs one cycle at a time internal/scaffold/fullsend-repo-gitlab/.gitlab/ci/fullsend-poll.yml L15 (resource_group)
The lock and the checkpoint are named per target repository internal/jirapoll/lock.go L28-L34
The whole batch is one job output, and each record is one matrix job .github/workflows/reusable-poll-jira.yml L58, L116-L132; .github/workflows/reusable-dispatch.yml L2912-L2914
Checkpoints are committed before the dispatch step runs internal/jirapoll/poller.go L198-L205, L278
A failed checkpoint commit fails the cycle, and the matrix step then does not run internal/jirapoll/poller.go L284-L303; .github/workflows/reusable-poll-jira.yml L101-L116
The lock write is the first write to an issue in a cycle internal/jirapoll/poller.go L468-L470
Change detection reads the checkpoint from the issue, not from the search internal/jirapoll/poller.go L494; internal/jirapoll/lock.go L186-L189
The Jira search is eventually consistent internal/forge/jira/client.go L556-L561
The guide treats Edit Issues on a polled project as part of the trust boundary docs/guides/user/jira-integration.md L1445
One issue is capped at 100 events per cycle, and the checkpoint advances past the overflow internal/jirapoll/poller.go L48, L552-L555
On GitLab, records are dispatched one by one and a failed issue is retried internal/jirapoll/poller.go L207-L240
GitHub allows 256 jobs in a matrix and 1 MB in a job's outputs matrix limit, output limit

Jira behaviour the design relies on

Nothing in the repository exercises these, so I checked them against a live Jira Cloud site on 2026-11-23 with a test account.

Behaviour Result How
The search returns an issue property when asked Holds POST /rest/api/3/search/jql with "properties": ["<checkpoint key>"] returned the value, and it matched a direct property read on three issues
Writing the checkpoint property does not advance updated Holds On an issue served by a deployed poller, the checkpoint was written after the issue's updated time, and updated did not move
Editing a comment advances updated Holds I added a comment and then edited it; updated moved both times
The search accepts a 24-hour bound Holds updated >= -24h, "-24h", -1440m, -1d and an absolute time all returned the same rows
An issue that changes while a search is paged in updated order is not returned twice Holds I paged 15 issues 5 at a time, oldest change first, and changed the first one after reading page 1; it did not come back and no row was skipped. One test

#9758 records the same results for the second, third and fourth rows from its own checks.

The search read about 210 rows per second at 50 rows per page.

One thing I did not expect: on that site an automation changes a field without advancing updated. Anything that compares updated with the checkpoint, including ADR 0160's activity filter, does not see a change made that way until something else changes the issue. In one day of that site's history the only field changed that way was one that an automation maintains; every label, status and assignee change advanced updated.

Testing

  • make lint passes (pre-commit run on the staged change)
  • Tests added/updated for new or modified logic (documentation only)

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Commits are signed off (DCO) — human and human-directed agent sessions only
  • I wrote this contribution myself and can explain all changes in it

🤖 Generated with Claude Code

Partially supersede ADR 0160 and ADR 0063 for the jira-poll driver: one
poller per repository reads every issue that changed within the driver's
24-hour backfill window, oldest change first, with no row limit, no
random pick and no per-issue lock. A cycle stops at
tracker.jira.poll.max_dispatches_per_cycle records (default 100, at most
250), at 768 KB of serialized batch on the GitHub target, or after five
minutes.

Add Status notes to ADR 0160 and ADR 0063 and update the Jira poll
entries in docs/architecture.md. Decision record only; the
implementation follows separately.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Bill Murdock <bmurdock@redhat.com>
@jwm4
jwm4 requested a review from a team as a code owner November 23, 2026 19:33
@jwm4
jwm4 deployed to forgejo-dev November 23, 2026 19:33 — with GitHub Actions Active
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Document oldest-first Jira polling with one poller per repository

📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Add ADR 0085 to address Jira request starvation caused by row limits and random selection.
• Define oldest-first polling with per-cycle dispatch, size, and time limits; implementation follows
 separately.
• Mark superseded decisions and update the architecture's target-state description.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 0 capabilities

  • No production behavior changes identified.
Behavioral complexity 🟢 Low 🧩 Assessed behavior

  • No production behavior changes identified.
Potential damage 🟢 Low 🩹 Assessed behavior

  • No production behavior changes identified.
Assessed commit f601ed2
Diagram

graph TD
  J["Jira query"] --> P["24h ordered pool"] --> A{"New activity?"} --> W{"Writable issue?"} --> B["Bounded dispatch batch"] --> G["GitHub job matrix"]
  B --> L["GitLab pipelines"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Move directly to entity-based discovery
  • ➕ Could address the fixed backfill window and durability more comprehensively.
  • ➖ Requires a Jira adapter that does not yet exist and delays relief for the current driver.

Recommendation: Keep ADR 0085 as an interim decision for the existing driver, with implementation in a separate PR. Entity-based discovery remains the better long-term direction, but cannot yet replace Jira polling; reviewers should assess the documented residual loss modes and limits on that basis.

Files changed (4) +240 / -8

Documentation (4) +240 / -8
0063-polling-based-work-discovery.mdMark Jira lock and random-selection decisions as superseded +9/-0

Mark Jira lock and random-selection decisions as superseded

• Adds a status note linking ADR 0085 and identifying which Jira coordination decisions it replaces, including lock-dependent behavior. The earlier ADR's other decisions remain in place.

docs/ADRs/0063-polling-based-work-discovery.md

0085-serve-changed-jira-issues-oldest-first.mdDefine oldest-first, bounded Jira polling +208/-0

Define oldest-first, bounded Jira polling

• Introduces an accepted ADR for one poller per repository, an unbounded candidate search within the 24-hour window, and oldest-first processing without random selection or per-issue locks. Specifies write checks, dispatch-count and time limits, a GitHub-only batch-size limit, forge scope, and remaining request-loss risks.

docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md

0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.mdClarify which ADR 0160 decisions still apply +7/-0

Clarify which ADR 0160 decisions still apply

• Adds a partial-supersession note: ADR 0085 replaces the row limit, random selection, lock use, and proposed configuration keys. The activity filter and checkpoint clause remain.

docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md

architecture.mdAlign Jira polling architecture with the target state +16/-8

Align Jira polling architecture with the target state

• Describes oldest-first selection, the new per-cycle dispatch limit, and removal of the candidate row limit, random pick, and per-issue lock as a target state. Clarifies the related coordination discussion without presenting the decision as implemented.

docs/architecture.md

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 7:36 PM UTC · Completed 7:43 PM UTC

Commit: f601ed2 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.94

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://c94af766-site.fullsend-ai.workers.dev

Commit: ebd43c8f0a99526f3fe3a2b976c833a5c0c204d4

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Nov 23, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Documentation-only PR introducing ADR 0085 with no code or CI changes, elevated to moderate risk by high recent churn and multi-author contention on docs/architecture.md.

Previous run

Risk Assessment: moderate (2/5)

Details

Documentation-only PR introducing ADR 0085 with no code or CI changes, elevated to moderate risk by high recent churn and multi-author contention on docs/architecture.md.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Review

Findings

Medium

  • [edge-case] docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md:120 — The two-minute per-issue timeout still lets slow issues starve unrelated healthy ones. Under Decision §3 the five-minute cycle budget covers the search and every per-issue read, and a timed-out issue keeps its checkpoint and its place at the front of the ascending-updated order. If two or three of the oldest active issues keep timing out, their reads use up the whole budget every cycle, so issues behind them are never reached, possibly until their requests leave the 24-hour backfill window. Consequences only says "a slow one costs up to two minutes of each cycle" and does not cover several slow issues together. Bounding each failed read does not guarantee progress across cycles.
    Remediation: Specify a cross-cycle retry/backoff or fair-resumption mechanism (e.g. deprioritize or skip an issue for N cycles after a timeout, or cap the share of the cycle budget spent on previously failed issues), or record this starvation mode explicitly in Consequences as accepted. Require a test with several oldest issues timing out and a healthy later issue that must still be served before its request expires.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJtZWRpdW0iLCJjYXRlZ29yeSI6ImVkZ2UtY2FzZSIsImZpbGUiOiJkb2NzL0FEUnMvMDA4NS1zZXJ2ZS1jaGFuZ2VkLWppcmEtaXNzdWVzLW9sZGVzdC1maXJzdC5tZCIsImlkIjoiZl9mODBkNmIxM2QzY2Y1NzBmIiwibGluZSI6MTI2LCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJjb3JyZWN0bmVzcyJ9XX0= -->

Review

Findings

Medium

  • [edge-case] docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md:126 — Deferring an unfinished issue at the five-minute deadline has no forward-progress guarantee. The record limit has a first-issue exemption (an issue is always taken when the cycle holds no records yet), but the time limit has none, and the pool is strictly ordered with no skip-ahead. If the oldest active issue consistently takes longer than the remaining budget to read and authorize (sequential, paginated comment and changelog reads, plus a search that now has no row limit), each cycle restarts it, abandons it without advancing its checkpoint, and exits before reaching later issues. Otherwise inexpensive requests can then age out of the 24-hour window, which is the request loss this ADR is meant to prevent.
    Remediation: Specify a progress policy for issues that repeatedly exceed the time budget, such as resumable acquisition or a bounded slow-issue deferral that lets later issues run. Require a test where the first issue cannot finish within one cycle and verify that subsequent cycles make progress rather than repeating the same unfinished prefix.

Labels: PR adds an ADR and updates architecture documentation.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added type/adr component/docs User-facing documentation labels Nov 23, 2026
@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Add a two-minute limit on reading one issue. An issue that takes longer
is treated as a failed read is today: the driver warns, takes none of its
records, leaves its checkpoint where it was, and goes on to the next
issue. This keeps one slow issue at the front of the line from holding
back the issues behind it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Bill Murdock <bmurdock@redhat.com>
@jwm4
jwm4 marked this pull request as draft November 23, 2026 21:41
@jwm4
jwm4 deployed to forgejo-dev November 23, 2026 21:41 — with GitHub Actions Active
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:43 PM UTC · Completed 9:53 PM UTC

Commit: ebd43c8 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.84

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

dispatching. Reading one issue is limited to two minutes. An issue that
takes longer is treated as a failed read is today: the driver warns,
naming the issue, takes none of its records, leaves its checkpoint where
it was, and goes on to the next issue. All of an issue's records go out

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[medium] edge-case

The two-minute per-issue timeout still lets slow issues starve unrelated healthy ones. Under Decision §3 the five-minute cycle budget covers the search and every per-issue read, and a timed-out issue keeps its checkpoint and its place at the front of the ascending-updated order. If two or three of the oldest active issues keep timing out, their reads use up the whole budget every cycle, so issues behind them are never reached, possibly until their requests leave the 24-hour backfill window. Consequences only says "a slow one costs up to two minutes of each cycle" and does not cover several slow issues together. Bounding each failed read does not guarantee progress across cycles.

Suggested fix: Specify a cross-cycle retry/backoff or fair-resumption mechanism (e.g. deprioritize or skip an issue for N cycles after a timeout, or cap the share of the cycle budget spent on previously failed issues), or record this starvation mode explicitly in Consequences as accepted. Require a test with several oldest issues timing out and a healthy later issue that must still be served before its request expires.

This branch was successfully deployed

2 active deployments
site-preview — ebd43c8f Deployed Nov 23, 2026 by github-actions[bot]
forgejo-dev — ebd43c8f Deployed Nov 23, 2026 by jwm4 via forgejo-behaviour #21056
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/docs User-facing documentation risk/moderate PR risk: moderate type/adr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants