Three AI Agents in Discord: From Customer Complaint to a Tested Pull Request

A customer complaint enters a Discord channel, three narrowly scoped agents turn it into a proposed code change, and automated checks report whether the change is safe to review. A person still owns the final merge decision.
This article describes a demo architecture, not a production incident or a measured benchmark. The commands and configuration are designed to be reproducible, but they have not been executed in the environment where this article is published. Replace example names, repository URLs, image tags, and secrets with values from your own project.
The problem: automate the path, keep the decision
Bug reports often lose time between intake, reproduction, implementation, and review. The desired workflow is straightforward:
- A customer-facing report is captured without exposing personal data.
- A triage agent extracts a small, testable problem statement.
- A fixing agent works in an isolated branch and opens a pull request.
- A review agent checks the diff, tests, and risk signals.
- A human reviews the evidence and decides whether to merge.
The important boundary is authorization. Agents may prepare a change and report evidence; they do not receive permission to merge directly into the default branch.
What the demo contains
The example uses Discord as the operator interface, GitHub as the source-control and review system, and Docker to make the test environment explicit.
Customer report
|
v
Discord #bug-reports
|
v
Triage agent ----> structured issue summary
|
v
Fix agent -------> branch + pull request
|
v
CI in Docker -----> test and lint results
|
v
Review agent ----> risk review in pull request
|
v
Human ----------> approve, request changes, or merge
Each agent has one job:
- Triage agent: converts an unstructured report into symptoms, reproduction steps, expected behavior, actual behavior, and a confidence note.
- Fix agent: reads the approved issue, changes only the relevant files, adds or updates tests, and opens a pull request.
- Review agent: inspects the proposed diff and test output, then comments on correctness, scope, and unresolved risk.
Repository and channel design
Use a small repository for the demo. A minimal layout could look like this:
demo-service/
├── app/
│ └── orders.py
├── tests/
│ └── test_orders.py
├── .github/
│ └── workflows/
│ └── test.yml
├── Dockerfile
└── pyproject.toml
Create separate Discord channels so an agent never has to infer the intended audience from free-form conversation:
#bug-reports human reports and triage commands
#agent-updates status messages and links
#pull-requests review notifications
#agent-admin restricted operational messages
Keep customer names, email addresses, order numbers, access tokens, and full request payloads out of the channels. If a report contains personal data, redact it before the triage agent sees it.
Step 1: define a report contract
Agents work more reliably when the hand-off format is explicit. Ask the triage agent to emit JSON with a bounded schema:
{
"title": "Short bug title",
"summary": "One-sentence description",
"expected": "What should happen",
"actual": "What happens instead",
"reproduction": [
"Step one",
"Step two"
],
"suspected_area": "app/orders.py",
"acceptance_tests": [
"A valid order is still accepted",
"The reported invalid order is rejected"
],
"confidence": "low|medium|high",
"needs_human_clarification": false
}
The schema is an example. In a real project, validate it before passing the result downstream. A missing reproduction step should stop the pipeline or request clarification; it should not be silently invented.
Step 2: connect Discord to triage
A Discord bot can listen for a command such as:
/triage The checkout accepts an order with quantity 0
The bot should perform four checks before invoking the model:
- Verify that the command came from an allowed channel.
- Verify that the user is allowed to start triage.
- Remove or mask known personal-data fields.
- Attach a correlation ID to every downstream message.
A simplified event envelope might be:
{
"correlation_id": "demo-2026-0001",
"source": "discord:#bug-reports",
"report": "The checkout accepts an order with quantity 0",
"repository": "example/demo-service",
"base_branch": "main"
}
Do not put a bot token in source code or in a Discord message. Store it in the runtime secret manager or an environment variable injected by the deployment system.
Step 3: triage before changing code
The triage agent receives the event envelope and read-only repository context. Its instruction should make uncertainty visible:
You are the triage agent.
Return only the specified JSON object.
Do not propose a code change unless the report provides enough evidence.
Do not invent logs, users, timestamps, or reproduction results.
Mark confidence as low when the affected code path is uncertain.
If the report is ambiguous, set needs_human_clarification to true.
The bot posts a compact result back to Discord and stores the full structured record with the correlation ID. The human can then correct the report before the fix agent is allowed to act.
Example status message:
TRIAGE READY · demo-2026-0001
Title: Checkout accepts quantity 0
Suspected area: app/orders.py
Acceptance tests: 2
Confidence: medium
Human clarification: not required
Next action: authorize fix
The “authorize fix” step can be a Discord button, a slash command, or a GitHub issue label. Choose one explicit transition. Reading a triage result should not itself authorize code changes.
Step 4: give the fixing agent a branch boundary
The fixing agent should operate on a short-lived branch named from the correlation ID:
bug/demo-2026-0001-quantity-zero
Its permissions should allow it to:
- read the repository;
- create a branch;
- commit to that branch;
- open a pull request;
- read check results and write a bounded pull-request comment.
Its permissions should not allow it to merge, change branch protection, create organization-level credentials, or modify the workflow that grants those permissions.
A useful fixing instruction is deliberately conservative:
You are the fixing agent.
Work only on the authorized branch.
Read the triage JSON and inspect the relevant implementation and tests.
Make the smallest change that satisfies the acceptance tests.
Do not change dependencies, CI permissions, or unrelated files.
Add a regression test when the behavior can be tested locally.
Run the repository's documented checks.
Open a pull request containing:
- the problem,
- the root-cause hypothesis,
- files changed,
- commands run,
- results observed,
- remaining uncertainty.
For the demo bug, the implementation might add a validation guard in app/orders.py and a test in tests/test_orders.py. That is an example of the expected shape of a change, not a verified patch for a real repository.
Step 5: make tests reproducible with Docker
The container should describe the runtime assumptions clearly. For example:
FROM python:3.12-slim
WORKDIR /workspace
COPY pyproject.toml .
RUN pip install --no-cache-dir pytest ruff
COPY . .
CMD ["pytest", "-q"]
A local operator could build and run the image with:
docker build -t demo-service-checks .
docker run --rm demo-service-checks
These commands are illustrative. The exact install command must match the repository's dependency manager. If the project uses a lockfile, copy and install from that lockfile rather than introducing an unpinned environment.
GitHub Actions can run the same check after the branch is pushed:
name: test
on:
pull_request:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- run: docker build --tag demo-service-checks .
- run: docker run --rm demo-service-checks
Pin action versions according to your organization's policy and review changes to the workflow itself. A passing application test is not evidence that a modified workflow is safe.
Step 6: let the review agent read evidence, not assumptions
The review agent should receive the pull-request diff, the triage JSON, the acceptance tests, and the checks reported by GitHub. It should not report a test as passing merely because the fixing agent said it ran.
Its output can use a fixed comment template:
## Automated review
### Scope
- [ ] Change is limited to the reported problem
- [ ] No unrelated files changed
- [ ] No credentials or personal data added
### Behavior
- [ ] Acceptance test is covered
- [ ] Existing behavior is preserved where expected
- [ ] Error handling is explicit
### Evidence
- Checks observed:
- Checks missing:
- Test output link:
- Remaining uncertainty:
### Recommendation
- approve_for_human_review
- request_changes
- needs_more_information
The recommendation is advisory. A review agent can identify a missing test or suspicious diff; it cannot turn that observation into a merge authorization.
Step 7: enforce the human merge gate
Configure branch protection so that the default branch requires the checks and approvals your project considers necessary. At minimum, the design should ensure:
- direct pushes to the default branch are restricted;
- the required test check must pass;
- at least one human approval is required;
- the fixing and review agents cannot approve their own pull request;
- the agents do not have merge permission.
The human reviewer should inspect the original complaint, the triage record, the diff, the test output, and the review-agent comment. The available decisions are simple: merge, request changes, or close the pull request as incorrect or unnecessary.
End-to-end demonstration sequence
For a repeatable demo, use a synthetic report with no real customer data:
/triage The checkout accepts an order with quantity 0
Then follow this sequence:
- Discord creates correlation ID
demo-2026-0001. - The triage agent produces the structured report.
- A human confirms that the report is actionable.
- The fixing agent creates the branch and changes the smallest relevant surface.
- The fixing agent opens a pull request and posts the commands it claims to have run.
- GitHub runs the Docker-based check.
- The review agent reads the actual check status and comments on the pull request.
- A human reviews the evidence and makes the merge decision.
Record the correlation ID in Discord, the issue or pull-request URL in GitHub, the container tag used for checks, and the final human decision. This creates an audit trail without storing the original customer message everywhere.
Verification checklist
Before calling the demo complete, verify each boundary manually:
- Can an unauthorized Discord user start a fix?
- Can a report containing personal data reach an agent unredacted?
- Can the fixing agent push to the default branch?
- Can either agent approve or merge its own pull request?
- Does the review agent distinguish observed checks from claimed checks?
- Does a failing test block the merge path?
- Can a human stop the workflow before code is changed?
- Can operators trace a Discord message to one branch and one pull request?
For a real rollout, also test token rotation, revoked permissions, duplicate events, network timeouts, malformed model output, and a repository with a deliberately failing test. Those are verification cases to run in your environment; they are not results reported by this article.
Failure cases and recovery
Ambiguous complaint
Stop after triage and ask for a concrete reproduction. A model-generated guess is not a customer fact. Keep the status as “needs clarification” until a human supplies enough detail.
Duplicate Discord event
Use the Discord event ID or correlation ID as an idempotency key. A repeated delivery should update the existing workflow rather than create a second branch and pull request.
Tests fail on the branch
Do not ask the review agent to reinterpret a failing check as success. Return the failure to the fixing agent or to a human, with the exact command and log location.
The diff is too broad
Stop and request changes. A useful guard is a changed-file allowlist or a maximum diff size for automated branches. Exceptions should require a human explanation.
Agent credentials are overpowered
Revoke the token, inspect recent actions, and recreate the integration with narrower permissions. Treat permission review as part of the workflow, not as a one-time setup task.
Limitations
This pattern does not make software maintenance autonomous or risk-free. Agents can misunderstand requirements, overlook edge cases, produce plausible but weak tests, and misread incomplete evidence. Docker improves repeatability but does not guarantee production equivalence. Discord is convenient for coordination but is not a substitute for issue history, access control, or an auditable code-review system.
The most defensible claim for this design is narrower: it can make the path from report to review more structured while preserving a human-controlled merge boundary, provided the permissions, checks, and audit trail are configured correctly.
Closing pattern
Use Discord to collect and coordinate, GitHub to preserve code history and review, Docker to define the test environment, and agents to handle bounded transformations. Keep authorization explicit at every transition. The final question is not whether an agent can open a pull request; it is whether a human can understand the evidence well enough to decide what happens next.
Continue with the guides or look up terms in the glossary.