A bounded workflow can check the issue, code, CI results, and related bugs, then give a developer an evidence-backed brief.

By Ashu Kumar

Published: 2026-10-29

URL: https://theagenticstack.substack.com/p/let-an-ai-agent-gather-the-context


Most developers do not start a bug fix by writing code. They start by reconstructing context: opening the issue, searching the repository, finding the change that may have caused the regression, checking CI, looking for a similar bug, and deciding whether the report is complete enough to act on.

The first line of code is often buried under a small research project.

Thanks for reading The Agentic Stack! Subscribe for free to receive new posts and support my work.

That research is a better target for an agent than “write more code.” It is also the part of software delivery that AI has not consistently made easier.

Atlassian’s 2026 State of Developer Experience report found that 87% of developers say AI helps them ship faster, yet 72% experience the same or more friction than before AI. The share reporting savings of 10 or more hours per week fell from 68% in 2025 to 25% in 2026, while 65% said they regularly spend time correcting AI output.

These are survey responses, not a controlled productivity experiment. Still, the pattern is useful: faster code generation can leave handoffs, context switching, and information hunts untouched. Atlassian once again ranked finding information as the largest source of developer friction.

So automate the finding, not the typing.

Build a ticket-preflight agent

A ticket-preflight agent runs when a new bug or maintenance issue enters a selected queue. It assembles the context a developer would otherwise gather by hand, then ends with a clear handoff rather than an unrequested code change.

This is agentic work for a specific reason. The agent follows one ticket across several sources, judges which evidence is relevant, and makes a bounded routing decision: ready for a developer, or waiting for more information.

Use a model only for those judgment calls. Keep scheduling, de-duplication, permissions, retries, schema validation, and state transitions in ordinary software.

A useful division of responsibility looks like this:

-

Ordinary software controls the workflow: triggers, locks, retries, timeouts, status transitions, and validation.

-

The agent handles constrained judgment: requirement completeness, evidence relevance, likely code paths, and the next diagnostic step.

-

A developer owns the result: accepting the brief, changing the code, and approving the fix.

Start with one recurring issue type, such as regression reports that include a repository link. Keep the initial scope deliberately small.

The workflow

New ticket → eligibility check → isolated investigation → validated brief → Ready or Needs Input

The workflow has four stages:

-

Discover: Find eligible tickets, skip tickets already processed, and create one work item for each new ticket.

-

Triage: Check for a repository, reproducible behavior, concrete requirements, and acceptance criteria. Record exactly what is missing instead of inventing it.

-

Enrich: Search likely code paths, recent relevant changes, related issues, open pull requests, and current CI failures. If explicitly approved, run a diagnostic test in an isolated environment.

-

Hand off: Validate the brief against a fixed schema, attach it to the ticket, and route the ticket to Ready or Needs Input. A developer decides whether implementation should begin.

Give every ticket its own isolated session. This prevents one investigation from contaminating another and keeps one failure from taking down an entire batch. Persist the workflow state outside the model so a new session can resume without relying on conversational memory.

“Read-only” needs a precise definition

A preflight agent cannot be completely read-only if it adds a brief or changes a ticket status. The safer design is read-only access to engineering systems and narrowly scoped write access to the issue tracker.

For a first version:

-

allow reads from source repositories, CI logs, issues, and pull requests;

-

allow one idempotent ticket comment or attachment;

-

allow only the Ready and Needs Input transitions;

-

deny source edits, assignments, closures, branch creation, and pull requests;

-

require explicit approval before running commands or diagnostic tests.

Use an idempotency key such as ticket-id + workflow-version so retries cannot create duplicate briefs. Log every source consulted and every permitted write. The agent should never need a general-purpose repository token.

Make the brief easy to verify

The brief is the product. Give it a fixed structure that separates evidence from interpretation:

-

the issue’s claim;

-

reproduction status;

-

links to relevant code and history;

-

the exact failing test or a short log excerpt;

-

what the agent checked;

-

hypotheses, clearly labeled;

-

what remains unknown;

-

one suggested next step.

Here is an illustrative handoff:

Route: Ready

Issue claim: Checkout returns HTTP 500 when a saved address has no postal code.

Reproduction: Confirmed in checkout-address.spec.ts with fixture legacy-customer.json.

Evidence: AddressValidator.ts began requiring postalCode in commit abc123; the migration still permits null values. CI job payments-e2e/4182 fails on the same path.

Hypothesis: The validator change exposed unmigrated legacy records. This is a hypothesis, not a confirmed root cause.

Unknown: Whether production contains other address records with the same shape.

Suggested next step: Run the failing test with a null postal code, then compare validation behavior before and after abc123.

A developer can verify that brief quickly because every conclusion points back to evidence. A summary that hides a guess inside confident prose is worse than no summary.

Build the boring shell before the agent

The model should sit inside a small, predictable state machine. Before adding prompts, define:

-

Eligibility rules: Which issue types, labels, repositories, and statuses can enter the workflow?

-

A durable state record: Has this ticket been discovered, triaged, enriched, or handed off?

-

A strict output contract: Which fields are required, and which route values are valid?

-

Failure behavior: Which calls can retry, when does the workflow stop, and when does it ask a person?

-

A write boundary: Which exact comments, labels, or transitions may the workflow create?

Validate the output before it reaches the issue tracker. Missing evidence links, an unsupported route, or an unlabeled hypothesis should fail validation and return for repair. After a small retry limit, route the ticket to Needs Input instead of allowing an endless agent loop.

This design makes the agent replaceable. You can change models or prompts without rebuilding the workflow around them.

A real pattern, and a useful warning

Red Hat’s engineering team described a similar Jira-to-repository pipeline. It discovers tickets, checks whether each has enough context, enriches incomplete tickets with source-control and CI information, and routes them to Ready or Blocked. Red Hat reports that the pipeline handles dozens of tickets each week and reduces triage from hours to minutes.

That is a company-reported implementation result, not an independent study. Treat it as a result to test in your own environment rather than a promised return.

The more portable lesson is how the design changed. Red Hat’s first attempt put the entire job into one long session. It ran into long runtimes, context limits, weak state tracking, and batch-wide failures. Splitting the process into stages and assigning one isolated session to each ticket contained errors and enabled parallel work.

Two additional lessons from the implementation are worth carrying forward:

-

Agents need guardrails, not broad freedom. “Process these tickets” leaves too many decisions implicit. “Fetch this ticket, use these tools, produce this schema, and choose one of two routes” is easier to validate.

-

Use stateless agents with stateful orchestration. Each session can begin fresh because the workflow records what has happened and what must happen next.

GitHub’s guidance on multi-agent workflows reinforces the same boundary: typed outputs, constrained actions, and structured tool interfaces make agent behavior easier to validate before bad state reaches another system.

Measure the handoff, not the agent’s activity

Run the workflow on one repository and one issue type for a limited pilot. Establish a baseline first, then compare tickets with and without preflight.

Measure:

-

median and 75th-percentile time to the first testable action or precise blocker;

-

the percentage of briefs accepted without factual correction;

-

the percentage of Ready tickets later found to be missing key information;

-

developer time spent finding context versus reviewing or correcting the brief;

-

agent cost per accepted brief;

-

duplicate comments, invalid routes, and workflows requiring manual recovery.

Count review time explicitly. A brief that takes five minutes to verify may still save time. A confident but inaccurate brief can make the ticket slower.

Anthropic’s report on work inside its own company describes a rise in “meta-work” around agents, including writing specifications, reviewing agent output, building visibility tools, and monitoring pipelines. That work is not free. A handoff should reduce a developer’s search burden rather than create another output stream to supervise.

Define a stopping rule before the pilot. If time spent correcting briefs equals or exceeds the search time they save, narrow the workflow or stop it. If most tickets are already well specified, run preflight only on tickets that fail a deterministic completeness check. If a fixed search rule works, keep it as a fixed rule.

The outcome that matters

The productivity gain is not a higher count of AI-generated summaries. It is a shorter, calmer path from “someone filed a ticket” to “an engineer knows what to try next.”

Start with one queue. Let the agent gather the evidence. Keep the implementation decision and the code change with the person who owns the result.

Where does your team lose the first 20 minutes on a task: finding the right code, reconstructing the history, or getting a reproducible failure?


References

-

Atlassian: AI is making developers faster. It’s also exposing what’s broken in software delivery

-

Red Hat: Taming the agent beast: From monolithic prompt to modular agentic workflow

-

Anthropic: How employment is changing at Anthropic

-

GitHub: Multi-agent workflows often fail. Here’s how to engineer ones that don’t

Thanks for reading The Agentic Stack! Subscribe for free to receive new posts and support my work.