# External run diagnosis overview

External-run diagnosis is a customer-accessible workflow. It requires a normal
Cofactor login with external-run read access; it does not require psql, Sentry,
AWS, Redis, or superadmin commands.

**Feedback.** Tell Cofactor the moment a step in this guide is wrong, unclear or missing; a command fails in a way the guide did not predict; you took a detour or had to guess; or a tool you needed does not exist. Send it when it happens, not only at the end: one sentence on what happened and what would have helped. Run `cofactor feedback "<what happened; what would have helped>" --topic instructions --command "cofactor external-run guide <section>"`, or call the `cofactor_feedback_submit` MCP tool with the same text, topic and command. Never include secrets, customer data, real names or URLs; use neutral examples (Acme, example.com).

For the source-controlled suite declaration, discovery, selected Sandbox runs
and proof attachment, use the customer test-suite guide (CLI 0.59.0 or later).
This guide stays focused on diagnosing and understanding external runs.

```bash
cofactor test-suite guide
```

Start with:

```bash
cofactor external-run comments <run-id> --item <item-id>
cofactor external-run comment <run-id> --item <item-id> --body "Setup failed" --org Acme
cofactor external-run comments --test <test-id> --json
cofactor external-run comment --test <test-id> --body "Waiting for a fix" --org Acme
cofactor external-run get <run-id>
cofactor external-run failures <run-id> [--area <label|index>]
cofactor external-run triage <run-id> [--area <label|index>]
cofactor external-run skips <run-id>
cofactor external-run debug overview <run-id>
```

Use the result rows to answer what the test framework observed. Use lifecycle
telemetry to answer whether the harness timed out, retried, or recovered. Use
artifacts and a focused rerun to distinguish an application bug from a test or
harness issue.

Cofactor's own AI findings are readable too: `triage` groups a run's failures
into ranked findings, and `diagnosis --item` shows one test's root-cause
diagnosis (see the `ai-findings` section). Treat both as leads to verify
against the evidence, not as conclusions. A developer or local coding agent can
inspect the materialized workspace alongside the customer's test source and
application source.

External test comments follow the test across runs, newest first, with author and time.
A run-item comment defaults to that result and includes its run link; pass `--about test`
to leave a general note. Bodies accept text or `@file` (1–20000 characters).
Read comments with `external-test-comment:read`; add them with `external-test-comment:create`.
Item targets additionally need `external-test-run:read` to resolve the durable test.
Lists accept `--page` (1–10000) and `--page-size` (1–200, default 25); `--json` includes pagination.
Out-of-range paging values are rejected. `--about` accepts `test` or `run` only when
adding a comment addressed by a run item. A denied item lookup explains that
`external-test-run:read` is needed; use `--test` to address the thread directly instead.
The only comment route is `/external-tests/tests/:testId/comments`; item detail exposes
`externalTestId` for resolving the thread. POST accepts `{ body, runItemId? }`; omitting
`runItemId` leaves a general note. GET returns `{ ok, data: comments, pagination }`;
Comments contain `{ id, runItemId, authorId, authorName, body, createdAt, run }`;
`run` is null or `{ runId, createdAt }`. Clients use `runItemId` to build the result link.
