# Review genuinely new staging errors

> Compare a bounded staging case window with prior fingerprints, inspect only genuinely new failure modes, and prepare a human-reviewed oncall handoff.

## Agent adaptation contract

- Canonical human page: https://agentry.sh/workflows/staging-watcher
- Execution mode: human_review
- Immutable automation template: none
- Applies to: universal
- Required example events: $exception
- Required Agentry resources: cases, deploys
- Do not use when:
  - Do not use until the example events are mapped to observed project signals, the current onboarding state is verified, and live event/property reads prove the required data is present.
  - Do not automatically send, publish, suppress, mutate, or contact anyone from this workflow.
- Ask before using:
  - Which observed events map to $exception? Is the current onboarding state verified, and do live event/property reads show non-synthetic traffic for them?
  - Which live properties provide $exception.environment, $exception.fingerprint, and which stable user or account identifier joins the signals?

This is an adaptable workflow example, not an API recipe. Map event and property names to the project's saved signal map, require status: "verified" from GET /v1/projects/:project_id/onboarding, and confirm the required signals through live event/property metadata and rows. Fetch current OpenAPI or query-blueprint details before making calls. Do not infer unattended authority from this page.

## Why this matters

Volume thresholds create noise in staging. The higher-value question is
whether a fingerprint is genuinely new, reappeared after resolution, or began
immediately after a deploy. That determination needs bounded case and deploy
evidence, not an unrestricted agent with a webhook.

## Run the review

Fetch the filtered OpenAPI schema for the cases and deploy reads, then use only
their documented query parameters:

```text
GET /v1/projects/:project_id/cases
GET /v1/cases/:case_id
GET /v1/projects/:project_id/deploys
```

Within the interactive session:

1. Select staging cases first seen in the review window.
2. Compare each fingerprint with the prior-day case window.
3. Fetch details only for genuinely new or reappearing fingerprints.
4. Correlate `last_deploy_sha` and recent deploy evidence.
5. Separate proven facts from a suspected code cause.

Raw case details may contain user and request data. Minimize what enters the
summary and do not copy secrets, tokens, or unnecessary identifiers.

## Output format

```text
New staging fingerprints — <UTC window>

<fingerprint>
- first seen / last seen / event count / affected users
- suspect deploy and evidence strength
- top in-app frame and likely owner
- recommended next investigation
- missing evidence
```

Return the handoff to the reviewer. A human decides whether to notify oncall,
suppress noise, change case state, or start a code-fix workflow.

## Instrumentation

Trusted server errors use the server-ingest credential:

```ts
await fetch("https://api.agentry.sh/v1/logs/", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.AGENTRY_SERVER_API_KEY}`,
    "Content-Type": "application/json",
    "User-Agent": "myapp/1.0",
  },
  body: JSON.stringify({
    message: err.message,
    stack: err.stack,
    environment: "staging",
    release: process.env.APP_RELEASE,
  }),
});
```

## Unattended boundary

There is no versioned staging-notification template. A runner cannot receive an
owner key, raw case browsing, generic queries, or messaging authority. If a
reviewed case should enter the supported code-fix path, use the exact
`error-to-draft-pr@2.0.0` template and its policy gates; it may create a draft
PR but still cannot message, merge, deploy, or declare production verification
without the required trusted evidence.

## Variations

- *"Review only fingerprints reappearing after a resolved state."*
- *"Compare the hour after a selected deploy with the hour before it."*
- *"Limit the review to fingerprints affecting at least five distinct users."*
- *"Draft an oncall handoff for a human to review; do not send it."*
