feat(provider): retry config overrides, overloaded delay, tool sequen… - #48
Merged
Conversation
…ce repair, raw flag rename
Implements four features addressing gaps in the Anthropic gold standard alignment audit.
### Changes
**Retry configuration overrides** (behaviors:Retry:MUST:7)
Provider config: block now accepts max_retries, min_retry_delay (seconds),
max_retry_delay (seconds), retry_jitter, and overloaded_delay_multiplier.
All keys are optional; absent keys fall back to _policy.py defaults.
**Overloaded error delay multiplier** (behaviors:Retry:MUST:8)
RetryPolicy gains overloaded_delay_multiplier (float >= 1.0, default 10.0).
RateLimitError is flagged overloaded: true in errors.yaml. retry_after
supersedes the multiplier when present. _OVERLOADED_SENTINEL removed from
__all__ -- private symbols do not belong in the public API surface.
**Tool sequence repair** (provider-protocol:complete:MUST:9)
convert_chat_request() detects orphaned tool calls and inserts synthetic
tool_result messages before prompt extraction. One WARNING logged per repair.
Original message list is never mutated. Role-marker injection via crafted
tool_call_id values is escaped before prompt insertion.
**Raw flag rename** (observability:Verbosity:MUST:1)
ObservabilityConfig.raw_payloads renamed to raw. Emitted event payload key
collapsed from raw_request/raw_response to raw. Zero overhead on the hot
path via dataclasses.replace() only on the non-default branch.
BREAKING: ObservabilityConfig.raw_payloads attribute removed -- any
direct access raises AttributeError. Enable via provider config: {raw: true}.
MIGRATION.md updated with the breaking change and all new additive config keys.
Type stub updated: LLMError.delay_multiplier: float added to llm_errors.pyi.
### Quality
| Check | Result |
|-----------------------------------------|-------------------------------------------|
| gate.py | 6/6 PASS |
| Windows pytest (Python 3.13) | 1219 passed, 2 xfailed -- 98% branch cov |
| WSL pytest (Python 3.14, amplifier env) | 1219 passed, 2 xfailed -- 98% branch cov |
| verify_p0_features.py --live (T1+T2) | 21/21 PASS |
| amplifier run (real CLI, mowree) | 2/2 PASS -- claude-opus-4.5 |
| ruff check | 0 errors |
| pyright | 0 errors |
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.
…ce repair, raw flag rename
Implements four features addressing gaps in the Anthropic gold standard alignment audit.
Changes
Retry configuration overrides (behaviors:Retry:MUST:7) Provider config: block now accepts max_retries, min_retry_delay (seconds), max_retry_delay (seconds), retry_jitter, and overloaded_delay_multiplier. All keys are optional; absent keys fall back to _policy.py defaults.
Overloaded error delay multiplier (behaviors:Retry:MUST:8) RetryPolicy gains overloaded_delay_multiplier (float >= 1.0, default 10.0). RateLimitError is flagged overloaded: true in errors.yaml. retry_after supersedes the multiplier when present. _OVERLOADED_SENTINEL removed from all -- private symbols do not belong in the public API surface.
Tool sequence repair (provider-protocol:complete:MUST:9) convert_chat_request() detects orphaned tool calls and inserts synthetic tool_result messages before prompt extraction. One WARNING logged per repair. Original message list is never mutated. Role-marker injection via crafted tool_call_id values is escaped before prompt insertion.
Raw flag rename (observability:Verbosity:MUST:1) ObservabilityConfig.raw_payloads renamed to raw. Emitted event payload key collapsed from raw_request/raw_response to raw. Zero overhead on the hot path via dataclasses.replace() only on the non-default branch.
BREAKING: ObservabilityConfig.raw_payloads attribute removed -- any
direct access raises AttributeError. Enable via provider config: {raw: true}.
MIGRATION.md updated with the breaking change and all new additive config keys. Type stub updated: LLMError.delay_multiplier: float added to llm_errors.pyi.
Quality