Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/reusable-poll-jira.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ jobs:

- name: Poll Jira
env:
GH_TOKEN: ${{ github.token }}
Comment thread
csoceanu marked this conversation as resolved.
Resolved
Comment thread
csoceanu marked this conversation as resolved.
Resolved
Comment thread
csoceanu marked this conversation as resolved.
Resolved
FULLSEND_JIRA_TOKEN: ${{ secrets.FULLSEND_JIRA_TOKEN }}
FULLSEND_JIRA_EMAIL: ${{ secrets.FULLSEND_JIRA_EMAIL }}
FULLSEND_JIRA_CLIENT_ID: ${{ secrets.FULLSEND_JIRA_CLIENT_ID }}
Expand Down
8 changes: 7 additions & 1 deletion docs/cli/README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/guides/user/custom-poller-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
- name: Poll Jira and build dispatch matrix
id: dispatch
env:
GH_TOKEN: ${{ github.token }}
FULLSEND_JIRA_TOKEN: ${{ secrets.FULLSEND_JIRA_TOKEN }}
FULLSEND_JIRA_EMAIL: ${{ secrets.FULLSEND_JIRA_EMAIL }}
FULLSEND_JIRA_CLIENT_ID: ${{ secrets.FULLSEND_JIRA_CLIENT_ID }}
Expand Down
87 changes: 78 additions & 9 deletions docs/guides/user/jira-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,76 @@ Connect fullsend to a Jira project so that Jira issue activity — comments, lab
install writes the scheduled workflow; on GitLab, it creates the pipeline
schedule. See [Scheduled workflow](#scheduled-workflow) and
[GitLab runtime](#gitlab-runtime).
6. **Check which agents handle Jira events.** The poller dispatches an agent
only when its harness `trigger:` CEL expression matches the Jira event, and
produces zero dispatches for a harness with no trigger, its own or
inherited. The built-in triage and code harnesses ship triggers that match
Jira events, so they need no extra configuration:
6. **Check which agents handle Jira events.** A fresh install needs no
`agents:` entries. Each poll run considers the following agents:

- The built-in triage and code agents, unless `agents:` in
`.fullsend/config.yaml` disables one with `enabled: false`. Review, fix,
retro and prioritize are never dispatched from Jira, so the poller does
not fetch them and one that is unavailable cannot fail a poll run. When
the config sets `roles:` (or setup ran with `--agents`), only the
built-in agents those roles select are considered: for example
`roles: [triage]` leaves out code, `coder` selects code, and an explicit
`roles: []` selects no built-in agent. An agent a role does not select is
never fetched.
The poller resolves it the same way
`fullsend run` does: from the `fullsend-ai/agents` release tag that
matches the fullsend release you run, or from `main` for a development
build. It reads the commit that ref points to at the start of the run.
Authentication uses the same token sources as `fullsend run`, in order:
`GH_TOKEN`, `GITHUB_TOKEN`, then `gh auth`. The shipped GitHub workflow
passes its read-only job token to the poll step as `GH_TOKEN`. On GitLab,
supply `GITHUB_TOKEN` as a CI/CD variable (see
[GitLab requirements](#requirements)). With no token, the lookup is
anonymous and shares GitHub's unauthenticated API rate limit with other
jobs using the same public IP address. A refused lookup fails the poll
before checkpoints advance.
- Every agent registered under `agents:` with a `source:` harness. An
entry with a `source:` that has a built-in agent's name replaces that
built-in.

An `agents:` entry without a `source:` only tunes a built-in agent. Two
examples are `- name: triage` with `runtime: claude`, and an entry with a
`harness:` block. The built-in agent still dispatches from Jira, and the
entry's settings apply. Each agent is considered once.

The poller dispatches an agent only when its harness `trigger:` CEL
expression matches the Jira event, and produces zero dispatches for a
harness with no trigger, its own or inherited. The built-in triage and
code harnesses ship triggers that match Jira events, so they need no
extra configuration:

| Built-in agent | Jira events its trigger matches | From |
|---|---|---|
| triage | A `/fs-triage` comment from a human, the `ready-for-triage` label being added, or a human opening or editing an issue | The agents release that follows v0.49.0 |
| code | A `/fs-code` comment from a human, or the `ready-to-code` label being added | The agents release that follows v0.52.0 ([agents#1842](https://github.com/fullsend-ai/agents/pull/1842)) |

The actor still needs the role the agent requires. See
[Actor role resolution](#actor-role-resolution). The default prioritize
trigger also matches a `/fs-prioritize` comment on a Jira issue, but
prioritize has no Jira support yet
[Actor role resolution](#actor-role-resolution). The built-in prioritize
agent is not dispatched from Jira: a `/fs-prioritize` comment on a Jira
issue produces no dispatch, because prioritize has no Jira support yet
([#2266](https://github.com/fullsend-ai/fullsend/issues/2266)). Review,
fix and retro do not run from Jira events: see [How it works](#how-it-works).
fix and retro do not run from Jira events either: see
[How it works](#how-it-works). An agent you register with a `source:` is
considered whatever its name, so a custom harness with a valid Jira
`trigger:` still dispatches.

To stop a built-in agent from dispatching, add an `agents:` entry with
its name and `enabled: false`. This disables the agent on the code host
as well, not only for Jira. If the poller cannot fetch the triage or code
built-in harness, for example because `allowed_remote_resources` leaves out
the agents repository or the lookup is refused, it logs an error for that
agent and the poll run fails. To poll with no access to the agents
repository, register triage and code with a `source:` (a custom source
replaces the built-in, which is then not fetched). The
same holds when it cannot resolve or load any other selected, enabled
agent. The failure happens before any checkpoint advances, so the next
run tries again. When a cycle selects issues but no agent matches a
`/fs-*` command or a label change on them, it logs a
`jira-poll: selected N issue(s) but no agent matched` warning. Ordinary
comments never trigger it. That
warning names each event and the agents considered. See
[Troubleshooting](#troubleshooting).

If your built-in agents are pinned to an earlier agents release, or for a
custom agent, add a `trigger:` to a harness YAML file registered via
Expand Down Expand Up @@ -1067,6 +1120,20 @@ for issues and merge requests.
dispatches.
- The effective config sets `tracker.jira.base_url`, `tracker.jira.project`,
and `tracker.jira.poll.enabled: true` (see [Custom JQL](#custom-jql)).
- When using built-in agents, the poll job needs HTTPS access to github.com,
including `api.github.com` and `raw.githubusercontent.com`, to resolve and
fetch `fullsend-ai/agents`. Set a GitHub token as a **masked, protected
`GITHUB_TOKEN` CI/CD variable** in the GitLab project. This is the same
variable `install-fullsend-cli.sh` accepts; the poll job inherits it and
the CLI uses it for the ref lookup. GitLab does not supply a GitHub token
automatically. `GH_TOKEN`, if also set, takes precedence for the poller.
GitLab job/role tokens and Jira credentials cannot replace this token.
Without a GitHub token or `gh auth`, the lookup is anonymous: GitHub allows
[60 unauthenticated API requests per hour](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api#primary-rate-limit-for-unauthenticated-users)
per public IP address, shared by every repository polling from that address.
Five repositories polling every five minutes can consume all 60 requests
with one ref lookup per cycle, before retries or other API calls. A
rate-limited lookup fails the poll without advancing checkpoints.
- The poll job receives `FULLSEND_JIRA_TOKEN` and, for a bot user,
`FULLSEND_JIRA_EMAIL`. A service account can use
`FULLSEND_JIRA_CLIENT_ID` and `FULLSEND_JIRA_CLIENT_SECRET` instead (see
Expand Down Expand Up @@ -1730,6 +1797,8 @@ However, more pollers against the same Jira project means more API calls per cyc
| `jira: OAuth token request to "https://auth.atlassian.com/oauth/token" with FULLSEND_JIRA_CLIENT_ID and FULLSEND_JIRA_CLIENT_SECRET: unexpected status 401 (invalid_client)` | The service account's OAuth 2.0 client ID or secret is wrong, expired, or revoked | Create a new OAuth 2.0 credential for the service account and update `FULLSEND_JIRA_CLIENT_ID` and `FULLSEND_JIRA_CLIENT_SECRET` with `repos install --jira-client-id --jira-client-secret` |
| `jira: set either FULLSEND_JIRA_TOKEN or FULLSEND_JIRA_CLIENT_ID and FULLSEND_JIRA_CLIENT_SECRET, not both` | Both credential types are set | Keep one. `repos install` removes the other set when you supply new credentials |
| 200 on `/myself` but 403 on issue search | Org restricts personal API tokens for project data | Ask your Atlassian org admin to allow API token access for project data |
| `::warning::jira-poll: selected N issue(s) but no agent matched any of their events` | The poller evaluated a `/fs-*` command or label change on the selected issues, but none matched an agent (ordinary comments are not counted). The warning lists each issue key and event, for example `PROJ-1 (comment_added /fs-code)`, and the agents considered | If the agent is missing from the list, check that it is not disabled under `agents:`. Otherwise, compare the event with the agent's harness `trigger:`, and check that the actor has the role the agent requires. See [Actor role resolution](#actor-role-resolution) |
| `list triggered harnesses: no agents could be loaded` or `list triggered harnesses: some agents could not be loaded` | The poller could not fetch or load the harness of every agent it considers (`no agents`) or of at least one of them (`some agents`). The poller fails in both cases, so an event only the unavailable agent could match is not dropped. One cause is a network failure reaching the `fullsend-ai/agents` repository. Another is an `allowed_remote_resources` list that leaves it out | Check the `::error::harness dispatch: skipping` lines for each agent. No checkpoint advances, so the next poll run retries the same events |
| No dispatches produced | No changes since last poll | Check the `lastCheck` entity property on the issue — the poller only dispatches for changes newer than this timestamp |
| Agent comments or label changes re-dispatch in a loop | A different Jira account posted the agent output than the one the poller authenticates as | The poller classifies its own `/myself` account as `actor.kind: bot` and filters those events. The built-in agents post with the poller's own `FULLSEND_JIRA_TOKEN` and `FULLSEND_JIRA_EMAIL`. Confirm that a custom agent which posts comments or labels uses the same credential, not another account's token. Human follow-up, including `/fs-triage`, still dispatches |
| Your own comments or label changes never dispatch | The poller's `FULLSEND_JIRA_TOKEN` belongs to your own Jira account | The poller classifies its own `/myself` account as `actor.kind: bot`, so that account's comments (including `/fs-triage`) and label changes are filtered with no error. Give the poller a dedicated account; see [Use a dedicated account for the poller](#use-a-dedicated-account-for-the-poller) |
Expand Down
21 changes: 19 additions & 2 deletions docs/reference/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,18 @@ overlay that sets `roles` replaces the parent list entirely (no union).
Omitting the key inherits the parent's roles. See
[Layered Config Reference](../guides/infrastructure/layered-config-reference.md).

Roles also select which built-in agents the Jira poller considers (see
[Jira integration](../guides/user/jira-integration.md)). The poller considers
only the built-in triage and code agents: `triage` enables triage and `coder`
enables code. Review, fix, retro and prioritize are never fetched or
dispatched from Jira, whatever the roles. A built-in agent that no configured
role enables is never fetched or dispatched from Jira. Omitting `roles` falls
back to the parent's roles or the default roles, which select every built-in
agent, while an explicit empty list (`roles: []`) selects none, including over
a parent that lists roles. `roles: null` and a bare `roles:` behave like
omitting the key, as for other list settings that inherit from the parent.
Roles do not scope agents registered with a `source`.

### `agents`

Registered agent sources and per-agent tuning. Each entry identifies an agent
Expand All @@ -264,7 +276,10 @@ effort, sub-agent models, the trigger and harness settings.
against this ref. Empty for SHA-pinned or legacy entries.
- **`enabled`** — Toggle the agent without removing its entry. A
suppression-only entry (`enabled: false`, no source) disables a built-in or
parent-layer agent by name.
parent-layer agent by name. The Jira poller evaluates the enabled,
role-selected built-in triage and code agents without an `agents:`
registration, so `- name: <agent>` with `enabled: false` is how you opt one
of them out of Jira dispatch (see [`roles`](#roles) for role selection).
- **`runtime`**, **`model`**, **`effort`** — Per-agent overrides. An
override-only entry (no source, at least one setting) tunes a built-in
agent by name.
Expand All @@ -289,7 +304,9 @@ effort, sub-agent models, the trigger and harness settings.
and
[Choosing when triage and prioritize run](../guides/user/customizing-agents.md#choosing-when-triage-and-prioritize-run)).
It does not change CEL dispatch: the harness `trigger:` keeps deciding when
custom agents run and what the Jira poller dispatches. A trigger alone
custom agents run and what the Jira poller dispatches for each agent it
considers (every enabled, role-selected built-in triage and code agent and
every registered agent). A trigger alone
makes a valid override-only entry for a built-in agent. Validated when the
agent list is validated: it must compile and return a boolean. Like an
invalid `model` or `effort`, an invalid `trigger` makes every agent run in
Expand Down
3 changes: 3 additions & 0 deletions internal/cli/jira_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ func newJiraLifecycle(t *testing.T, host string) *jiraLifecycle {
require.NoError(t, err)

configDir := writeLifecycleConfig(t)
// The config registers triage, code, review and retro; the remaining
// built-ins resolve with no trigger, so they dispatch nothing.
stubJiraBuiltins(t, nil)
matcher, err := newCELMatcher(context.Background(), configDir)
require.NoError(t, err)

Expand Down
87 changes: 85 additions & 2 deletions internal/cli/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/fullsend-ai/fullsend/internal/forge"
"github.com/fullsend-ai/fullsend/internal/forge/gitlab"
"github.com/fullsend-ai/fullsend/internal/forge/jira"
"github.com/fullsend-ai/fullsend/internal/harness"
"github.com/fullsend-ai/fullsend/internal/harnessdispatch"
"github.com/fullsend-ai/fullsend/internal/jiradispatch"
"github.com/fullsend-ai/fullsend/internal/jirapoll"
Expand Down Expand Up @@ -537,6 +538,9 @@ type celMatcher struct {
// nil when none is listed. It configures the poller's actor role
// resolution and the gate's Jira label rule.
jiraAuth *config.AuthorizationProvider
// killSwitch records that the matcher has no candidates because the
// kill switch is active, rather than because no agent is dispatchable.
killSwitch bool
}

// Match applies the dispatch gate policy the configured jira
Expand Down Expand Up @@ -566,15 +570,94 @@ func newCELMatcher(ctx context.Context, fullsendDir string) (*celMatcher, error)
if cfg.IsKillSwitchActive() {
// Kill switch active: return a matcher with no candidates so all
// events are silently dropped (no dispatches).
return &celMatcher{Matcher: &jiradispatch.Matcher{Auth: jiraAuthOptions(jiraAuth)}, jiraAuth: jiraAuth}, nil
return &celMatcher{Matcher: &jiradispatch.Matcher{Auth: jiraAuthOptions(jiraAuth)}, jiraAuth: jiraAuth, killSwitch: true}, nil
}
candidates, err := harnessdispatch.ListTriggeredHarnesses(ctx, fullsendDir, cfg, nil)
// The effective agents: those registered with a source, plus the
Comment thread
csoceanu marked this conversation as resolved.
Resolved
// built-in agents the config does not disable or replace, resolved
Comment thread
csoceanu marked this conversation as resolved.
Resolved
Comment thread
csoceanu marked this conversation as resolved.
Resolved
// from the agents repository as fullsend run resolves them (#9503).
candidates, err := harnessdispatch.ListEffectiveTriggeredHarnesses(ctx, fullsendDir, cfg, nil, newJiraBuiltinResolverFn())
Comment thread
csoceanu marked this conversation as resolved.
Resolved
if err != nil {
return nil, fmt.Errorf("list triggered harnesses: %w", err)
}
return &celMatcher{Matcher: &jiradispatch.Matcher{Candidates: candidates, Auth: jiraAuthOptions(jiraAuth)}, jiraAuth: jiraAuth}, nil
}

// DispatchCandidates names the agents the matcher evaluates events
// against, for the poller's no-match warning (jirapoll.CandidateReporter).
// An active kill switch drops every event on purpose, so it suppresses the
// warning.
func (m *celMatcher) DispatchCandidates() ([]string, bool) {
if m.killSwitch {
return nil, true
}
var names []string
if m.Matcher != nil {
for _, c := range m.Candidates {
names = append(names, c.Name)
}
}
return names, false
}

// newJiraBuiltinResolverFn returns the resolver the Jira matcher loads
// built-in agents with. Override in tests to resolve built-in harnesses
// from local files without the network.
var newJiraBuiltinResolverFn = func() harnessdispatch.BuiltinResolver {
// Authenticated with the token fullsend run composes with
// (GH_TOKEN, GITHUB_TOKEN or gh auth), so the ref lookup does not
// depend on the anonymous API rate limit. Without a token it falls back
// to anonymous access, as the agents repository is public. The client
// is on the configured host when GITHUB_SERVER_URL and GITHUB_API_URL
// agree, as for fullsend run, so the token never follows GITHUB_API_URL
// alone.
printer := ui.New(os.Stderr)
token, err := resolveToken()
if err != nil {
printer.StepWarn("Git token not available; resolving built-in agents anonymously, which the API rate limit may refuse")
}
return agentsRepoBuiltinResolver(newConfiguredHostGitHubClient(token), printer)
Comment thread
csoceanu marked this conversation as resolved.
Resolved
Comment thread
csoceanu marked this conversation as resolved.
Resolved
Comment thread
csoceanu marked this conversation as resolved.
Resolved
Comment thread
csoceanu marked this conversation as resolved.
Resolved
Comment thread
csoceanu marked this conversation as resolved.
Resolved
}
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Resolved

// agentsRepoBuiltinResolver resolves built-in agents from the agents
// repository with the version-aware fallback fullsend run uses
// (tryAgentsRepoFallback): a release build reads its own release tag and
// other builds main, pinned to the commit the ref resolves to. The ref is
// resolved once, on first use, and every built-in is read from that commit,
// so a poll cycle makes one ref lookup however many built-ins it loads.
// The resolver is not safe for concurrent use.
func agentsRepoBuiltinResolver(forgeClient forge.Client, printer *ui.Printer) harnessdispatch.BuiltinResolver {
var (
pin agentsRepoPin
pinned bool
resolved bool
)
return func(ctx context.Context, name string, opts harness.ComposeOpts) (string, harness.ComposeOpts, bool) {
normalized := strings.ToLower(name)
if !defaultAgentsRepoKnownAgents[normalized] || forgeClient == nil {
return "", opts, false
}
if !resolved {
resolved = true
pin, pinned = resolveAgentsRepoPin(ctx, forgeClient, printer)
}
if !pinned {
return "", opts, false
}
// The configured host serves raw content from itself, so allow it
// in the fetch policy, as fullsend run does.
opts.FetchPolicy = withAgentsRepoHostAllowed(opts.FetchPolicy, forgeClient)
path, dep, ok := fetchAgentsRepoFileAtPin(ctx, "harness/"+normalized+".yaml", pin, forgeClient, opts, printer, "agent "+name)
if !ok {
return "", opts, false
}
// Relative resources resolve against the harness URL, through the
// configured host's API when the harness came from there.
opts.SourceURL = dep.URL
useAgentsRepoHostFetch(&opts, forgeClient)
return path, opts, true
}
}

// jiraAuthOptions returns the dispatch gate policy for the configured
// jira provider: with no jira entry, Jira label-added events take the
// per-harness role threshold as before; with an entry, they are authorized
Expand Down
Loading
Loading