> For the complete documentation index, see [llms.txt](https://docs.pharos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/ticketing-and-bugtracking/order-of-execution.md).

# Order of Execution

Learn how issues with existing tickets won't trigger further ticketing automation.

Understanding how Pharos executes ticketing rules and prevents duplicate ticket creation is crucial for building reliable automation. The order of execution model ensures that multiple rules can coexist without creating ticket spam, that manual ticket creation is respected by automation, and that issues transition through ticketing states predictably.

## The Fundamental Safeguard

The most important execution rule in Pharos ticketing is elegantly simple: **once an issue has a linked ticket, ticketing automation rules will not create additional tickets for that issue**.

This safeguard prevents the most common failure mode in automated ticketing systems—rule overlap creating multiple tickets for the same problem. Regardless of how many ticketing rules might match an issue's criteria, and regardless of how many times the issue updates and re-evaluates those rules, only one ticket gets created automatically.

This "ticket-once" principle applies across all rule types. Create-based rules won't fire if the issue already has a ticket. Update-based rules won't fire if the issue already has a ticket. Even if an issue matches ten different ticketing rules, it gets at most one automatically created ticket.

## How Ticket Linking Works

When a ticket is created—whether manually via button click or automatically via a ticketing rule—Pharos records the ticket reference on the issue record. This typically appears as a clickable link in the issue details that takes you directly to the Jira or Azure DevOps ticket.

This linked ticket reference becomes the marker that prevents subsequent automation from firing. Before any ticketing rule executes its action, Pharos checks whether the issue already has a ticket link. If it does, the rule's action is skipped regardless of whether the rule's criteria matched.

The linking mechanism is persistent and survives issue updates, status changes, and priority adjustments. Once linked, the issue remains linked until either the ticket is removed (an unusual manual operation) or the ticket reaches a terminal state and the issue reopens (discussed below).

## Rule Evaluation Sequence

When an event occurs that might trigger ticketing rules—such as an issue being created or updated—Pharos evaluates rules in a deterministic sequence.

### Create-based Rules Fire First

If an issue is being created (not updated), any create-based ticketing rules evaluate before update-based rules. This makes sense logically since creation rules are designed to act immediately on new issues.

Create-based rules evaluate in priority order, with highest priority rules checking their criteria first. However, because of the ticket-once principle, only the first create-based rule that matches will actually create a ticket. All subsequent create-based rules—even if their criteria match—will see that the issue already has a ticket and skip their actions.

In practice, this means create-based rule priority matters primarily when multiple create-based rules might match the same issue. The first matching rule "wins" and creates the ticket, preventing others from firing.

### Update-based Rules Fire on Changes

When an issue updates—such as when a new log occurrence is recorded—update-based rules evaluate to see if the issue has crossed any thresholds that warrant ticketing.

Like create-based rules, update-based rules evaluate in priority order. The first update-based rule that matches and doesn't find an existing ticket will create one. Subsequent update-based rules will skip their actions due to the now-existing ticket link.

This priority ordering means you can create layered update-based strategies. Perhaps a high-priority rule creates critical production bug tickets for issues reaching 25 occurrences in specific functional areas, while a lower-priority rule creates standard bug tickets for issues reaching 50 occurrences anywhere. The high-priority rule will "capture" issues in its target areas before the general rule can fire.

### Manual Creation Overrides Everything

Manual ticket creation via the create ticket button always succeeds regardless of what automation rules exist. This ensures that human judgment can always escalate issues even if they don't match automated criteria.

Once a ticket is created manually, automation rules respect that ticket just as they would respect an automatically created one. The issue now has a linked ticket, so automation won't create additional tickets.

This allows organizations to maintain both automated and manual ticketing paths without conflict. Automation handles common patterns that match well-defined criteria. Manual creation handles edge cases, urgent situations, and scenarios where business context that isn't captured in issue metadata indicates ticketing is appropriate.

## Preventing Duplicate Tickets

The execution model's primary purpose is preventing duplicate tickets, which it accomplishes through several mechanisms working together.

### The Single-Ticket Guarantee

The ticket-once principle provides absolute guarantee against duplicate automated creation. No matter how rules are configured or what thresholds are set, an issue will never receive more than one automatically created ticket unless that ticket is removed or the issue lifecycle resets (reopening after resolution).

This is a hard constraint enforced at the execution level, not a configuration guideline. You cannot accidentally configure rules that create duplicate tickets through criteria overlap—the execution engine prevents it structurally.

### Cross-Rule Coordination

Rules don't need explicit coordination logic to avoid duplicating each other's tickets. They implicitly coordinate through the shared ticket link check. This means you can add, remove, or modify ticketing rules without worrying about how they interact with existing rules—the execution model handles coordination automatically.

This dramatically simplifies rule management as your ticketing automation grows more sophisticated. Each rule can be designed and tuned independently, focusing solely on when it should create a ticket, without defensive logic about whether other rules might have already created one.

### Manual-Automation Harmony

The execution model treats manually and automatically created tickets identically for purposes of preventing further automation. This means manual ticket creation doesn't just bypass automation—it actively prevents automation from firing later.

This is valuable in triage workflows where an operator might create a ticket manually for an issue that doesn't yet meet automated thresholds but clearly warrants attention. That manual ticket prevents automation from creating a second ticket if the issue later crosses thresholds.

## Rule Priority and Specificity

Understanding rule priority helps design ticketing automation that applies the most appropriate ticket template and routing to each issue.

### Priority as Specificity

Rule priority should generally reflect rule specificity. More specific rules—those targeting narrow functional areas or particular error patterns—should have higher priority than general rules that match broad categories.

This ensures that issues landing in high-specificity scenarios receive appropriately specialized tickets rather than generic ones. For example:

**Priority 1 (Highest)**: Order processing critical errors in production\
**Priority 2**: Integration failures in production\
**Priority 3**: High-priority production issues (general)\
**Priority 4**: Medium-priority production issues (general)\
**Priority 5 (Lowest)**: Any production issue crossing occurrence threshold

An order processing error would match both the Priority 1 rule and the Priority 3 or 4 rules (depending on its priority). But because Priority 1 evaluates first, it creates a specialized ticket with order-processing-specific routing and template before the general rules can fire.

### Avoiding Priority Confusion

Rules with equivalent specificity that might match the same issues should be examined carefully. Either their criteria should be refined to be mutually exclusive, or their priorities should be set consciously recognizing that one will take precedence over the other.

For example, if you have both an "Order Processing" rule and a "Payment Processing" rule at the same priority level, issues can only match one or the other based on their functional area metadata. These rules are implicitly mutually exclusive even at the same priority.

But if you have both a "High Priority Production" rule and a "Frequent Production Errors" rule at the same priority level, an issue might match both if it's both high priority and frequent. In this case, priority ordering determines which template and routing get applied.

## Reopening and Ticket Lifecycle

The ticket-once principle applies within an issue's lifecycle, but that lifecycle can reset under certain conditions.

### Issue Reopening After Resolution

When an issue is marked resolved (typically synchronized from the bugtracker when its ticket is closed), and then new occurrences arrive indicating the problem has returned, Pharos reopens the issue. This reopening represents a meaningful lifecycle transition—the problem was thought fixed but has recurred.

Upon reopening, Pharos creates a **new** ticket and links it to the original resolved one, so the regression is visible from either end. The original ticket is never reopened — deliberately, since reopening a ticket that belongs to a closed sprint or a shipped release distorts the metrics and workflow of the bugtracker.

This is also what resets the ticket-once constraint: the issue can receive another automatically created ticket precisely because its lifecycle cycled through resolution and back to active.

### Resolved Issues and Automation

Once an issue is in resolved status, ticketing automation typically stops evaluating it for new ticket creation. The issue is effectively out of the active automation workflow until it reopens.

This prevents automation from creating tickets for issues that are already resolved, even if those issues technically meet ticketing criteria. Perhaps an issue accumulated significant occurrences before being resolved—you don't want to create a ticket for those occurrences after the fact just because they crossed a threshold.

## Comment Actions and Execution

While creation actions are subject to the ticket-once constraint, comment actions work differently. Comment actions can fire multiple times on the same issue as long as their triggering conditions are met, adding notes to the existing ticket rather than creating new ones.

This allows for progressive ticket updates as issues evolve. Perhaps a comment action fires when an issue doubles its occurrence count, adding a note to the ticket: "Occurrence volume has doubled from 50 to 100 in 24 hours." Later, when the issue reaches 200 occurrences, the same or a different comment action might fire again with updated information.

Comment actions respect ticket existence as a prerequisite rather than a blocker—they only fire if the issue has a linked ticket (because there's nothing to comment on otherwise), but they're not prevented from firing by that ticket's existence like creation actions are.

### Comment Action Ordering

When multiple comment actions might fire on the same issue update, they execute in priority order similar to creation actions. However, unlike creation actions where only the first matching rule fires, comment actions can all fire if their criteria match. This allows for layered commenting strategies where different thresholds trigger different comment updates.

## Practical Configuration Implications

Understanding execution order informs how you structure your ticketing automation for optimal results.

### Start with Broad, Low-Priority Rules

When first implementing automation, start with broad, low-priority rules that catch general patterns. As you identify more specific scenarios that need specialized handling, add higher-priority rules for those scenarios.

This approach ensures that general automation is in place providing baseline coverage while you progressively refine for specific cases. Issues that don't match specific rules will fall through to general rules rather than going unticketed.

### Use Specificity to Control Templates

Rather than building complex conditional logic into ticketing actions, use rule priority to ensure issues get the most specific applicable template. Create specialized rules with appropriate priorities for functional areas, severity levels, or error patterns that need custom handling.

The execution model ensures the most specific matching rule creates the ticket, so templates automatically match issue specificity without runtime decision logic.

### Manual Creation as Override

Design automation assuming manual creation will occasionally override it. Operators should feel empowered to manually create tickets for issues that don't match automation criteria when business context warrants it.

The execution model makes this safe—manual creation won't conflict with automation, and automation won't duplicate manually created tickets. This trust enables productive human-automation partnership.

{% hint style="success" %}
**Execution Model Benefits**

The order of execution model provides several key guarantees:

* **No duplicate automated tickets**: Issues receive at most one automatically created ticket per lifecycle
* **Manual override safety**: Human ticket creation always succeeds and prevents subsequent automation
* **Rule independence**: Rules can be added, removed, or modified without coordination logic
* **Predictable priority**: Most specific matching rule determines ticket template and routing
* **Progressive commenting**: Issues can receive multiple comment updates as they evolve

These guarantees simplify configuration and make ticketing automation reliable even as complexity grows.
{% endhint %}

## Monitoring and Validation

The execution model's safeguards work automatically, but monitoring ensures they're working as intended and that your rule priority structure produces desired results.

### Verify Ticket Assignment

After implementing new rules, check several issues that should match multiple rules to verify that the highest-priority expected rule is creating tickets. If lower-priority rules are creating tickets unexpectedly, criteria overlap or priority ordering may need adjustment.

### Check for Unticketed Issues

Periodically review issues that didn't receive automated tickets to ensure important problems aren't falling through gaps in your rule criteria. The execution model prevents duplicate tickets reliably, but it can't create tickets for issues that don't match any rule criteria.

### Monitor Comment Action Frequency

If comment actions are firing too frequently or not frequently enough, their threshold criteria may need tuning. Unlike creation actions where over-firing creates duplicates, comment over-firing just creates noise in ticket comments without breaking functionality—but it still represents configuration that needs refinement.

## Next Steps

With a solid understanding of execution mechanics, explore the rules and actions that work within this model:

* [**Update-based Triggering**](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/ticketing-and-bugtracking/issue-level-ticketing/update-based-triggering.md) - Most common automation approach leveraging execution safeguards
* [**Create-based Triggering**](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/ticketing-and-bugtracking/issue-level-ticketing/create-based-triggering.md) - Immediate automation understanding priority implications
* [**Ticketing Actions**](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/ticketing-and-bugtracking/issue-level-ticketing/ticketing-actions.md) - Building the actions that rules invoke
* [**Manual Ticket Creation**](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/ticketing-and-bugtracking/issue-level-ticketing/manual-ticket-creation.md) - Understanding how manual creation fits the execution model
