nshkrdotcom / nshkrdotcom/codex_sdk
Avoid default retries for ambiguous MCP tool outcomes
Nobody has claimed this yet.
- Dominant language
- Elixir
- Stars
- 27
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
Codex.MCP.Client.call_tool/4 currently defaults to three retries for every tools/call failure. That can replay a non-idempotent mutation when the server completed the write but the response was lost.
Current path:
request/4sendstools/call.- The destination commits a write.
- The response times out or the transport closes.
retry_or_error/8invokes the same tool again becausemcp_default_retries()is3.
This is an ambiguous-success boundary, not a confirmed failure. Backoff does not make the replay safe.
Proposed minimal change:
- Make automatic
tools/callretries opt-in rather than the default, or require a caller-provided retry-safety predicate. - Keep explicit retries available for read-only or provider-idempotent tools.
- Document that transport errors after request transmission may mean the external effect is uncertain.
- Add a deterministic regression fixture whose first call commits a synthetic mutation and drops the response; the default path must leave the mutation count at one.
A later enhancement could use MCP readOnlyHint / idempotentHint as advisory input, but unknown or missing annotations should remain conservative. These hints cannot provide exactly-once behavior by themselves.
Reference contract and fixture semantics: https://github.com/artiehinz/Agent-Enhancer-Utilities/blob/main/docs/RELIABILITY_SIDECAR_CONTRACT_V1.md
I can prepare the focused patch and test if this direction matches the project's compatibility policy.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Codex.MCP.Client.call_tool/4, then trace request/4, retry_or_error/8, and mcp_default_retries(). Review docs/RELIABILITY_SIDECAR_CONTRACT_V1.md for the stated reliability semantics. Add the deterministic fixture described in the issue and verify that a dropped first response leaves the synthetic mutation count at one while explicit safe retries remain available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100