From f601ed287081732f080e9f9e9fed55a660416272 Mon Sep 17 00:00:00 2001 From: Bill Murdock Date: Fri, 20 Nov 2026 10:04:06 -0500 Subject: [PATCH 1/8] docs(adr): add ADR 0085, serve changed Jira issues oldest first 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 Signed-off-by: Bill Murdock --- .../ADRs/0063-polling-based-work-discovery.md | 9 + ...-serve-changed-jira-issues-oldest-first.md | 208 ++++++++++++++++++ ...ts-only-on-candidates-with-new-activity.md | 7 + docs/architecture.md | 24 +- 4 files changed, 240 insertions(+), 8 deletions(-) create mode 100644 docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md diff --git a/docs/ADRs/0063-polling-based-work-discovery.md b/docs/ADRs/0063-polling-based-work-discovery.md index 81c97c5a54..67c27b5a01 100644 --- a/docs/ADRs/0063-polling-based-work-discovery.md +++ b/docs/ADRs/0063-polling-based-work-discovery.md @@ -49,6 +49,15 @@ on candidates whose Jira `updated` is newer than their checkpoint, and M and N become configurable within bounds. The lock protocol and the random pick among candidates remain. +[ADR 0085](0085-serve-changed-jira-issues-oldest-first.md) partially +supersedes the coordination decisions below for the `jira-poll` driver. One +poller runs per repository, and issues that changed within the driver's +24-hour backfill window are served oldest change first up to a per-cycle +dispatch limit. The row limit on the candidate pool, the random pick, and the +per-issue lock are replaced, together with what depends on the lock (the lock +held during agent runs, the lock settings, the lock handling of +`fullsend poll cancel`, and the expectation of several concurrent pollers). + ## Context Fullsend's primary dispatch path is **event-driven**: forge webhooks are normalized diff --git a/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md b/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md new file mode 100644 index 0000000000..d14e334e3f --- /dev/null +++ b/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md @@ -0,0 +1,208 @@ +--- +title: "85. Serve changed Jira issues oldest first with one poller per repository" +status: Accepted +relates_to: + - agent-infrastructure + - agent-architecture + - security-threat-model +topics: + - polling + - jira + - dispatch + - scheduling + - configuration +--- + +# 85. Serve changed Jira issues oldest first with one poller per repository + +Date: 2026-11-19 + +## Status + +Accepted + +Partially supersedes +[ADR 0160](0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md): +the row limit on the candidate pool, the random pick, the use of the per-issue +lock, and both configuration keys are replaced. Its activity filter and its +checkpoint clause remain. + +Partially supersedes [ADR 0063](0063-polling-based-work-discovery.md) for the +`jira-poll` driver: the row limit on the candidate pool, the random pick, and +the per-issue lock are replaced, together with what depends on the lock (the +lock held during agent runs, the lock settings, the lock handling of +`fullsend poll cancel`, and the expectation of several concurrent pollers). +Its change detection and its authorization path remain. + +## Context + +[ADR 0063](0063-polling-based-work-discovery.md) has the `jira-poll` driver +read the first M results of the configured query (50), drop the issues another +poller has locked, and process N of the rest picked at random (5). +[ADR 0160](0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md) +added a filter that skips issues with nothing new and kept the rest; it is not +implemented yet. Under sustained load this loses requests. An issue outside +the first M results is never examined, an issue inside them can lose the draw +cycle after cycle, and a request that is not processed within the driver's +24-hour backfill window is dropped (see +[Poll coordination](../guides/user/jira-integration.md#poll-coordination)). +ADR 0160 records starvation beyond the first M results as unmitigated. + +The lock and the random pick both exist so that several pollers can work the +same issues at once. The managed poll jobs do not do that: on GitHub +([Scheduled workflow](../guides/user/jira-integration.md#scheduled-workflow)) +and on GitLab +([GitLab runtime](../guides/user/jira-integration.md#gitlab-runtime)) +they run one cycle at a time per repository. The lock and the checkpoint are +also named per target repository, so repositories that share a Jira project +never coordinated through the lock +([Multi-repo polling](../guides/user/jira-integration.md#multi-repo-polling)). +ADR 0160 rejected an oldest-first order only because pollers that sort alike +would race on those locks. + +Two limits of the GitHub hand-off have to survive the change. The managed +workflow passes the whole batch to the dispatch step as one job output and +runs each dispatch record as one job of a job matrix. GitHub allows at most +[256 jobs in a matrix](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstrategymatrix) +and +[1 MB in a job's outputs](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idoutputs), +and the driver commits an issue's checkpoint before the dispatch step runs, so +a batch over either limit is lost whole. Nothing enforces either limit today; +five issues per cycle only makes a large batch rare. + +[ADR 0098](0098-entity-first-harness-evaluation.md) and +[ADR 0149](0149-coalesce-entity-source-discovery-queries.md) set the durable +direction for discovery, and no Jira adapter for it exists yet, so the +`jira-poll` driver stays in service. This ADR aims to stop that driver from +losing requests to its row limit and its random pick, with one change that +leaves change detection and authorization alone. + +## Decision + +We run one `jira-poll` poller per repository and serve every issue that +changed within the backfill window, oldest change first, to remove the row +limit, the random pick, and the lock. + +1. **One poller per repository.** The driver neither reads nor writes the lock + property, and it ignores lock properties left by earlier versions. What + ADR 0063 builds on the lock is withdrawn for this driver along with it: + the lock held during agent runs, the lock settings, and the lock handling + of `fullsend poll cancel`. The managed GitHub workflow and the managed + GitLab schedule already run one cycle at a time per repository. A + scheduler other than the managed ones must itself keep two cycles for one + repository from overlapping; overlapping cycles dispatch the same requests + twice. Before it reads an issue's comments and history, the driver + confirms that it can write to the issue, as the lock write did; an issue + that fails yields no records, and the driver warns and carries on with the + other issues. A cycle in which every issue fails this check ends in an + error, as today, so a credential that cannot write shows as a failed run. + How the driver confirms it is left to the implementation. +2. **Pool.** The issues that match the configured query and whose `updated` + value falls within the driver's backfill window, read in ascending order + of `updated`, with no row limit. The window is the 24 hours the driver + already uses to bound a first poll and to clamp an old checkpoint; its + length is fixed today and does not change. The driver sets the search's + sort order itself: it drops a sort clause from the configured query and + logs once that it did, and the default query no longer carries one. A + candidate is active as ADR 0160 defines it, with the checkpoint returned by + the search itself. That value is used only to skip idle issues; processing + still reads the checkpoint from the issue, as today. +3. **Selection.** The driver processes active issues in that order until the + cycle holds `tracker.jira.poll.max_dispatches_per_cycle` dispatch records + (default 100, from 1 to 250), until on the GitHub target the next issue's + records would take the serialized batch past 768 KB, or until five minutes + have passed since the cycle started. The five minutes include the search + and the per-issue reads: the driver checks the clock between Jira calls, + and the rest of the job's time is left for committing checkpoints and + dispatching. All of an issue's records go out in the same cycle, so an + issue that does not fit in the room left waits and is first in line next + cycle; the driver does not skip ahead to a smaller issue. An issue is + always taken when the cycle holds no records yet, so a cycle can exceed + the configured limit by that one issue. One issue contributes at most 250 + records and, on the GitHub target, 768 KB: the driver keeps the oldest + records, drops the rest with a warning, and advances the checkpoint. + Today's cap of 100 events per issue, which also drops its overflow and + advances the checkpoint, is unchanged. At any of these limits the driver + stops reading, leaves an issue it has not finished for the next cycle, + dispatches what it has completed, commits those checkpoints, and exits + normally. +4. **Bounds.** 250 is GitHub's 256-job matrix limit less a small margin; it + bounds a cycle and a single issue, and it applies on both targets. The + default is 100 because the limit sets how fast a backlog drains, and a + request that waits past the window is lost; it is twenty times today's + five issues per cycle when each issue yields one record. + 768 KB is three quarters of GitHub's 1 MB limit on a job's outputs, + measured as GitHub measures it; the margin is there because GitHub + describes its measure as approximate. It applies on the GitHub target only, + since GitLab starts each pipeline separately and has no batch output. Five + minutes is the managed GitHub schedule's interval and leaves ten minutes of + that poll job's default 15-minute timeout. The default, the size limit, + and the time limit are initial values; revisit them when a deployment needs + more. This one key replaces both keys of ADR 0160, neither of which + shipped. +5. **Unchanged.** Change detection, bot filtering, authorization, the 24-hour + window with its clamps and ADR 0160's one log line per cycle naming the + clamped candidates, the checkpoint commit with ADR 0160's `updated` clause, + and on GitLab the record-by-record dispatch with its retry of an issue + whose dispatch failed. + +## Forge scope + +Applies to the `jira-poll` input driver on both of its targets: GitHub, where +the managed workflow turns the dispatch file into a job matrix, and GitLab, +where the driver starts the agent pipelines itself. The 250 limit comes from +GitHub and is applied on GitLab too, so that there is one rule. The size limit +applies on GitHub only. The GitLab-native cron poller +([ADR 0067](0067-gitlab-cron-polling-event-dispatch.md)) and webhook fast path +([ADR 0125](0125-gitlab-hybrid-webhook-poller-dispatch.md)) are unaffected. +Forgejo has no Jira poll target. + +## Consequences + +- Every issue that changed within the window is eligible each cycle, in + order, so none is skipped because of its position in the results or by + chance. +- Requests are still lost when issues change faster than the driver can + process them within 24 hours, when the poller is stopped for longer than + that, or when one issue produces more than 250 dispatch records, or on + GitHub more than 768 KB of them, in one cycle; removing the window is left + to the entity-based design. +- On the GitHub target a batch is still lost whole when GitHub discards the + job output, which it does when the output contains one of the poll job's + secret values, or when the dispatch step fails after checkpoints are + committed. A checkpoint commit that fails after the write check passed + fails the poll step, and the issues whose commits succeeded lose their + requests. All three exist today, and a larger batch raises what is lost; + changing the hand-over is left to a separate change. +- An issue the driver cannot write to is checked again every cycle until its + change leaves the window. Its requests are not served, and it takes no room + from other issues. +- Any change to a waiting issue, including a comment from anyone allowed to + comment, moves it to the back of the line; under a sustained backlog that + can cost the issue its request. +- A rewound checkpoint can replay old requests from every issue that changed + within the window, where today it reaches five issues per cycle; the + per-cycle limit bounds the runs that starts. A rewind does not move an + issue in the line, so an editor who keeps rewinding issues near the front + can hold newer requests back. The random pick did not allow that; this ADR + accepts it and extends the + [Jira guide](../guides/user/jira-integration.md)'s rule that Edit Issues on + a polled project is part of the trust boundary. +- Each cycle reads the search rows of every issue that changed within the + window, including those already handled, and no longer makes the lock calls + or the per-issue pause. The number of Jira calls in a cycle is now bounded + by the time limit, not by a count. +- The implementation must show that a batch at the record limit and a batch at + the size limit, built from the largest records the driver can produce, are + each dispatched whole, that an issue larger than the configured limit is + dispatched alone and does not hold back the issues behind it, and that a + cycle stopped by the time limit leaves undispatched requests eligible for + the next one; the [Jira guide](../guides/user/jira-integration.md), the + [config reference](../reference/config-reference.md), and the + [custom poller example](../guides/user/custom-poller-example.md) change + with it. +- If entity-based discovery + ([ADR 0098](0098-entity-first-harness-evaluation.md), + [ADR 0149](0149-coalesce-entity-source-discovery-queries.md)) fully + replaces the `jira-poll` driver, this change is retired with it. Until then + it is needed, because the driver loses requests today. diff --git a/docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md b/docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md index 8e2ba89d4c..4d5df07746 100644 --- a/docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md +++ b/docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md @@ -32,6 +32,13 @@ change detection, and authorization path of ADR 0063 and are unchanged; the checkpoint rule gains one clause, so that the checkpoint also advances to at least the issue's `updated` value. +[ADR 0085](0085-serve-changed-jira-issues-oldest-first.md) partially +supersedes this decision: one poller runs per repository and serves every +issue that changed within the driver's 24-hour backfill window, oldest change +first, up to a per-cycle dispatch limit. The row limit on the candidate pool, +the random pick, the use of the per-issue lock, and both configuration keys +are replaced. The activity filter and the checkpoint clause remain. + ## Context [ADR 0063](0063-polling-based-work-discovery.md) defines how the `jira-poll` diff --git a/docs/architecture.md b/docs/architecture.md index 17391303f5..c9cc4335a5 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -551,12 +551,18 @@ The existing design principle is that [the repo is the coordinator](problems/age input drivers to discover work from remote systems (Jira first), coordinates via source-native write-then-verify locks, and feeds the same dispatch pipeline as webhooks ([ADR 0063](ADRs/0063-polling-based-work-discovery.md)). Initial - scope is per-repo mode only. -- Jira poll candidate selection spends per-cycle slots only on candidates - whose Jira `updated` is newer than their per-repository checkpoint, picks - at random among them, and reads the per-cycle caps (N, default 5, and M, - default 50) from `tracker.jira.poll` within fixed bounds - ([ADR 0160](ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md)). + scope is per-repo mode only. In the target state the `jira-poll` driver no + longer uses those locks (see the next item). +- Jira poll candidate selection (target state): one poller per repository + reads every issue that changed within the 24-hour backfill window, oldest + change first, skips issues whose Jira `updated` is not newer than their + per-repository checkpoint, and dispatches up to + `tracker.jira.poll.max_dispatches_per_cycle` records per cycle (default 100, + at most 250) within a five-minute cycle limit, with no row limit on the + candidate pool, no random pick, and no per-issue lock + ([ADR 0085](ADRs/0085-serve-changed-jira-issues-oldest-first.md), partially + superseding [ADR 0063](ADRs/0063-polling-based-work-discovery.md) and + [ADR 0160](ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md)). - Jira poll actor authorization does not require the poller to administer the Jira project once a repository adds a `jira` provider under `authorization:`. With no `jira` entry, every Jira event resolves through the @@ -744,8 +750,10 @@ The existing design principle is that [the repo is the coordinator](problems/age - Is GitHub's event system sufficient for forge-native duplicate protection, or do we need additional coordination beyond label/state conventions and agent idempotency? (Jira polling per ADR 0063 uses entity-property locks and runner - lock refresh; ADR 0165 chooses an operation journal for recoverable effects, - while adapter implementation and external-system guarantees remain open.) + lock refresh, which ADR 0085 removes for the `jira-poll` driver in favor of + one poller per repository; ADR 0165 chooses an operation journal for + recoverable effects, while adapter implementation and external-system + guarantees remain open.) - How does work assignment interact with the backlog/priority agent described in [agent-architecture.md](problems/agent-architecture.md)? - How should explicit cancellation, retry, and reassignment interact with the automatic event-coalescing policy in From ebd43c8f0a99526f3fe3a2b976c833a5c0c204d4 Mon Sep 17 00:00:00 2001 From: Bill Murdock Date: Mon, 23 Nov 2026 16:33:30 -0500 Subject: [PATCH 2/8] docs(adr): limit the time spent reading one Jira issue in ADR 0085 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 Signed-off-by: Bill Murdock --- ...-serve-changed-jira-issues-oldest-first.md | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md b/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md index d14e334e3f..2b33941c81 100644 --- a/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md +++ b/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md @@ -114,13 +114,17 @@ limit, the random pick, and the lock. have passed since the cycle started. The five minutes include the search and the per-issue reads: the driver checks the clock between Jira calls, and the rest of the job's time is left for committing checkpoints and - dispatching. All of an issue's records go out in the same cycle, so an - issue that does not fit in the room left waits and is first in line next - cycle; the driver does not skip ahead to a smaller issue. An issue is - always taken when the cycle holds no records yet, so a cycle can exceed - the configured limit by that one issue. One issue contributes at most 250 - records and, on the GitHub target, 768 KB: the driver keeps the oldest - records, drops the rest with a warning, and advances the checkpoint. + 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 + in the same cycle, so an issue that does not fit in the room left waits + and is first in line next cycle; the driver does not skip ahead to a + smaller issue. An issue is always taken when the cycle holds no records + yet, so a cycle can exceed the configured limit by that one issue. One + issue contributes at most 250 records and, on the GitHub target, 768 KB: + the driver keeps the oldest records, drops the rest with a warning, and + advances the checkpoint. Today's cap of 100 events per issue, which also drops its overflow and advances the checkpoint, is unchanged. At any of these limits the driver stops reading, leaves an issue it has not finished for the next cycle, @@ -136,10 +140,12 @@ limit, the random pick, and the lock. describes its measure as approximate. It applies on the GitHub target only, since GitLab starts each pipeline separately and has no batch output. Five minutes is the managed GitHub schedule's interval and leaves ten minutes of - that poll job's default 15-minute timeout. The default, the size limit, - and the time limit are initial values; revisit them when a deployment needs - more. This one key replaces both keys of ADR 0160, neither of which - shipped. + that poll job's default 15-minute timeout. Two minutes per issue is many + times what an ordinary issue takes, and it leaves room for an issue with + the longest comment and history listings the driver reads. The default, + the size limit, and the two time limits are initial values; revisit them + when a deployment needs more. This one key replaces both keys of ADR 0160, + neither of which shipped. 5. **Unchanged.** Change detection, bot filtering, authorization, the 24-hour window with its clamps and ADR 0160's one log line per cycle naming the clamped candidates, the checkpoint commit with ADR 0160's `updated` clause, @@ -174,9 +180,10 @@ Forgejo has no Jira poll target. fails the poll step, and the issues whose commits succeeded lose their requests. All three exist today, and a larger batch raises what is lost; changing the hand-over is left to a separate change. -- An issue the driver cannot write to is checked again every cycle until its - change leaves the window. Its requests are not served, and it takes no room - from other issues. +- An issue the driver cannot write to, or cannot read within two minutes, is + tried again every cycle until its change leaves the window. Its requests + are not served. It takes no record room from other issues, and a slow one + costs up to two minutes of each cycle. - Any change to a waiting issue, including a comment from anyone allowed to comment, moves it to the back of the line; under a sustained backlog that can cost the issue its request. From 194c022d7559d039aa1d506c886ab5a70da76223 Mon Sep 17 00:00:00 2001 From: Bill Murdock Date: Tue, 24 Nov 2026 08:24:12 -0500 Subject: [PATCH 3/8] docs(adr): keep the configured query's sort order in ADR 0085 Oldest change first becomes the default order, used when the configured query has no sort clause. A query that carries its own sort clause keeps it, as today. The default query drops its newest-first clause, and a query that sorts newest change first draws one warning per cycle. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Bill Murdock --- ...-serve-changed-jira-issues-oldest-first.md | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md b/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md index 2b33941c81..b8cbd5be72 100644 --- a/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md +++ b/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md @@ -80,8 +80,8 @@ leaves change detection and authorization alone. ## Decision We run one `jira-poll` poller per repository and serve every issue that -changed within the backfill window, oldest change first, to remove the row -limit, the random pick, and the lock. +changed within the backfill window, oldest change first by default, to +remove the row limit, the random pick, and the lock. 1. **One poller per repository.** The driver neither reads nor writes the lock property, and it ignores lock properties left by earlier versions. What @@ -98,15 +98,20 @@ limit, the random pick, and the lock. error, as today, so a credential that cannot write shows as a failed run. How the driver confirms it is left to the implementation. 2. **Pool.** The issues that match the configured query and whose `updated` - value falls within the driver's backfill window, read in ascending order - of `updated`, with no row limit. The window is the 24 hours the driver + value falls within the driver's backfill window, read in the search's + sort order, with no row limit. The window is the 24 hours the driver already uses to bound a first poll and to clamp an old checkpoint; its - length is fixed today and does not change. The driver sets the search's - sort order itself: it drops a sort clause from the configured query and - logs once that it did, and the default query no longer carries one. A - candidate is active as ADR 0160 defines it, with the checkpoint returned by - the search itself. That value is used only to skip idle issues; processing - still reads the checkpoint from the issue, as today. + length is fixed today and does not change. The search is sorted oldest + change first unless the configured query carries its own sort clause, + which the driver keeps, as it does today. The default query sorts newest + first today; it no longer carries a sort clause, so it is served oldest + change first. When the configured query sorts newest change first + (`ORDER BY updated DESC`), as the documented examples do today, the driver + warns once per cycle that oldest change first is recommended; any other + order draws no warning. A candidate is active as ADR 0160 defines it, with + the checkpoint returned by the search itself. That value is used only to + skip idle issues; processing still reads the checkpoint from the issue, as + today. 3. **Selection.** The driver processes active issues in that order until the cycle holds `tracker.jira.poll.max_dispatches_per_cycle` dispatch records (default 100, from 1 to 250), until on the GitHub target the next issue's @@ -119,7 +124,7 @@ limit, the random pick, and the lock. 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 in the same cycle, so an issue that does not fit in the room left waits - and is first in line next cycle; the driver does not skip ahead to a + for the next cycle; the driver does not skip ahead to a smaller issue. An issue is always taken when the cycle holds no records yet, so a cycle can exceed the configured limit by that one issue. One issue contributes at most 250 records and, on the GitHub target, 768 KB: @@ -184,14 +189,19 @@ Forgejo has no Jira poll target. tried again every cycle until its change leaves the window. Its requests are not served. It takes no record room from other issues, and a slow one costs up to two minutes of each cycle. -- Any change to a waiting issue, including a comment from anyone allowed to - comment, moves it to the back of the line; under a sustained backlog that - can cost the issue its request. +- A configured query that sets another order is served in that order. Under + a sustained backlog, an order other than oldest change first can leave + older requests waiting until they leave the window, so the guide and the + config reference recommend oldest change first, say what another order + costs, and drop the newest-first sort clause from their example queries. +- Under oldest change first, any change to a waiting issue, including a + comment from anyone allowed to comment, moves it to the back of the line; + under a sustained backlog that can cost the issue its request. - A rewound checkpoint can replay old requests from every issue that changed within the window, where today it reaches five issues per cycle; the per-cycle limit bounds the runs that starts. A rewind does not move an issue in the line, so an editor who keeps rewinding issues near the front - can hold newer requests back. The random pick did not allow that; this ADR + can hold the requests behind them back. The random pick did not allow that; this ADR accepts it and extends the [Jira guide](../guides/user/jira-integration.md)'s rule that Edit Issues on a polled project is part of the trust boundary. From 84843b38d6a78662f8cb45b2e65ed07030da3769 Mon Sep 17 00:00:00 2001 From: Bill Murdock Date: Tue, 24 Nov 2026 10:27:15 -0500 Subject: [PATCH 4/8] docs(adr): make the Jira backfill window a setting in ADR 0085 The window becomes tracker.jira.poll.backfill_window_hours: default 24, at least 1, no upper limit. Consequences name what a long window costs and commit the guide and the config reference to say how to choose it. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Bill Murdock --- ...-serve-changed-jira-issues-oldest-first.md | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md b/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md index b8cbd5be72..ebd98a6c48 100644 --- a/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md +++ b/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md @@ -99,9 +99,11 @@ remove the row limit, the random pick, and the lock. How the driver confirms it is left to the implementation. 2. **Pool.** The issues that match the configured query and whose `updated` value falls within the driver's backfill window, read in the search's - sort order, with no row limit. The window is the 24 hours the driver - already uses to bound a first poll and to clamp an old checkpoint; its - length is fixed today and does not change. The search is sorted oldest + sort order, with no row limit. The window is the one the driver already + uses to bound a first poll and to clamp an old checkpoint. Its length is + fixed at 24 hours today and becomes a setting, + `tracker.jira.poll.backfill_window_hours` (default 24, a whole number of + hours, at least 1, with no upper limit). The search is sorted oldest change first unless the configured query carries its own sort clause, which the driver keeps, as it does today. The default query sorts newest first today; it no longer carries a sort clause, so it is served oldest @@ -149,11 +151,14 @@ remove the row limit, the random pick, and the lock. times what an ordinary issue takes, and it leaves room for an issue with the longest comment and history listings the driver reads. The default, the size limit, and the two time limits are initial values; revisit them - when a deployment needs more. This one key replaces both keys of ADR 0160, - neither of which shipped. -5. **Unchanged.** Change detection, bot filtering, authorization, the 24-hour - window with its clamps and ADR 0160's one log line per cycle naming the - clamped candidates, the checkpoint commit with ADR 0160's `updated` clause, + when a deployment needs more. The window has no upper limit because no + one length suits every project: what a project can afford depends on how + many of its issues change, so the operator chooses. + `max_dispatches_per_cycle` replaces both keys of ADR 0160, neither of + which shipped. +5. **Unchanged.** Change detection, bot filtering, authorization, the + window's clamps and ADR 0160's one log line per cycle naming the clamped + candidates, the checkpoint commit with ADR 0160's `updated` clause, and on GitLab the record-by-record dispatch with its retry of an issue whose dispatch failed. @@ -174,8 +179,8 @@ Forgejo has no Jira poll target. order, so none is skipped because of its position in the results or by chance. - Requests are still lost when issues change faster than the driver can - process them within 24 hours, when the poller is stopped for longer than - that, or when one issue produces more than 250 dispatch records, or on + process them within the window, when the poller is stopped for longer than + the window, or when one issue produces more than 250 dispatch records, or on GitHub more than 768 KB of them, in one cycle; removing the window is left to the entity-based design. - On the GitHub target a batch is still lost whole when GitHub discards the @@ -194,6 +199,12 @@ Forgejo has no Jira poll target. older requests waiting until they leave the window, so the guide and the config reference recommend oldest change first, say what another order costs, and drop the newest-first sort clause from their example queries. +- A longer window lets requests survive a longer outage, at two costs. A + missing or rewound checkpoint replays requests as old as the window. A + window that holds more issues than a cycle can list makes the driver fall + behind without failing, so recent requests are not served and the run still + looks healthy. The guide and the config reference say how to choose the + length and what a long one costs. - Under oldest change first, any change to a waiting issue, including a comment from anyone allowed to comment, moves it to the back of the line; under a sustained backlog that can cost the issue its request. @@ -201,8 +212,8 @@ Forgejo has no Jira poll target. within the window, where today it reaches five issues per cycle; the per-cycle limit bounds the runs that starts. A rewind does not move an issue in the line, so an editor who keeps rewinding issues near the front - can hold the requests behind them back. The random pick did not allow that; this ADR - accepts it and extends the + can hold the requests behind them back. The random pick did not allow + that; this ADR accepts it and extends the [Jira guide](../guides/user/jira-integration.md)'s rule that Edit Issues on a polled project is part of the trust boundary. - Each cycle reads the search rows of every issue that changed within the From d77bc09c21f3418db7c6224179603fb8fece424a Mon Sep 17 00:00:00 2001 From: Bill Murdock Date: Tue, 24 Nov 2026 10:28:43 -0500 Subject: [PATCH 5/8] docs(adr): rename ADR 0085 to serve every changed Jira issue Oldest change first is now the default order and no longer always the order, so the title and file name drop it. The notes in ADR 0063, ADR 0160 and architecture.md follow the new wording and file name. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Bill Murdock --- docs/ADRs/0063-polling-based-work-discovery.md | 6 +++--- ...st-first.md => 0085-serve-every-changed-jira-issue.md} | 4 ++-- ...ira-poll-slots-only-on-candidates-with-new-activity.md | 6 +++--- docs/architecture.md | 8 +++++--- 4 files changed, 13 insertions(+), 11 deletions(-) rename docs/ADRs/{0085-serve-changed-jira-issues-oldest-first.md => 0085-serve-every-changed-jira-issue.md} (98%) diff --git a/docs/ADRs/0063-polling-based-work-discovery.md b/docs/ADRs/0063-polling-based-work-discovery.md index 67c27b5a01..bf7af21111 100644 --- a/docs/ADRs/0063-polling-based-work-discovery.md +++ b/docs/ADRs/0063-polling-based-work-discovery.md @@ -49,11 +49,11 @@ on candidates whose Jira `updated` is newer than their checkpoint, and M and N become configurable within bounds. The lock protocol and the random pick among candidates remain. -[ADR 0085](0085-serve-changed-jira-issues-oldest-first.md) partially +[ADR 0085](0085-serve-every-changed-jira-issue.md) partially supersedes the coordination decisions below for the `jira-poll` driver. One poller runs per repository, and issues that changed within the driver's -24-hour backfill window are served oldest change first up to a per-cycle -dispatch limit. The row limit on the candidate pool, the random pick, and the +backfill window are served, oldest change first by default, up to a +per-cycle dispatch limit. The row limit on the candidate pool, the random pick, and the per-issue lock are replaced, together with what depends on the lock (the lock held during agent runs, the lock settings, the lock handling of `fullsend poll cancel`, and the expectation of several concurrent pollers). diff --git a/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md b/docs/ADRs/0085-serve-every-changed-jira-issue.md similarity index 98% rename from docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md rename to docs/ADRs/0085-serve-every-changed-jira-issue.md index ebd98a6c48..d5a9fba745 100644 --- a/docs/ADRs/0085-serve-changed-jira-issues-oldest-first.md +++ b/docs/ADRs/0085-serve-every-changed-jira-issue.md @@ -1,5 +1,5 @@ --- -title: "85. Serve changed Jira issues oldest first with one poller per repository" +title: "85. Serve every changed Jira issue with one poller per repository" status: Accepted relates_to: - agent-infrastructure @@ -13,7 +13,7 @@ topics: - configuration --- -# 85. Serve changed Jira issues oldest first with one poller per repository +# 85. Serve every changed Jira issue with one poller per repository Date: 2026-11-19 diff --git a/docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md b/docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md index 4d5df07746..1e007b8498 100644 --- a/docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md +++ b/docs/ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md @@ -32,10 +32,10 @@ change detection, and authorization path of ADR 0063 and are unchanged; the checkpoint rule gains one clause, so that the checkpoint also advances to at least the issue's `updated` value. -[ADR 0085](0085-serve-changed-jira-issues-oldest-first.md) partially +[ADR 0085](0085-serve-every-changed-jira-issue.md) partially supersedes this decision: one poller runs per repository and serves every -issue that changed within the driver's 24-hour backfill window, oldest change -first, up to a per-cycle dispatch limit. The row limit on the candidate pool, +issue that changed within the driver's backfill window, oldest change first +by default, up to a per-cycle dispatch limit. The row limit on the candidate pool, the random pick, the use of the per-issue lock, and both configuration keys are replaced. The activity filter and the checkpoint clause remain. diff --git a/docs/architecture.md b/docs/architecture.md index c9cc4335a5..33d4ac7054 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -554,13 +554,15 @@ The existing design principle is that [the repo is the coordinator](problems/age scope is per-repo mode only. In the target state the `jira-poll` driver no longer uses those locks (see the next item). - Jira poll candidate selection (target state): one poller per repository - reads every issue that changed within the 24-hour backfill window, oldest - change first, skips issues whose Jira `updated` is not newer than their + reads every issue that changed within the backfill window + (`tracker.jira.poll.backfill_window_hours`, default 24), oldest change + first unless the configured query sets its own order, skips issues whose + Jira `updated` is not newer than their per-repository checkpoint, and dispatches up to `tracker.jira.poll.max_dispatches_per_cycle` records per cycle (default 100, at most 250) within a five-minute cycle limit, with no row limit on the candidate pool, no random pick, and no per-issue lock - ([ADR 0085](ADRs/0085-serve-changed-jira-issues-oldest-first.md), partially + ([ADR 0085](ADRs/0085-serve-every-changed-jira-issue.md), partially superseding [ADR 0063](ADRs/0063-polling-based-work-discovery.md) and [ADR 0160](ADRs/0160-spend-jira-poll-slots-only-on-candidates-with-new-activity.md)). - Jira poll actor authorization does not require the poller to administer the From 1f1eb4bf2d6b4f5d539911776eaa226d1c167f47 Mon Sep 17 00:00:00 2001 From: Bill Murdock Date: Tue, 24 Nov 2026 10:29:56 -0500 Subject: [PATCH 6/8] docs(adr): record several slow Jira issues as accepted in ADR 0085 Two or three issues that each hit the two-minute read limit can use up a whole cycle. Consequences now says so and that this ADR adds no way to set a slow issue aside. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Bill Murdock --- docs/ADRs/0085-serve-every-changed-jira-issue.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/ADRs/0085-serve-every-changed-jira-issue.md b/docs/ADRs/0085-serve-every-changed-jira-issue.md index d5a9fba745..ea8b1d0983 100644 --- a/docs/ADRs/0085-serve-every-changed-jira-issue.md +++ b/docs/ADRs/0085-serve-every-changed-jira-issue.md @@ -193,7 +193,10 @@ Forgejo has no Jira poll target. - An issue the driver cannot write to, or cannot read within two minutes, is tried again every cycle until its change leaves the window. Its requests are not served. It takes no record room from other issues, and a slow one - costs up to two minutes of each cycle. + costs up to two minutes of each cycle. Two or three slow issues at the + front of the line can use up a whole cycle, and the issues behind them are + then not reached and can lose their requests; this ADR accepts that and + adds no way to set a slow issue aside. - A configured query that sets another order is served in that order. Under a sustained backlog, an order other than oldest change first can leave older requests waiting until they leave the window, so the guide and the From bb6c932e99e8b28185cf49482e910ddf53bcc1bd Mon Sep 17 00:00:00 2001 From: Bill Murdock Date: Tue, 24 Nov 2026 11:12:29 -0500 Subject: [PATCH 7/8] docs(adr): close review gaps in ADR 0085 A cycle in which every issue tried failed or timed out ends in an error, as today, so a poller blocked by slow issues shows as a failed run. Consequences name the third cost of a long window, the upgrade order for the two new keys, and the search client's row cap as something the implementation must not hit silently. The first Consequences bullet and the aim sentence follow the configurable order and window. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Bill Murdock --- .../0085-serve-every-changed-jira-issue.md | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/docs/ADRs/0085-serve-every-changed-jira-issue.md b/docs/ADRs/0085-serve-every-changed-jira-issue.md index ea8b1d0983..9bf20a9a3c 100644 --- a/docs/ADRs/0085-serve-every-changed-jira-issue.md +++ b/docs/ADRs/0085-serve-every-changed-jira-issue.md @@ -75,7 +75,9 @@ five issues per cycle only makes a large batch rare. direction for discovery, and no Jira adapter for it exists yet, so the `jira-poll` driver stays in service. This ADR aims to stop that driver from losing requests to its row limit and its random pick, with one change that -leaves change detection and authorization alone. +leaves change detection and authorization alone. It also lets a deployment +choose the length of the backfill window, so that a longer outage need not +lose requests. ## Decision @@ -136,7 +138,9 @@ remove the row limit, the random pick, and the lock. advances the checkpoint, is unchanged. At any of these limits the driver stops reading, leaves an issue it has not finished for the next cycle, dispatches what it has completed, commits those checkpoints, and exits - normally. + normally. A cycle in which every issue the driver tried failed or timed + out ends in an error, as today, so a poller blocked by slow issues shows + as a failed run. 4. **Bounds.** 250 is GitHub's 256-job matrix limit less a small margin; it bounds a cycle and a single issue, and it applies on both targets. The default is 100 because the limit sets how fast a backlog drains, and a @@ -157,7 +161,8 @@ remove the row limit, the random pick, and the lock. `max_dispatches_per_cycle` replaces both keys of ADR 0160, neither of which shipped. 5. **Unchanged.** Change detection, bot filtering, authorization, the - window's clamps and ADR 0160's one log line per cycle naming the clamped + window's clamps (only the window's length becomes a setting) and + ADR 0160's one log line per cycle naming the clamped candidates, the checkpoint commit with ADR 0160's `updated` clause, and on GitLab the record-by-record dispatch with its retry of an issue whose dispatch failed. @@ -175,9 +180,10 @@ Forgejo has no Jira poll target. ## Consequences -- Every issue that changed within the window is eligible each cycle, in - order, so none is skipped because of its position in the results or by - chance. +- Every issue that changed within the window is eligible each cycle, so none + is cut off by a row limit or lost to chance. Position still matters under + a backlog, behind slow issues, and under a configured order, as the + bullets below say. - Requests are still lost when issues change faster than the driver can process them within the window, when the poller is stopped for longer than the window, or when one issue produces more than 250 dispatch records, or on @@ -195,16 +201,18 @@ Forgejo has no Jira poll target. are not served. It takes no record room from other issues, and a slow one costs up to two minutes of each cycle. Two or three slow issues at the front of the line can use up a whole cycle, and the issues behind them are - then not reached and can lose their requests; this ADR accepts that and + then not reached and can lose their requests. Such a cycle ends in an + error, so the stall shows as failed runs. This ADR accepts the stall and adds no way to set a slow issue aside. - A configured query that sets another order is served in that order. Under a sustained backlog, an order other than oldest change first can leave older requests waiting until they leave the window, so the guide and the config reference recommend oldest change first, say what another order costs, and drop the newest-first sort clause from their example queries. -- A longer window lets requests survive a longer outage, at two costs. A - missing or rewound checkpoint replays requests as old as the window. A - window that holds more issues than a cycle can list makes the driver fall +- A longer window lets requests survive a longer outage, at three costs. A + missing or rewound checkpoint replays requests as old as the window. An + issue the driver cannot write to, or cannot read in time, is retried for + as long as the window. A window that holds more issues than a cycle can list makes the driver fall behind without failing, so recent requests are not served and the run still looks healthy. The guide and the config reference say how to choose the length and what a long one costs. @@ -219,6 +227,11 @@ Forgejo has no Jira poll target. that; this ADR accepts it and extends the [Jira guide](../guides/user/jira-integration.md)'s rule that Edit Issues on a polled project is part of the trust boundary. +- The config loader rejects unknown keys under `tracker.jira.poll`, so a + repository that sets either new key while its workflow still pins an older + fullsend fails to load its config and stops polling; the keys are adopted + after the upgrade, and the config reference names the version that + introduces them. - Each cycle reads the search rows of every issue that changed within the window, including those already handled, and no longer makes the lock calls or the per-issue pause. The number of Jira calls in a cycle is now bounded @@ -226,9 +239,10 @@ Forgejo has no Jira poll target. - The implementation must show that a batch at the record limit and a batch at the size limit, built from the largest records the driver can produce, are each dispatched whole, that an issue larger than the configured limit is - dispatched alone and does not hold back the issues behind it, and that a + dispatched alone and does not hold back the issues behind it, that a cycle stopped by the time limit leaves undispatched requests eligible for - the next one; the [Jira guide](../guides/user/jira-integration.md), the + the next one, and that a pool larger than the 10,000 rows the search + client stops at today is not cut short silently; the [Jira guide](../guides/user/jira-integration.md), the [config reference](../reference/config-reference.md), and the [custom poller example](../guides/user/custom-poller-example.md) change with it. From 75de060d66442d18e9e8c8fba31e355ece7a4def Mon Sep 17 00:00:00 2001 From: Bill Murdock Date: Tue, 24 Nov 2026 11:53:10 -0500 Subject: [PATCH 8/8] docs(adr): give the reason for the per-issue record limit in ADR 0085 An issue past 250 records or 768 KB keeps its oldest records and drops the rest. Decision item 3 now says why: the limit bounds the runs that a rewound checkpoint or a bulk change can start, as today's event cap does. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Bill Murdock --- docs/ADRs/0085-serve-every-changed-jira-issue.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/ADRs/0085-serve-every-changed-jira-issue.md b/docs/ADRs/0085-serve-every-changed-jira-issue.md index 9bf20a9a3c..221294493e 100644 --- a/docs/ADRs/0085-serve-every-changed-jira-issue.md +++ b/docs/ADRs/0085-serve-every-changed-jira-issue.md @@ -133,9 +133,11 @@ remove the row limit, the random pick, and the lock. yet, so a cycle can exceed the configured limit by that one issue. One issue contributes at most 250 records and, on the GitHub target, 768 KB: the driver keeps the oldest records, drops the rest with a warning, and - advances the checkpoint. - Today's cap of 100 events per issue, which also drops its overflow and - advances the checkpoint, is unchanged. At any of these limits the driver + advances the checkpoint. The drop is deliberate and follows today's cap: + one issue does not honestly produce that many records in a cycle, so the + limit bounds the runs that a rewound checkpoint or a bulk change can + start. The warning names the issue. Today's cap of 100 events per issue, + which also drops its overflow and advances the checkpoint, is unchanged. At any of these limits the driver stops reading, leaves an issue it has not finished for the next cycle, dispatches what it has completed, commits those checkpoints, and exits normally. A cycle in which every issue the driver tried failed or timed