diff --git a/docs/ADRs/0107-bot-identity-resolution-for-dispatch-authorization.md b/docs/ADRs/0107-bot-identity-resolution-for-dispatch-authorization.md index f011ca35d2..0ede6d9cf3 100644 --- a/docs/ADRs/0107-bot-identity-resolution-for-dispatch-authorization.md +++ b/docs/ADRs/0107-bot-identity-resolution-for-dispatch-authorization.md @@ -24,6 +24,9 @@ meet the selected harness's effective `human_min_role` for target CEL dispatch; the accepted label mutation alone no longer bypasses a stronger human minimum. This ADR's provider-classified bot label grant and registered-bot gate remain. +[ADR 0172](0172-let-bot-added-labels-start-agents-on-jira.md) makes the +Jira poll adapter the second implementation of the label grant. + Extends [ADR 0054](0054-require-authorization-on-all-agent-dispatch-paths.md) and defines the bot behavior to be added to the existing v1 contracts. This ADR explicitly permits the deferred migration from legacy bot exceptions to diff --git a/docs/ADRs/0153-authorize-jira-poll-actors-without-project-administration.md b/docs/ADRs/0153-authorize-jira-poll-actors-without-project-administration.md index 69d548821a..eb2da9303d 100644 --- a/docs/ADRs/0153-authorize-jira-poll-actors-without-project-administration.md +++ b/docs/ADRs/0153-authorize-jira-poll-actors-without-project-administration.md @@ -25,6 +25,11 @@ deprecates running the `jira-poll` driver without an entry and makes the entry required. The lists, `labels:` rules and roster loading decided here are unchanged. +[ADR 0172](0172-let-bot-added-labels-start-agents-on-jira.md) stops the +poller from dropping label-added events from its own account and from +accounts the `jira` entry lists. They take the `labels:` rule below; other bot +events stay dropped. + ## Context The `jira-poll` input driver diff --git a/docs/ADRs/0172-let-bot-added-labels-start-agents-on-jira.md b/docs/ADRs/0172-let-bot-added-labels-start-agents-on-jira.md new file mode 100644 index 0000000000..eea19ed104 --- /dev/null +++ b/docs/ADRs/0172-let-bot-added-labels-start-agents-on-jira.md @@ -0,0 +1,178 @@ +--- +title: "172. Let bot-added labels start agents on Jira" +status: Accepted +relates_to: + - agent-architecture + - security-threat-model +topics: + - authorization + - jira + - bots + - dispatch +--- + +# 172. Let bot-added labels start agents on Jira + +Date: 2026-11-12 + +## Status + +Accepted + +## Context + +[ADR 0107](0107-bot-identity-resolution-for-dispatch-authorization.md) keeps +label-added events as the supported way for one agent to hand work to another. +It names GitHub as the only implementation and lets another adapter enable the +same grant once it has forge-authoritative evidence of who made the label +change. Jira's changelog records the author of each label change, and +[ADR 0153](0153-authorize-jira-poll-actors-without-project-administration.md) +already treats an accepted Jira label change as authorization for a human +labeler. + +The `jira-poll` driver +([ADR 0063](0063-polling-based-work-discovery.md)) drops every event it +classifies as bot-authored before authorization or harness matching. An actor +counts as a bot when it is the account the poller authenticates as (added for +the dispatch loop in +[#6835](https://github.com/fullsend-ai/fullsend/issues/6835)), when Jira +reports the account type `app`, or when its display name ends in "bot" or +"automation" or starts with "Automation for". So a label added by the +repository's own Fullsend account never starts an agent. The workaround, +writing labels with a second, ordinarily named account, relies on that name +test and disables the #6835 loop guard, which only works when the poller and +the agents share one Jira account +([#9389](https://github.com/fullsend-ai/fullsend/issues/9389)). + +This ADR aims to let the Fullsend account's own label start an agent, and a +label from another account only when the repository names that account, +without relying on display names and while keeping the #6835 guard for +comments. + +The reasoning in #9389, that an organization controls which accounts can edit +issues in its Jira project, holds for accounts but not for automation rules. +Atlassian reports every change a rule makes as made by the rule's actor +([What is a flow actor?](https://support.atlassian.com/cloud-automation/docs/what-is-a-rule-actor/)), +by default Automation for Jira. Anyone who can create, comment on, or +transition an issue can fire a rule, including people without Edit Issues, and +the changelog names the actor, not the person who fired the rule. Jira's +acceptance of such a label change therefore says nothing about who chose to +make it. No one has recorded which `accountType` Jira reports for that actor, +so the design must not depend on it. + +## Options + +- **Keep dropping all bot events.** Hand-off stays impossible with the shared + account and accidental with any other. +- **Admit all bot events.** Bot comments would reopen the #6835 loop, and + non-label bot dispatch needs the registered bot identity ADR 0107 requires, + which Jira does not have. +- **Admit label-added events from every account classified as a bot.** Any + automation rule that adds a label would then start agents for whoever can + fire the rule. +- **Admit label-added events from the poller's own account, and from accounts + the repository lists, through the repository's `labels:` rule** (chosen). + +## Decision + +We admit Jira label-added events from the poller's own account, and from +accounts the repository's `jira` entry lists, to the dispatch gate to make +Jira the second implementation of ADR 0107's label grant. + +1. **Scope.** Only `label_changed` events with `label.action: added` stop + being dropped. Bot-authored comments, slash commands, label removals, and + issue opened, edited, closed, and reopened events stay dropped, which keeps + the #6835 guard. +2. **`labels:` modes.** An admitted label-added event takes the same path as + a human's under the repository's `jira` authorization entry. Under + `jira_editors`, Jira's acceptance of the label change, with the changelog + author as provenance, is the grant. Under `allowlist`, the account must be + in the `write` or `triage` list, so the poller's own account must be + listed; listing it is the opt-in. Under `project_roles`, or with no `jira` + entry, the account needs a project role like anyone else. In every mode, + matching a harness trigger is still required. +3. **Which accounts count.** A label-added event is admitted only when its + author is the poller's own account ID (provider-controlled metadata from + Jira's `/myself`) or an account ID listed in the `write` or `triage` list + of the repository's `jira` entry. Any other author that the poller + classifies as a bot, whether by Jira's `app` account type or by display + name, such as Jira Automation's actor or an installed app, stays dropped + until the entry lists its account ID. The display-name test therefore only + ever drops events; it never admits one, so it grants nothing. It is not an + enforced boundary, though. An author that no test classifies as a bot is a + human and takes the human rules, so an unlisted automation account that is + not of type `app` and has an ordinary name, or that is renamed to one, + moves from the dropped path to the human path. Under `jira_editors`, its + label addition can then dispatch without its account ID being listed. It + still needs Jira's permission to edit the issue, and this path exists + before this ADR. The guarantee is that the poller's own account and listed + accounts are admitted by account ID, not that every automation account is + kept out. A repository that needs a firm boundary uses `allowlist` or + `project_roles`. +4. **Loop safety** is the harness author's responsibility, as on GitHub. Only + a new label addition dispatches, so re-adding a label that is present + triggers nothing. A loop needs a label to be removed and added again. For + example, an agent removes its trigger label and later adds it back, or + agent A adds B's trigger and B adds back A's trigger after A's was removed. + A harness must not trigger on a label that its own agent, or an agent it + hands off to, adds back; hand-off chains must be acyclic. The + per-issue-per-cycle event cap bounds each poll cycle, not the loop. We + reject telling agents apart by labeler: all of them write through one Jira + account, which the #6835 guard needs. +5. **Jira-only backstop.** Because harness authors alone cannot be trusted to + get a trigger right at upgrade, the poller also limits how many dispatches + one issue can receive from admitted label additions in a rolling window. + The count is kept per issue beside the checkpoint (`lastCheck`) the poller + already holds, so it applies to Jira only and changes nothing on other + forges. Past the limit, further admitted label additions on that issue are + dropped with a warning until the window passes. Ordinary human activity, + such as a comment, does not reset the count, because the author of that + activity need not be authorized to dispatch. Only the rolling window + restores the budget. The limit, window, and setting are decided in the + follow-up implementation. +6. **Untrusted content.** Jira is at parity with GitHub. An agent that reads + issue text and adds a triggering label gives that text's author an indirect + way to trigger the next agent. The label authorizes only its exact + transition, and the content the agent acted on stays untrusted, as ADR 0107 + states. + +## Forge scope + +This decision applies to Jira-sourced events from the shared `jira-poll` +driver, the same under GitHub Actions and GitLab CI. GitHub, GitLab, and +Forgejo event handling are unchanged; ADR 0107 governs their bot events. + +## Consequences + +- A triage agent's label can start the code agent on Jira with the single + shared account, so the second-account workaround and its loss of the #6835 + guard are no longer needed. +- Labels Fullsend itself adds, such as the `fs-code-agent` run marker, become + label-added events that harness triggers can match, so harness authors must + keep triggers off them. +- A cyclic hand-off runs until the per-issue backstop (Decision 5) drops + further additions or a human removes the harness trigger or routing and + cancels any active or queued runs. Removing the label is at most + best-effort: a running agent can add it back, and the poller rebuilds label + additions from changelog history without checking that the label is still + present, so an addition already recorded can still dispatch after removal. +- Only `allowlist` repositories opt in explicitly, by listing the poller's + account. Under `jira_editors`, the default for an entry, and under + `project_roles` or with no entry, the poller's account already holds the + grant or a role, so the change turns on at upgrade with no configuration + change. The default code trigger in the Jira guide matches a `ready-to-code` + label from any actor kind, and triage applies that label, so once the + follow-up ships, triage starts the code agent by itself on every such + deployment. This reverses the guide's current statement that changelog + entries from the poller account do not dispatch agents. The follow-up + implementation must be marked breaking (`!`), ship with a release note, and + document the opt-out: `event.actor.kind == "human"` on the label arm of a + harness override trigger. +- Jira Automation and installed apps do not gain a grant. Their label + additions stay dropped, as today, unless the entry lists the actor's account + ID, and a repository that lists one accepts that anyone who can fire its + rules can start agents. The security threat model notes this. +- The display-name test never admits a label-added event; it can only drop + one. It is not an enforced boundary: an unlisted, non-`app` account with an + ordinary or renamed display name is classified as human and takes the + human rules. diff --git a/docs/architecture.md b/docs/architecture.md index 727fbd9177..927f81e425 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -516,6 +516,13 @@ The existing design principle is that [the repo is the coordinator](problems/age ([ADR 0157](ADRs/0157-require-jira-authorization-entry-for-jira-poll.md), rollout in [#9005](https://github.com/fullsend-ai/fullsend/issues/9005) and [#9006](https://github.com/fullsend-ai/fullsend/issues/9006)). +- Jira bot label hand-off (target state): the Jira poller stops dropping + label-added events from its own account and from accounts the `jira` entry + lists by account ID. They take the repository's `labels:` rule like a + human's. Label additions from other bot accounts, such as Jira Automation, + and all other bot events stay dropped. Harness authors keep hand-off chains + acyclic, and a Jira-only per-issue limit backstops them + ([ADR 0172](ADRs/0172-let-bot-added-labels-start-agents-on-jira.md)). - The Jira site URL is kept for links and cloud-ID discovery, and API calls go through the Atlassian API gateway for the site, whose host can be overridden. A token with the account's email is sent with Basic auth (bot @@ -590,7 +597,9 @@ The existing design principle is that [the repo is the coordinator](problems/age the labeler's verified effective role. Provider-verified bot label handoffs use a separate grant for the exact transition and its proven projection; label-to-agent mapping remains harness/CEL routing. At the time - of ADR 0107, GitHub is the only production implementation. CEL may + of ADR 0107, GitHub is the only production implementation; Jira is the + second for the label grant (target state, + [ADR 0172](ADRs/0172-let-bot-added-labels-start-agents-on-jira.md)). CEL may further restrict recognized bot roles but cannot authorize an unknown bot on non-label paths ([ADR 0107](ADRs/0107-bot-identity-resolution-for-dispatch-authorization.md); [Authorization Contract v1](normative/authorization/v1/) for current dispatch; diff --git a/docs/problems/security-threat-model.md b/docs/problems/security-threat-model.md index 8cfffc7535..2e25f29bbb 100644 --- a/docs/problems/security-threat-model.md +++ b/docs/problems/security-threat-model.md @@ -509,7 +509,7 @@ The [xz backdoor](https://en.wikipedia.org/wiki/XZ_Utils_backdoor) is the slow-b Two controls already shrink the blast radius; neither addresses the identity/intent core. -- **Write-permission dispatch gating** ([ADR 0054](../ADRs/0054-require-authorization-on-all-agent-dispatch-paths.md)). External non-members cannot trigger agent runs by opening issues, opening PRs, or posting slash commands. A maintainer must apply a label or run `/fs-triage`, `/fs-code`, or `/fs-review`. This is a platform-level control every enrolled repo gets. It stops the cheapest form of agentic DOS and injection (untrusted actors forcing inference). It does **not** stop the flood of issues and PRs that still consume human attention, and a maintainer who then asks an agent to "assess this thread" re-opens the injection surface on purpose. +- **Write-permission dispatch gating** ([ADR 0054](../ADRs/0054-require-authorization-on-all-agent-dispatch-paths.md)). External non-members cannot trigger agent runs by opening issues, opening PRs, or posting slash commands. A maintainer must apply a label or run `/fs-triage`, `/fs-code`, or `/fs-review`. On Jira, label additions from Jira Automation or installed apps stay dropped unless the repository lists the actor's account ID, because anyone who can fire an automation rule can make the rule's actor add a label ([ADR 0172](../ADRs/0172-let-bot-added-labels-start-agents-on-jira.md)). This is a platform-level control every enrolled repo gets. It stops the cheapest form of agentic DOS and injection (untrusted actors forcing inference). It does **not** stop the flood of issues and PRs that still consume human attention, and a maintainer who then asks an agent to "assess this thread" re-opens the injection surface on purpose. - **First-contributor attestation and allowlists** (project-level, not a product default). Some projects refuse PRs from accounts a maintainer has not attested — a username allowlist, a cryptographic contributor attestation system such as [vouch](https://github.com/mitchellh/vouch), or an explicit collaborator list. Ghostty discussed [LOC gating by prior merge count](https://github.com/ghostty-org/ghostty/discussions/10550) and adopted an allowlist. These raise the cost of a recognition land-grab on *one* repo. They do not detect coordinated clusters across repos, feature-cloning promotion, or confident nonsense from an account that has already been attested. The allowlist itself becomes a target: a claw's goal is to get onto it. Content sanitization, input-size limits, and per-actor rate limits remain necessary. They do not catch promotional intent, fabricated citations, or a dozen accounts each filing one modest PR.