Skip to content
mentoor

Topic 3 of 5 · 5 min read

Reviewing a cloud agent's pull request

Goal: Review an agent-opened pull request in risk order and decide to merge, request changes or close it.

Review a cloud agent's pull request in risk order: did it do the task, did it prove it, and did it touch anything it should not have. The agent worked alone, so the pull request is the first time a person sees the result.

Check yourself · 1 of 3

What should you check before reading the code of an agent's pull request?

Choose one answer

Why it matters

An agent's pull request description is its own report on its own work. It can say "all tests pass" after deleting a test, or "fixed" for a problem it only hid. You are the first independent check, and the review often costs more than the agent run did.

A review order that works

  1. Match the task. Re-read the issue. Does the title and diff do that, and only that? A pull request that answers a different question is a close, not a fix.
  2. Look at the file list first. Any file outside the named area, a lockfile change, a config, a CI workflow or a migration deserves a question before you read a line of code.
  3. Read the CI result. Green is necessary. Then ask what CI does not cover.
  4. Read the changed tests. Were tests added for the new behaviour, including the failure case? Were any edited to pass, skipped or removed? A weakened assertion is a red flag.
  5. Read the session log. Cloud agents keep a log of commands and steps. Check which commands it ran, whether setup failed, and whether it ran the tests or only claimed to.
  6. Read the code at the edges, as for any diff: empty input, errors, concurrency, callers of changed functions.
  7. Decide. Merge, request changes with a concrete comment, or close and rewrite the issue. Do not patch a wrong approach line by line.

Before and after

A weak review comment: "Looks good, tests pass."

A better one: "The diff matches the issue. parseInvoice.test.ts lost the case for a missing dueDate (line 41 removed). The code now returns undefined there. Please restore the test and handle the missing date explicitly."

What goes wrong

  • Trusting the description. It summarises intent, not the diff.
  • Reviewing the code before the scope. You spend an hour polishing a change that should never merge.
  • Approving on green CI. The agent may have changed the test that was red.
  • Fixing it yourself silently. You learn nothing about why the issue led to a wrong result. Update the issue or the instructions file too.

Examples

The weakened test

-    expect(total(order)).toBe(118.5)
+    expect(total(order)).toBeGreaterThan(0)

CI is green because the new assertion accepts almost any value. The agent changed the check instead of the code. Request the original assertion back and a real fix.

Out of scope file

The issue asked for a bug fix in src/cart. The file list includes .github/workflows/deploy.yml. Even if the change looks harmless, ask why before reading anything else. A workflow change can alter what runs with secrets.

Key points

  • Start from the issue: the pull request should do that task and only that task.
  • Scan the file list for anything outside scope, such as workflows, configs, lockfiles and migrations.
  • Green CI is necessary, not sufficient; check which tests were added, edited or deleted.
  • Read the session log to see what the agent actually ran.
  • Decide to merge, request changes or close; if the approach is wrong, fix the issue, not the diff.

Common mistakes

  • Reading the pull request description as proof that the work was done.
  • Skipping the file list and going straight to the code.
  • Treating a green build as approval without looking at changed tests.
  • Editing a wrong pull request by hand instead of closing it and improving the issue.

Check yourself · 2 of 3

CI is green on an agent's pull request. What is the most useful next check?

Choose one answer

Check yourself · 3 of 3

An agent's pull request solves a different problem than the issue described, though the code is clean. What do you do?

Choose one answer

Practice items, not counted towards your mastery.

Start here