The duplicate-email test

N17Q derived stable external-effect identity from the run’s semantic intent, keeping retries, approval, receipts, and reconciliation attached to one consequence instead of one transport attempt.

N17Q generated a fresh idempotency key every time it called a tool.

The implementation looked disciplined: unique identifiers, logged attempts, no accidental key reuse. It also made the key useless. When a response disappeared and the agent retried, the second attempt carried a new identity and the simulated service created a second request.

An idempotency key should identify the consequence the user intended, not the network attempt used to pursue it.

One semantic effect needed one stable key across retries, process restarts, model turns, and provider sessions.

Attempt identity answered the wrong question

An execution attempt needed a unique ID for tracing. It answered which adapter invocation started at which time and produced which observation.

The external service needed a different identity. It had to recognize that attempt two sought the same request creation as attempt one.

Using one ID for both either collapsed diagnostic history or destroyed deduplication. N17Q separated run, tool request, effect intent, execution attempt, and provider effect reference.

Several attempts could pursue one intent. One successful intent could produce one external reference. Unknown attempts could remain linked without inventing their outcome.

Identity followed meaning at each layer.

The key was assigned before execution

N17Q created the effect intent after normalization, policy, and any required approval, before contacting the adapter. The intent stored stable ID, capability revision, normalized consequence digest, target world preconditions, requester, run, and creation time.

The external idempotency key derived from that durable intent identity and destination namespace. It did not depend on a model message ID, worker process, timestamp, or random value generated inside the retry loop.

If the process stopped after persisting the intent and before sending, another worker resumed with the same key.

An unrecorded external call was prohibited. Durable identity came first.

Normalized consequence defined sameness

Raw arguments could differ without changing meaning. A destination alias and canonical destination might refer to the same resource. Whitespace or field ordering should not create a second effect.

The product adapter normalized paths, identifiers, defaults, content, and options into a canonical consequence. A versioned serializer produced the digest bound to the intent.

Meaning-bearing changes produced a different digest. Reusing the same intent key with changed normalized arguments failed before adapter invocation and, where supported, at the provider.

The definition of sameness belonged to the product capability, not arbitrary byte equality at the transport layer.

Some providers scoped idempotency keys per account or endpoint; others offered no explicit guarantee. N17Q prefixed or mapped its intent identity according to the reviewed adapter contract.

The local registry stored connection, credential scope, tool mapping, and provider retention assumptions. Reusing an intent against another destination or connection was not treated as the same safe retry automatically.

A fallback created a recovery decision. If the first provider outcome was unknown, switching providers could duplicate the external consequence even with a familiar local key.

One key per consequence did not mean one string worked universally.

Approval bound the intent, not an attempt

The reviewer approved exact normalized consequence, target state, policy digest, recovery semantics, expiry, and effect intent. The approval receipt was consumed when the intent became executable.

A transport retry under that same intent did not ask the reviewer to approve identical bytes again, provided current policy and preconditions still allowed recovery. A changed argument or new semantic intent required new approval.

This avoided two bad extremes: approval floating over multiple effects and repeated prompts for one interrupted effect.

Human consent followed the consequence the key represented.

A parameter named idempotency_key was evidence of an interface, not proof of behavior. Adapter fixtures sent duplicates concurrently and sequentially, changed arguments, delayed responses, and retried after simulated process restarts.

The contract recorded retention window, scope, duplicate response behavior, conflict semantics, and whether the provider returned the original resource identity. If evidence was weak, N17Q treated support conservatively.

For synthetic services, the harness controlled exact behavior. For external integrations, it depended on published and observed guarantees without claiming more.

An idempotency field became useful only with a behavioral contract around it.

N17Q stored a uniqueness constraint on effect intent identity and normalized digest. This prevented two workers from intentionally starting separate local intents for the same approved command.

It could not prevent a remote duplicate if the first request crossed the boundary and local state was lost before recording the result. Provider idempotency or an authoritative query path still mattered.

Conversely, provider deduplication did not prevent N17Q from confusing two different user intentions under one key. Local validation protected meaning.

Reliable behavior came from both boundaries aligning on identity.

Concurrent retries tested the real guarantee

A network retry and a delayed worker could overlap. Serial happy-path tests would never expose the race.

The fixture paused the first attempt after receipt, started a second with the same key, and then released both. The simulated service created one resource and returned the same reference or an in-progress state according to its contract.

N17Q recorded two attempts linked to one intent and reconciled one effect. Budget accounting charged attempts separately and consequence count once.

The user saw one pending action, not two competing success toasts.

Idempotency had to survive concurrency, not only repetition after completion.

In the duplicate-request scenario, the service committed the effect and dropped the response. The attempt moved to outcome unknown while the intent remained active.

The orchestrator queried by idempotency key or provider reference where possible. A found resource produced an effect receipt and completed the intent. A not-yet-visible result stayed unresolved until the contract's observation window passed.

Only after authoritative evidence of non-execution could another attempt proceed where necessary. That attempt used the same key.

The key connected uncertainty to the resource that might already exist.

An eventually consistent query could return not found moments after successful creation. Treating that as permission to retry recreated the race under a different API.

The tool contract described visibility delay and maximum reconciliation window. N17Q scheduled later checks within cumulative budget and showed next eligible time. It avoided hot polling.

If the window expired without evidence, policy moved to manual review or an explicitly accepted recovery path. It did not quietly convert absence of observation into proof.

Idempotency reduced the cost of a repeated attempt, but the system still represented what it knew.

Expiry constrained delayed retry

Providers might retain idempotency records for a bounded period. A run resumed after that period could send the same string and create another effect.

N17Q stored the known retention window and first-send time. When safe deduplication might have expired, policy required status evidence, destination inspection, or new human review. It did not display Retry as routine.

The local intent remained the same historically. The remote guarantee around its key had weakened.

Time was part of idempotency semantics, not merely a cleanup concern.

Key reuse with changed arguments failed loudly

An agent might revise the title or destination after a timeout and attempt to reuse the existing key. Some providers returned the first result; others rejected mismatch; a poorly designed service might create confusing state.

N17Q compared normalized consequence digest before adapter invocation. Meaningful change created a new proposed intent and left the old one unresolved. Approval could not transfer automatically.

The interface showed both: original outcome unknown, replacement not yet authorized. It did not pretend editing the arguments modified an in-flight external request.

Identity immutability protected the historical question the key was meant to answer.

“Publish this package” might upload an artifact, update an index, and notify a channel. Assigning one key to the whole phrase could hide partial completion and unsafe retries.

N17Q modelled the command as a workflow with separate effect intents for independently observable consequences. A parent intent connected them and defined ordering and completion rules.

If upload succeeded and notification failed, recovery retried only notification under its own key. Compensation for the upload remained a separate action.

One key per consequence sometimes meant several keys per user goal.

One consequence could need several transport calls

Large artifact delivery might use create session, upload chunks, and finalize. Those calls served one external artifact but had their own retry scopes.

The adapter contract defined a parent effect identity and child operation identities where the provider required them. N17Q did not expose this machinery as several independent tools to the model unless the product needed that control.

The final receipt named artifact digest and destination resource. Interrupted chunk upload could resume without authorizing a second artifact.

The right identity granularity followed independently duplicable state.

A tool accepting ten requests in one call could partially succeed. One batch-level key was insufficient if retrying the batch recreated completed items.

N17Q assigned each semantic item an effect identity and gave the batch an attempt identity. The adapter used provider item keys where supported and returned per-item receipts or uncertainty.

Policy allowed retry only for unresolved items under their original identities. The review view showed the exact bounded set.

Batching improved transport efficiency without collapsing consequence accounting.

Read operations sometimes needed identity too

Pure reads did not create duplicate resources, but stable request identity still helped trace caching, rate limits, cost, and replay fixture selection.

I avoided calling every read idempotent as if the term guaranteed stable content. Two reads under one key could observe different world revisions unless the tool contract pinned a snapshot.

N17Q used observation request identities for reads and effect intent identities for mutations. The distinction made metrics and replay clearer.

The pattern was broader than writes, but consequence remained the reason for stronger guarantees.

Deleting or canceling an earlier effect was not reuse of its creation key. Compensation caused another consequence and could fail independently.

The compensating intent linked to the original effect receipt and described its limitations. It received new approval, idempotency identity, attempts, and receipt. Repeating compensation used that new key.

The original resource remained part of history even if its current state became canceled. Third-party observation could not be undone.

Distinct identity prevented rollback language from erasing the second operation.

replay runs never transmitted historical keys

A replay trace contained effect identities and provider references. Sending those to a live service could query or mutate real historical resources.

Replay mode replaced adapters with deterministic fixtures in a separate simulated world namespace. It used replay-local derived identities while preserving links to the original semantic intent for comparison.

Missing fixtures failed closed. A mode assertion prevented live credentials and network access.

The idempotency record enabled simulation; it never became permission to repeat history.

Some providers treated idempotency values as harmless, while others allowed lookup or carried correlation across systems. N17Q did not display full keys in normal traces or error messages.

The run stored a protected mapping and safe short reference. Approval and UI used product intent identity. Diagnostic access followed retention and authorization.

Keys were not credentials, but minimizing exposure reduced accidental reuse and cross-environment confusion.

Observability preserved identity without scattering the transport token.

I considered hashing the normalized arguments directly into the external key. That made identical consequences converge and made keys predictable across workspaces. It also risked leaking a low-entropy argument through enumeration and confused deliberate repeated intentions with retries.

N17Q instead created a random durable intent identity and bound the normalized consequence digest in protected state. Adapter derivation used the intent, connection namespace, and a versioned keyed transform where the provider needed a string.

Two separately authorized requests for the same content received different intents. Retries of one intent received the same external key. The database, not guesswork from arguments, decided which case applied.

Manual retry stayed inside the same intent

When a reviewer chose Try again after a recoverable transport failure, the UI did not create a new tool request behind the button. It asked the orchestrator to make another attempt for the existing effect intent.

Policy rechecked current authority, provider retention window, unresolved evidence, and attempt budget. If the consequence or destination had changed, the button became Prepare new action instead.

This made manual intervention subject to the same identity rules as automatic recovery. A human click did not bypass deduplication, and a safe retry did not require pretending the original intention had failed.

Even a well-derived key could collide with a provider record retained from another environment if namespaces were misconfigured. Fixtures seeded conflicting keys and verified that argument mismatch produced a hard reconciliation failure.

Receipts compared provider reference and normalized consequence. An unexpected preexisting resource never became success merely because the provider returned it for the key.

The registry recorded key-derivation revision so rotations or namespace fixes did not reinterpret historical attempts. Prevention came first; detection kept a configuration mistake from being celebrated as idempotency.

Development, replay, staging-like synthetic worlds, and any future live connection used distinct namespaces and credentials. The derived external key included a safe environment scope or adapter mapping to prevent collision.

Copying a run database into a test environment could not make a worker contact a live provider with historical keys. Execution mode and connection eligibility were enforced outside run data.

The trace still compared semantic intents across environments through separate identities.

Idempotency should prevent duplicates within the intended boundary, not create a bridge between environments.

Receipts completed the identity chain

A successful effect receipt linked intent, attempts, normalized consequence digest, provider reference, observed state, time, and supporting response or query evidence.

Repeated attempts returned or reconciled to the same receipt. If observations disagreed, N17Q appended reconciliation events instead of choosing the latest silently.

The final answer referenced the receipt when claiming completion. Evaluators compared it with simulated world state.

The key prevented duplicate intention from becoming duplicate consequence; the receipt established the best known outcome.

Retries consume time and service capacity even when idempotency prevents extra resources. N17Q charged every adapter attempt to call and compute budgets while counting one semantic external effect.

A loop repeatedly receiving the original response could still exhaust its run. A policy denial before invocation charged planning attention but not an external attempt.

This prevented idempotency from becoming permission to retry without limit.

Resource safety and operational efficiency were related and distinct measures.

The interface used the consequence language

Users saw “Checking whether the request already exists” rather than “Retrying call 2.” The recovery view named one intended request, its attempts, current evidence, and safe next action.

After successful reconciliation, the page showed one external reference and preserved the interrupted attempt in history. Unknown outcome did not display a red failed item beside a second green duplicate.

Approval pages explained whether the destination honored stable request identity and how long that protection lasted.

Good identity improved the interface because the product could finally say what one thing the person was waiting for.

The duplicate fixture became a contract test

Every consequential adapter faced the same case: commit effect, lose response, restart worker, reconcile, and attempt recovery. The simulated world asserted exactly one resource.

Adapters without idempotency or query support could still exist with stricter policy. They could require synchronous human observation or prohibit automatic retry after uncertainty. Their limitation remained visible.

The test did not demand a feature the provider lacked. It demanded that N17Q never pretend the missing feature existed.

Safe degradation was part of adapter quality.

One key carried one promise

The corrected design generated fewer keys and attached far more meaning to each one.

An effect intent existed durably before execution. Its normalized consequence could not change. Approval bound it. Every recovery attempt reused its external identity within the provider's proven scope and retention. Receipts and world observations reconciled the outcome. New consequences received new intents.

This did not produce exactly-once delivery as a magical property. Networks still failed, providers differed, queries lagged, and uncertainty sometimes required a person.

It produced a defensible promise: N17Q would not knowingly turn one authorized consequence into two merely because the path to acknowledgement was unreliable.

One idempotency key per attempt had looked orderly. One key per consequence made the system coherent.