# Inspect and recover a job

> Read job and test results, reconnect after a disconnect, or retry a failed job.

Source: https://www.sorus.run/docs/guides/results
Reviewed: 2026-10-21

Keep the job identifier and submission key printed by the client.

## Exit codes

| Exit  | Meaning                                 | Next step                                                                            |
| ----- | --------------------------------------- | ------------------------------------------------------------------------------------ |
| `0`   | Command or followed job succeeded       | Read or download the output.                                                         |
| `1`   | Workload outcome                        | Read the compiler, test or cancellation details.                                     |
| `2`   | Invalid, conflicting or refused request | Fix the request, or update an older client if the refusal names a minimum version.   |
| `3`   | Authentication or scope failure         | Check the caller's credential and repository access.                                 |
| `4`   | No outcome observed                     | Inspect the existing job; it may still be running.                                   |
| `5`   | Terminal platform failure               | Inspect the failure, then retry if appropriate. There is no verdict on the workload. |
| `130` | Client follow interrupted               | Reconnect to the job; it continues running.                                          |

For automation, add `--json`. Submitted commands return `exit_code`, `stage`, `refusal`, job identity and outcome fields; diagnostics go to stderr. A request refused before admission has no job outcome. Use the [CLI reference](https://www.sorus.run/docs/reference/cli#exit-codes) for the complete response contract.

## Inspect the job and output

Replace `<job>` with the job identifier:

```sh
cargo sorus jobs get <job> --json
cargo sorus logs <job>
```

`jobs get` reads the current record. `status <job>` follows the job until it finishes. Human-readable logs are available after the attempt closes; requesting them while it is running exits `4`.

The client verifies completed output against the producing attempt's recorded digest and length. If an attempt was stopped, it reports the retained output and its limit. If the platform tried the job again, the client shows the later attempt's output and identifies the earlier attempt.

To keep the exact retained bytes in a new file:

```sh
cargo sorus logs <job> --raw output.log
```

The digest matches the corresponding `provenance.units[].output.sha256` in the job record. Existing destination files are not overwritten.

## Test results

Read the structured results:

```sh
cargo sorus jobs test-results <job> --json
```

They identify the output from which the results were derived. Nextest results include retries, flaky tests and the status of the separate doctest step. A test that passes on retry can produce a successful job while still being reported as flaky.

For a nextest job with a retained JUnit report:

```sh
cargo sorus logs <job> --junit results.xml
```

The client checks the report's digest and length before writing the new file. An ordinary `cargo test` job does not supply this nextest report.

## Disconnect and cancel

Ctrl-C stops following the job and leaves it running. After a lost connection or interrupted follow, reconnect with:

```sh
cargo sorus status <job>
```

To stop it, request cancellation explicitly:

```sh
cargo sorus cancel <job>
```

Read the recorded cancellation source. A user cancellation, an upstream workflow cancellation and the job's wall-clock ceiling have different causes; none should be inferred from a status label alone.

## Resume and retry

For an interrupted submission, repeat the original invocation with its submission key. [Source recovery](https://www.sorus.run/docs/guides/source#resume-a-submission) preserves the captured input and original job identity.

For a terminal platform failure, create a linked retry:

```sh
cargo sorus jobs retry <job>
```

A retry is a new job. Inspect the original before retrying an unknown outcome, and apply your team's retry and usage policy.

## Deadlines

The job records its wall-clock ceiling and where it came from. The platform default is six hours. A repository can set a lower ceiling, and `--wall-clock-ceiling` can select 60–21,600 seconds for one job. See [set a job ceiling](https://www.sorus.run/docs/sorus-ci#wall-clock-ceiling).

## Output delivery failures

A successful workload whose requested output cannot be delivered may produce exit `4`, or `3` for an authentication refusal. Fix the connection or access problem and retrieve that job's output again. A delivery error does not require repeating completed compilation or tests.
