---
slug: a-retry-is-an-effect
title: "A retry is an effect"
tag: Security
date: 2026-09-05
published: 2026-11-17
receipts:
  - https://github.com/supernovae-st/nika-spec/commit/989d15d76a219ac5aca8a6b28ff7a976587e9117
  - https://github.com/supernovae-st/nika/commit/07d28b1463814f604ae596ded34ed1a924147eb9
  - https://github.com/supernovae-st/nika/commit/6c1037c64a224ce5aaf2800c22f3d02ac37cea84
  - https://github.com/supernovae-st/nika/commit/44a19df9d8a2c36dd1eaac7dd4e17ba7e407b46a
description: "Since v0.118.6, Nika refuses a declared retry on a POST, PUT, DELETE or PATCH fetch that has no idempotency key: a blind retry can repeat a charge."
---

Automatic retries are one of the first things people add to a workflow that talks to the network. A server is slow, a connection drops, a status page answers 503 for a minute. A `retry:` block with a few attempts and some backoff turns those blips into a green run.

For a read, that is safe. A `GET` sent twice reads twice and changes nothing. A request that changes something is another matter. When a `POST` that charges a card fails, the failure can be ambiguous: the server may have committed the charge before the connection dropped, or before it sent back the 500. A retry then sends the charge again.

The engine changelog records the measurement that settled the question, taken on v0.116.2: "a post-commit 500 under a declared `retry×3` fired 3 calls and 3 charges the run never admitted". Three attempts, three charges, and nothing on the run's card to say so.

## The law, in the spec first

The fix starts in the language specification, not in the engine. On 1 September 2026 the spec gained a section titled "The effect-safe retry law", marked normative, with a new error code, `NIKA-SEC-016`. Normative means any engine that claims to implement the language has to follow it.

The law covers `nika:fetch`, the built-in HTTP tool, when its method "replays side effects (`POST` · `PUT` · `DELETE` · `PATCH`)" and the request carries no `idempotency-key` header. An idempotency key is a unique value sent with a request so the server can recognize a repeat and apply it only once. The law has three parts:

1. Every failure of such a call is typed `transient: false`, for status codes and transport failures alike: "one attempt, never a blind replay of an ambiguous effect."
2. A declared `retry:` with more than one attempt on such a call is refused at check with `NIKA-SEC-016`. That covers a plain retry, which the first rule already makes dead, and a retry filtered by `on_codes:`, which "would blind-replay regardless of `transient`".
3. Pairing the key discharges the law: "the receiver's dedup makes the replay safe and the status table applies unchanged, exactly as it always does for `GET`/`HEAD`".

The spec's conformance list repeats the first rule as a duty. A compliant engine must "Type every failure of a keyless effect-capable `nika:fetch` call `transient: false`".

## The engine follows, in check and in run

The engine's implementation landed the same day. The changelog describes it in three layers:

- At run time, every failure of a keyless mutating fetch is non-transient, so a plain retry never fires on it.
- At check, a declared `retry:` on such a call is the static `NIKA-SEC-016` refusal, "one finding per task, teaching the key".
- Before the run starts, "the admission trust gate refuses the run before any socket".

The check and the run use one shared test. The changelog names it, `nika_types::net::retry_is_effect_safe`, and sums up the point in three characters: "check ≡ run". A file cannot pass the check under one reading of the law and fail the run under another.

## What stays legal

Retrying a read is untouched: "`GET`/`HEAD` retry behavior is unchanged". This task from the spec's release-train example polls a version endpoint after a deploy, with five attempts and exponential backoff:

```text release-train.nika
  verify:
    after:
      ship: success                  # never probe prod for a release that did not go out
    invoke:
      tool: "nika:fetch"
      args:
        url: "https://api.example.com/v1/version"
        mode: jq
        jq: ".version"
    retry:
      # A GET is idempotent, so retrying it replays nothing — the checker warns
      # [retry-effects] when you retry something that is not.
      max_attempts: 5
      backoff_strategy: exponential
      backoff_ms: 5000
```

It names no method, and the spec's builtin reference gives `GET` as the default. Its comment mentions `retry-effects`, an older advisory hint: the changelog's 0.107.0 section says "Retried non-idempotent builtins earn the retry-effects hint". A hint is advice. The new law turns one precise case into a refusal.

The spec's examples and evaluation files include no file of the refused shape, so this post does not write one. The spec's rule says what would happen: with `POST`, `PUT`, `DELETE` or `PATCH` and no `idempotency-key` header, a `retry:` of more than one attempt "is REFUSED at check with `NIKA-SEC-016`". The spec names the repair the refusal teaches: "pair an `idempotency-key` header (the receiver dedups the replay) or drop the `retry:`". With the key, the engine changelog adds, "the declared retry keeps working".

## Two neighbours in the same section

The same changelog section closed two other places where something unknown looked safe.

A model id this build could not resolve, a misspelled one for example, used to count as zero dollars under a spending cap. Such a workflow "passed any cap, and ran with zero budget protection". Now the cap's admission check judges every model id through the same resolver the check uses, and an id it cannot resolve refuses with `NIKA-1709` before the run starts. Local models and the `mock` rehearsal model stay admitted, "free by construction, never by silence".

`nika trace verify`, which checks a run's record, used to report « OK · chain intact » for a journal whose seal line had been cut, with the same exit code as a clean run. It now prints `UNSEALED — no run_sealed frame …` and names three honest causes: a run with no signing key, a run killed before its seal, or a journal cut after it. The changelog adds: "`--sealed` makes a missing seal the same exit-3 refusal `--anchored` gives a missing sidecar, so CI can demand the signed tier."

## When it shipped

The changelog places this work in its 0.117.0 section, dated 2 September 2026. That tag never became a release: its pipeline failed on a permission, and the next section says "`v0.117.0` stays a tag with no release". The tags after it, up to 0.118.5, stopped at other steps. The first complete public release that contains the law is v0.118.6, published on 5 September 2026. The story of those tags is told in [One door, one verdict](/blog/one-door-one-verdict).

## Why it matters

A retry looks like a reliability setting. For a request that changes something, it is a decision to repeat an effect without knowing whether the first one happened. Putting that decision behind a refusal, in the spec and in both halves of the engine, means the file has to say how a repeat will be made safe. Whoever reviews the workflow sees the key, or sees that there is no retry.

## What this does not do

- The law is written for `nika:fetch`, its methods and its headers.
- The law relies on "the receiver's dedup". Whether the server honours the key is up to the server; the key makes a replay safe only where the receiver deduplicates.
- A `method:` written as a template, or a `headers:` shape the checker cannot decide, is in the spec's words "no static claim: the runtime classification of law 1 re-judges the resolved call."
- One attempt is still one attempt. When it fails ambiguously, the run fails and the effect may or may not have happened. The law prevents a second effect, not the doubt about the first.
- `trace verify` checks a record's integrity, not whether the work it records was right.

Read the [v0.118.6 release](https://github.com/supernovae-st/nika/releases/tag/v0.118.6), the [effect-safe retry law in the spec](https://github.com/supernovae-st/nika-spec/blob/main/spec/05-errors.md#the-effect-safe-retry-law-normative--issue-1371), or continue with [The cost line](/blog/the-cost-line).
