All courses

What the agent cannot see

Name what is usually missing from an agent's context: files it never opened, runtime and production behaviour, real data and its volumes, team decisions and the history of why the code looks the way it does, and the intent you never wrote down. Predict which mistakes follow from each gap.

Builds on: What the agent sees: its context

Read it card by card Start the whole course

Green tests, wrong for your system

You ask the agent to make the nightly invoice export write rows in date order. It reads `export.py` and one test file, edits a few lines and reports: "Sorted by `created`; all tests green." The diff is small and tidy. Every check it ran was green. Yet the change may still be wrong for *your* system. How can you tell where it is most likely wrong?

It fills the gaps with 'typical code'

The agent works only from its context: what you wrote, the files it opened and the tool outputs it got. Where that context is silent, it falls back on general training knowledge of what code *usually* looks like. That means small, tidy data, no history and the obvious reading of your words. So its mistakes cluster where your system differs from the usual. Tests built from that same context share its blind spots, so they rarely catch these mistakes. The mistakes surface later, in production.

Five blind spots and what they cause

1. **Files it never opened**: breaks callers, configs or other repos; re-writes helpers that already exist. 2. **Runtime and production behaviour**: code that passes tests but is too slow, or breaks, under real latency, load, config and failures. 3. **Real data and volumes**: assumes small, clean inputs, loads everything into memory, misses odd or missing values. 4. **Team decisions and history**: "simplifies" deliberate oddities. 5. **Unwritten intent**: solves the literal request with the wrong trade-off. Ask: what would it need to have seen, and could it?

The export change, with two blind spots

The test file has 6 invoice rows, so the change looks fine. The tell is that `db.stream` became `fetch_all` plus an in-memory sort. The agent couldn't see the 30 million production rows. It also couldn't see that streaming was chosen after an earlier out-of-memory crash. **Later cost:** the nightly job gets killed for memory. BETTER: keep `stream` and put `ORDER BY created` in the SQL.
// Python
--- a/billing/export.py
+++ b/billing/export.py
 def export_invoices(db, out):
     q = "SELECT * FROM invoices"
-    for row in db.stream(q):
+    rows = db.fetch_all(q)
+    rows.sort(key=lambda r: r["created"])
+    for row in rows:
         out.write(to_csv(row))

"No references found"

Task: "Clean up dead code in `payments/`." Summary: "Removed `legacy_refund()`; no references found." The transcript shows `$ grep -rn legacy_refund src/` returning nothing. Its search covered only `src/`. A job in `deploy/cron.yaml` names the function as a string, and it never opened that file. **Later cost:** the nightly refund job fails at runtime. BETTER: search the whole repo, including configs, and ask yourself who calls it from outside the repo.

Predict errors from what it couldn't see

The agent can't see unopened files, production behaviour, real data, team history or your unstated intent, so it assumes the typical case. When reviewing, ask which of these five gaps the change depends on, and check that gap yourself. Green tests cover only what was in its context. Later you'll learn to hand it these facts up front.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.