feat(tools): add tool reliability layer - CircuitBreaker, IdempotencyGuard, RetryPolicy#132
Merged
dgarson merged 1 commit intofeat/horizon-ui-completefrom Feb 24, 2026
Conversation
Owner
Author
|
Tim this needs to be rebased on |
Owner
Author
d793b78 to
ce7a2b6
Compare
dgarson
commented
Feb 24, 2026
Owner
Author
dgarson
left a comment
There was a problem hiding this comment.
Summary
This PR introduces a useful reliability foundation:
- with pending/completed/failed states
- with exponential backoff + jitter
- log fixes in /
- unit tests for idempotency + retry behavior
The direction is strong and the primitives are generally clean and readable.
Concerns found
-
Scope contamination in this PR
- is unrelated to tool reliability.
- This makes the PR harder to reason about and review.
-
Architectural split/duplication risk
- Reliability logic is now spread across and primitives.
- There is no clear integration point yet (who is source of truth, and which layer should be used by tools).
-
Test coverage gaps
- Missing tests for failed-entry TTL expiry/re-execution in idempotency store.
- Missing tests for jitter bounds and max-delay clamping behavior in retry policy.
- No tests for state transitions in this PR.
Suggestions
- Split out the topology spec file into its own PR.
- Add/clarify a single integration layer that all tool calls use (to avoid parallel implementations).
- Extend tests for failure/expiry and boundary cases.
Blocking issues before merge
- Remove unrelated topology spec file from this PR (or move to separate PR).
- Clarify integration ownership between and new utils before rollout.
dgarson
commented
Feb 24, 2026
Owner
Author
dgarson
left a comment
There was a problem hiding this comment.
Summary
This PR introduces a useful reliability foundation:
InMemoryIdempotencyStorewith pending/completed/failed statesRetryPolicywith exponential backoff + jitter- log fixes in
CircuitBreaker/IdempotencyGuard - unit tests for idempotency + retry behavior
The direction is strong and the primitives are generally clean and readable.
Concerns found
-
Scope contamination in this PR
apps/web/ux-opus-design/AGENT-TOPOLOGY-SPEC.mdis unrelated to tool reliability.- This makes the PR harder to reason about and review.
-
Architectural split/duplication risk
- Reliability logic is now spread across
src/agents/tool-reliability.tsandsrc/utils/*primitives. - There is no clear integration point yet (who is source of truth, and which layer should be used by tools).
- Reliability logic is now spread across
-
Test coverage gaps
- Missing tests for failed-entry TTL expiry/re-execution in idempotency store.
- Missing tests for jitter bounds and max-delay clamping behavior in retry policy.
- No tests for
CircuitBreakerstate transitions in this PR.
Suggestions
- Split out the topology spec file into its own PR.
- Add/clarify a single integration layer that all tool calls use (to avoid parallel implementations).
- Extend tests for failure/expiry and boundary cases.
Blocking issues before merge
- Remove unrelated topology spec file from this PR (or move to separate PR).
- Clarify integration ownership between
src/agents/tool-reliability.tsand new utils before rollout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a tool reliability layer with three primitives:
Changes
src/utils/circuit-breaker.ts- Standalone circuit breaker primitivesrc/utils/idempotency.ts- In-memory idempotency store with TTLsrc/utils/retry-policy.ts- Retry policy with exponential backoffsrc/agents/tool-reliability.ts- Agent-level wrappers for tool reliabilityRelated