Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Ticket-to-Pull-Request Coding Agent

Design a safe, durable multi-agent coding system that diagnoses an authorized repository issue from linked enterprise context, prepares a tested code change, and opens one reviewable draft pull request.

Problem statement

For this exercise, assume an engineering team authorizes a coding system to process one issue-tracker ticket mapped to one source repository. The critical journey starts when a user submits a specific ticket version and desired base branch.

An orchestrator coordinates specialized LLM agents under that one pinned run, for example for context gathering, code change, and validation, and records every delegation, handoff, and result durably.

The agents gather context, diagnose a plausible cause, propose a plan, edit code in an isolated workspace, run bounded validation, and open or update one draft pull request with its rationale and evidence. A repository policy may require a human to approve the exact proposed action before a gated step continues.

Besides the ticket and repository, the agents may read three linked sources: documentation pages, business-rule entries, and a customer support case in a CRM. These sources are read-only, and each read uses the requesting user's permissions in that system.

Customer data from a support case must be minimized before it reaches any model, and it must never appear in commits, pull-request text, or retained logs.

The ticket, repository contents, linked sources, and test commands are untrusted input. The agents may use only a versioned allowlist of typed tools through a policy-enforced gateway and short-lived credentials.

The system may create a run-scoped branch, commits, and a draft pull request, but it may not merge, deploy, change repository settings, write to the linked sources, expose secrets, or access arbitrary networks.

The pull request must identify the ticket, exact base commit, generated commits, validation results, and unresolved risks. When evidence is insufficient, validation fails, or policy blocks an action, the run produces an explicit needs-human or failed outcome instead of claiming success.

Each acknowledged run pins the ticket version, base commit, agent roles and versions, policy version, and tool definitions. Retrying submission, retrying an agent task, or recovering from a worker crash must not create duplicate active runs or draft pull requests for the same pinned request.

Cancellation stops new work and revokes access, but any external repository operation already accepted must be reconciled. Base-branch changes, uncertain external side effects, and exhausted time, context, or tool budgets produce explicit durable outcomes rather than silent loss.

What to build

  1. An authorized user can idempotently start one run for a pinned ticket and repository base, inspect its plan, agent tasks, and progress, approve or reject a policy-gated action, and cancel active work.
  2. Specialized agents coordinated by the run's orchestrator can gather traceable context from the ticket, repository, linked documentation, business rules, and support case, explain a plausible diagnosis, and produce a bounded code change on an isolated run-scoped branch.
  3. The agent can run policy-allowed tests and static checks with resource limits and retain bounded logs, results, and unresolved risks as review evidence.
  4. The system creates or updates at most one draft pull request for the pinned run, or returns an explicit policy-blocked, needs-human, stale-base, cancelled, validation-failed, or failed outcome.

At scalePractice assumption

  • Accept up to 10 new ticket runs per second and support 2,000 concurrently active runs; most runs finish within ten minutes and every run has a hard 45-minute execution limit.
  • One run may perform at most 100 model or tool steps across all of its agents, use a repository working tree up to 2 GB, and spend at most 15 minutes in test execution before it must stop or request human intervention; any single model call may hold at most 100,000 tokens of context, while the linked sources can be much larger.
  • Committed run state should be visible to an inspecting client within two seconds, while bounded plans, tool records, validation evidence, and audit events are retained for 30 days.
  • After acceptance, loss of any one application process, scheduler, or worker must not lose committed run state or cause a second active run or draft pull request for the same pinned request.