Skip to content

Jira status: close on merge, and gate transitions by issue type #9518

Closed

Description

@shairevivo

Narrowed after review. I originally proposed three hooks here. agents#2005 implements two of them (CODE_JIRA_STARTED_TRANSITION, CODE_JIRA_PR_READY_TRANSITION) through derived-harness env.runner, so this issue now covers only what that PR leaves open. Two mechanisms for the same transition is worse than one.

What is already covered

Hook Implemented by
transition when a code run starts, before sandbox creation agents#2005 CODE_JIRA_STARTED_TRANSITION
transition once the PR/MR is open and non-draft agents#2005 CODE_JIRA_PR_READY_TRANSITION
close transitions from triage shipped, JIRA_*_TRANSITION triage overlay

agents#2005 states its own boundary: "Later draft-to-ready events and merged-PR transitions remain out of scope."

What is still missing

1. Merged → done

No agent runs when a PR merges, so no harness hook can cover it — the post-code script has finished long before. A Jira-sourced issue therefore stays in whatever status the code run left it, after the work is merged and deployed.

Concretely: on a demo project, TSTAPP-1 went New → In Progress at hand and → Closed (resolution Done) at hand, immediately after the PR merged. That is a two-click manual step every Jira user performs, on the artifact most of them opened Jira to watch.

The only events available are code-host ones, so this needs a managed workflow on pull_request_target (base-branch copy, as the shim does), converged by repos install like jira-poll-per-repo.yaml.

2. Gating a transition by issue type

A team rolling this out generally wants to start with one type and widen as trust grows — Bug first, then Story, then everything. Today the only lever is turning a transition on for the whole project.

This does not belong in agents#2005's scripts. The predicate is the same for every caller, and putting it in post-code.sh and pre-code-jira.sh means triage's close path and the merge hook each reimplement it. It belongs at the transition layer, so every existing and future caller inherits it:

fullsend issues transition --tracker jira --transition "In Progress" --if-issue-type Bug,Story

Semantics: match issuetype.name or id; omitted means no filtering (today's behaviour, byte-for-byte). The type is already available from the issue read the transition path performs.

This is independent of the merge hook, needs no ADR, and could land as its own small PR that agents#2005 and the triage overlay adopt by passing a flag.

Proposed shape for the merge hook

Deliberately minimal, since the agent-stage hooks now live in the harness:

tracker:
  jira:
    status_sync:
      pull_request:
        on_merged:
          status: "Closed"        # or transition: "Done"
          resolution: "Done"      # required when the target needs one
          issue_types: [Bug, Story]
        branch_prefixes: [agent/] # optional narrowing; omit = any PR with a resolvable key
  • Names are config because they vary per project (Closed here, Done or Resolved elsewhere). transition and status are alternatives; fullsend issues transition already resolves a target status to its unique transition and rejects ambiguity.
  • Idempotent: read current status, skip when already there.
  • Fail-soft, like run_label — warn, never block the merge.
  • Opt-in: presence of status_sync installs the workflow; absent changes nothing.
  • Bot-loop safe: writes by the poller/service account are classified as bot actions and do not re-dispatch agents.

Open questions

  1. Mechanism consistency. agents#2005 uses derived-harness env.runner. A merge hook has no harness run, so it must be workflow + config. Is that split acceptable, or would maintainers prefer the merge setting to look like the others (a status_sync-style block that repos install renders into the managed workflow)?
  2. ADR? This adds one managed workflow and a tracker write path outside any agent run. Verify Jira work items through the built-in PR lifecycle #8921's contract says PR stages "make no Jira API calls" — this deliberately amends that for one event.
  3. Fail-soft vs hard error. run_label's precedent is warn-and-continue. For an explicitly configured close-on-merge, a silent warning may hide a broken board. Which posture?
  4. Should the type predicate be --if-issue-type, or folded into a broader predicate mechanism?

Acceptance criteria

  • With on_merged configured, a merged PR closes its issue with the configured resolution; without the block, no workflow is installed and nothing changes.
  • --if-issue-type Bug transitions a Bug and no-ops on a Story, with the skip logged and a non-zero-free exit.
  • Re-running either path logs a skip, not an error.
  • A failing transition warns; the merge itself is never blocked.
  • Unknown keys fail at repos install, not at runtime.
  • Tests: resolver (ambiguity, type filter, idempotency), config validation, install convergence, one behaviour test per path.
  • Docs: config-reference.md, plus the Jira guide's "what appears in Jira" table gaining the merge row.

Accepted risk

An agent PR can close its own issue with no human step. That is the point for projects that opt in, and should be stated in the docs. Dispatch authorization is unchanged.

Refs #6704, #8920, #8921, agents#2005.

Activity

  1. fullsend-ai-triage commented on Nov 15, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 8:20 PM UTC · Completed 8:22 PM UTC

    Commit: 18b9476 · View workflow run →

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

  2. added
    feature
    triaged
    on Nov 15, 2026
  3. fullsend-ai-triage commented on Nov 15, 2026

    @fullsend-ai-triage

    This proposal is detailed enough to act on. The prerequisites it cites (#6704, #8920, #8921) are all closed, and no open PR or sub-issue currently addresses it. Open issue #9453 (ADR on Jira feature parity) is related context; the ADR this work needs should be coordinated with it.

    Design points for maintainers (not blockers):

    • The proposal's default is fail-soft, following the run_label precedent. Implementation can proceed on that default unless maintainers decide otherwise.
    • An ADR is warranted: the PR open/merge hooks amend Verify Jira work items through the built-in PR lifecycle #8921's contract that PR-stage agents make no Jira calls. The ADR number should be taken at authoring time (see the renumbering guidance in the repo).
    • The status_sync key name and the plain issue_types list are open questions for maintainers; neither changes the overall implementation shape.

    Workflow-file warning: The PR hooks need a new managed reusable workflow on pull_request_target, plus install convergence, modeled on the existing Jira poll per-repo template. The code agent cannot modify workflow files under current permissions, so that portion needs a human PR or maintainer action. The resolver, config validation, run-start hooks, docs, and ADR can be done separately and could land first.

    Proposed test case:

    Resolver: Bug with issue_types [Bug] transitions via status->unique transition and sets resolution;
    Story is skipped; already-at-target is a logged no-op; ambiguous target status is rejected.
    Config: unknown status_sync keys fail at repos install; absent block installs nothing and makes no Jira calls.
    Failure: failing transition warns, agent run still completes, merge is never blocked.
    Behaviour: one scenario per hook (triage start, code start, PR opened, PR merged).
    

    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  4. ifireball commented on Nov 15, 2026

    @ifireball
    Member

    I do not thing the proposed configuration shape aligns well with how thigns are done in fullsend, first it assumes a very particular set of agents, and second it tightly couples things like issues state and Jira connectivity.

    A more fullsend-native way to do this is to have an option in the agents themselves to move the issue state, jut like the same agents can set labels.

  5. waynesun09 commented on Nov 15, 2026

    @waynesun09
    Member

    The need is real, and I think most of it fits the pattern the agents already use, which also answers the concern about the config shape above. Only the move on merge needs something new.

    What already works this way

    Triage's close cases follow "agent outputs an action, the post-script makes the Jira transition, the name comes from config": JIRA_DUPLICATE_TRANSITION, JIRA_NOT_PLANNED_TRANSITION and JIRA_SPLIT_TRANSITION in harness/triage.yaml in the agents repo.

    Suggested split

    Part of this request Where it can live
    Status names per Jira project, issue-type filter, resolution A status mapping in repo config. This is the part that must be config, because the names are not knowable in code
    Move when a run starts Each agent's pre-script reads its own "started" entry and calls fullsend issues transition. No agent decision is needed. It has to be in the code pre-script too, because a Jira issue can go straight to code without triage
    Move at the end of a run (PR opened, triage result) The post-script, as triage does today
    Move on merge Not here; see below

    With this, the mapping holds names only. It does not need to be keyed on a fixed set of stages or to add a second write path beside the agents.

    Two details for the pre-script move:

    • Do it after the skip checks, so an issue is not marked in progress for a run that then skips.
    • Read the current status first and skip when it already matches, so a triage-then-code flow and a rerun both work.

    The move on merge is a wider gap

    Closing the Jira issue on merge needs an action that runs when a PR merges and looks outward to related work items. The code agent's run ended when the PR opened, and retro, which does trigger on a merged PR, looks back at the run and is not Jira-aware.

    Several open issues appear to need the same hook: #9454 and fullsend-ai/agents#2009 (re-triage what the merge unblocked), #5924 (close linked issues for a non-default target branch), #9458 (fix agent PRs that now conflict), fullsend-ai/agents#586 (superseded PRs and issues). I would design that once, as a post-merge step these can all use, and make "close the Jira issue" one consumer of it, instead of a Jira-only pull_request_target workflow.

    Proposal

    Narrow this issue to the mapping plus the pre-script and post-script moves, and track the merge move with the post-merge design. That first part needs no new workflow file, so the code agent can do it.

  6. jwm4 commented on Nov 15, 2026

    @jwm4
    Contributor

    Related work: agents#2005 (from @ederign , open, waiting on review) is the code agent side of #6704. It adds two optional code agent settings, CODE_JIRA_STARTED_TRANSITION and CODE_JIRA_PR_READY_TRANSITION. Each names a Jira transition to run through fullsend issues transition, and both are off by default. That is the approach ifireball describes above: an option in the agent itself.

    How it lines up with the proposal here:

    • Covered by agents#2005: code.on_start, and pull_request.on_opened for PRs the code agent opens.
    • Not covered: pull_request.on_merged (the PR description lists merged-PR transitions as out of scope), triage.on_start, and the issue_types filter.

    So this issue reads to me as a follow-up to agents#2005 for those three pieces.

    Posted by Bill Murdock with assistance from Claude Code.

  7. waynesun09 commented on Nov 15, 2026

    @waynesun09
    Member

    Update after reading the retro and triage definitions in the agents repo. This replaces the "move on merge" part of my comment above and makes the whole request fit existing mechanisms.

    Proposed shape

    Part Where it lives New mechanism?
    Status names, issue types, resolution A status mapping in repo config Config only
    Move when a run starts Each agent's pre-script, including code's, since a Jira issue can skip triage No
    Move at the end of a run The agent's post-script, as triage's close cases do today No
    Move on merge A new post-merge fleet agent, triggered on event.entity.kind == "change_proposal" && event.transition.kind == "merged" A new harness, no new role

    Why a post-merge agent and not retro

    • Retro is an analyst: its prompt says it does not act, and its result holds only a summary and proposals that become new issues.
    • Retro also runs on PRs closed without merging and on /fs-retro, and a repo can turn it off. Closing a ticket should not depend on it.
    • Every harness whose trigger matches is selected, so post-merge runs beside retro without changing it.

    Why it reuses the triage role

    • The work is changing the state of work items, which is what the triage role is for. Triage's post-script already makes Jira transitions with names from config.
    • Running another agent on a built-in role is already supported: fix shares the coder role with code, and custom agents run on the built-in roles. No new App to install.
    • The agent can run on a small model. The bookkeeping (close the Jira issue from the mapping) happens in the post-script whatever the agent outputs.

    What else it can serve

    The same agent gives a home to other post-merge requests: re-triage what a merge unblocked (#9454, fullsend-ai/agents#2009), close linked issues for a non-default target branch (#5924), and superseded PRs or issues (fullsend-ai/agents#586).

    One thing maintainers need to decide

    reusable-dispatch.yml passes the Jira credentials only to runs whose event source is jira. A merge event comes from the code host, so the post-merge run has no Jira token today. It needs the token on the runner side only, for the post-script, never in the sandbox. That is a small workflow change, but it widens where the token goes, so it should be an explicit decision.

    ADR

    I don't think this needs one. The mapping and the pre- and post-script moves follow the pattern triage already uses, and post-merge is a new fleet agent on an existing role. The credential gate above is the only part that changes a boundary, and it can be decided on its own PR.

  8. changed the title [-]Configurable Jira status sync: move the work item as the pipeline runs and merges[/-] [+]Jira status: close on merge, and gate transitions by issue type[/+] on Nov 16, 2026
  9. fullsend-ai-triage commented on Nov 16, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 11:03 AM UTC · Completed 11:05 AM UTC

    Commit: 4dee2f2 · View workflow run →

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

  10. removed
    feature
    triaged
    on Nov 16, 2026
  11. fullsend-ai-triage commented on Nov 16, 2026

    @fullsend-ai-triage

    This issue bundles two concerns that do not depend on each other, so it is being split. (1) An issue-type predicate on fullsend issues transition, a small, well-specified change at the transition layer that every caller can inherit. (2) The close-on-merge Jira hook, where discussion since the first triage has shown the mechanism is still undecided: a Jira-specific managed workflow, an agent-level option, or a new post-merge fleet agent that other open requests could share. It also needs decisions on passing Jira credentials to code-host-sourced runs, on fail-soft versus hard-error behaviour, and on whether an ADR is required. An earlier triage note recommended the managed workflow plus ADR as the shape; that is superseded and should be settled in the merge-hook issue. Splitting lets the predicate move ahead while the merge design is worked out. Start/PR-ready transitions remain covered by the open agents#2005, which is related context for both. The new issues will be triaged on their own.

    Split into:

  12. shairevivo commented on Nov 17, 2026

    @shairevivo
    ContributorAuthor

    Revised after #9536. That issue changes the premise of this proposal, so the config surface gets smaller — and the decision now belongs in an ADR with #9536 as its dependency.

    What changes. The status mapping was going to carry names (Closed, In Progress) because they vary per project. #9536 shows they're derivable: Jira returns every available transition with its target status and that status's category — new, indeterminate, done — and the categories are identical across projects. --state closed already does this; #9536 adds --state started, prefers Jira's default names when several statuses fit, and returns a skip listing candidates when none resolves.

    Configuration then keeps only what Jira can't infer:

    tracker:
      jira:
        status_sync:
          pull_request:
            on_merged:
              state: closed            # not status: "Closed"
              # transition: "Closed"   # escape hatch for intra-category moves
              # resolution: "Done"     # only where the done move has no site default
              issue_types: [Bug, Story]

    resolution still appears for AISDLC/TSTAPP: their Closed move accepts eleven resolutions and names no default, so the site-default rule in #9536 can't infer one.

    Dependency. The ADR declares #9536 as a hard dependency. Until #9536 lands, only --state closed exists and the started half is unavailable, so the ADR should merge after, or together with, that implementation.

    Merge mechanism. The question stands, but it's narrower than it looked. With names out of config, the main job of a managed workflow — carrying per-project names — goes away. @ifireball's objection (it assumes a particular agent set and couples issue state to Jira connectivity) and @waynesun09's post-merge agent point the same direction. I'd take the post-merge agent: event.transition.kind == "merged" is already in the normalized-event schema, so no new event plumbing is needed.

    I have the ADR drafted and will open it as a PR alongside #9536, once the numbering settles — 0163, 0164 and 0171 are currently claimed by open ADR pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions