Agents: unify tool reliability primitives and add boundary coverage#171
Conversation
ff4449a
into
stephan/tool-reliability-layer
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9437a4d71d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| this.store = new InMemoryIdempotencyStore({ | ||
| pendingTtlMs: config.ttlMs, | ||
| completedTtlMs: config.ttlMs, | ||
| failedTtlMs: config.ttlMs, |
There was a problem hiding this comment.
Avoid caching failed idempotent executions by default
Setting failedTtlMs to ttlMs changes IdempotencyGuard semantics from “cache successes only” to “cache errors too”, so a transient failure on a key now blocks all retries with that key until TTL expiry instead of re-running the action immediately. In the agent/tool-call path this can turn short-lived backend glitches into deterministic repeated failures for the entire TTL window, which is a functional regression from the previous implementation.
Useful? React with 👍 / 👎.
Motivation
Description
src/agents/tool-reliability.tsthrough the shared utilities insrc/utilsby usingsrc/utils/circuit-breaker.tsandsrc/utils/idempotency.ts, turning the agent module into a thin adapter that adds logging and naming ergonomics.src/utils/idempotency.test.tsto verify failed-entry TTL expiry and successful re-execution after expiry.src/utils/retry-policy.test.tsto assert jitter bounds and exponential clamping tomaxDelayMs.src/utils/circuit-breaker.test.tsto exercise CLOSED→OPEN behavior, OPEN cooldown recovery, and HALF_OPEN failure reopening.apps/web/ux-opus-design/AGENT-TOPOLOGY-SPEC.mdfrom this PR to keep scope focused.Testing
pnpm vitest run src/utils/idempotency.test.ts src/utils/retry-policy.test.ts src/utils/circuit-breaker.test.ts src/agents/tool-reliability.test.tsand all tests passed (4 files, 11 tests).pnpm check; it reported a formatting issue insrc/gateway/hitl-request-store.tsthat is pre-existing and outside this change set (format checks otherwise pass for files touched by this PR).Codex Task