Skip to content

feat(provider): retry config overrides, overloaded delay, tool sequen… - #48

Merged
Mowri Mohan (mowree) merged 1 commit into
microsoft:mainfrom
HDMowri:main
Apr 14, 2026
Merged

feat(provider): retry config overrides, overloaded delay, tool sequen…#48
Mowri Mohan (mowree) merged 1 commit into
microsoft:mainfrom
HDMowri:main

Conversation

@mowree

Copy link
Copy Markdown
Collaborator

…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

…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                                  |
@mowree
Mowri Mohan (mowree) merged commit 1214669 into microsoft:main Apr 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants