Skip to content

Extract _RetryPolicy decision module (+ agent-skills config)#76

Merged
lesnik512 merged 7 commits into
mainfrom
chore/setup-agent-skills-config
Jun 23, 2026
Merged

Extract _RetryPolicy decision module (+ agent-skills config)#76
lesnik512 merged 7 commits into
mainfrom
chore/setup-agent-skills-config

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Two independent pieces on one branch.

1. _RetryPolicy extraction (main work)

Deepening from the architecture review: AsyncRetry.__call__ and Retry.__call__ hand-copied ~110 lines of retry decision logic, differing only in await. This pulls that logic into a stateless private _RetryPolicy in the same module — mirroring the _CircuitBreakerState precedent — so the decision lives once and both wrappers shrink to a thin loop.

  • Seam: decide(*, attempt, request, exc) -> float returns the sleep delay, or raises the terminal exception (note + event + __cause__ already set), called inside the wrapper's except so chaining is free.
  • Wrappers: deposit → for attempt → try/next → decide → sleep; sole sync/async diff is await.
  • Contract preserved: __init__ signatures unchanged; .budget identity preserved; the six config attributes moved onto the policy (read nowhere external).
  • Tests: all existing MockTransport suites stay green (byte-identical behaviour); new tests/test_retry_policy.py drives decide directly across the decision matrix.
  • Promoted into architecture/resilience.md. Design bundle: planning/changes/2026-06-23.01-retry-policy-extraction/.

2. Agent-skills config (incidental)

Scaffolds planning/agents/{issue-tracker,triage-labels,domain}.md + an ## Agent skills block in CLAUDE.md (GitHub Issues, canonical triage labels, single-context domain docs).

Verification

  • just lint clean (ruff format/check + ty)
  • just test → 718 passed, 100% coverage
  • grep -rE 'httpx2\._' src/httpware/ clean

🤖 Generated with Claude Code

lesnik512 and others added 7 commits June 23, 2026 12:40
Scaffold the per-repo config the engineering skills expect:
- issue tracker = GitHub Issues (gh CLI), external PRs not a triage surface
- triage labels = canonical defaults (wontfix already exists)
- domain docs = single-context, CONTEXT.md at root + ADRs under planning/adr

Internal docs live under planning/, not the user-facing docs/ site.
Adds an ## Agent skills block to CLAUDE.md pointing at the three files.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Full-lane design.md + plan.md for extracting a stateless _RetryPolicy
decision module from the duplicated AsyncRetry/Retry __call__ loops,
mirroring the _CircuitBreakerState precedent. Design only — no source
changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the ~110 lines of retry decision logic duplicated across
AsyncRetry.__call__ and Retry.__call__ into a stateless _RetryPolicy,
mirroring the _CircuitBreakerState precedent. Both wrappers shrink to a
thin loop (deposit -> try/next -> decide -> sleep) differing only in
await/blocking. Behaviour byte-identical; public __init__ unchanged;
.budget preserved, six config attributes moved onto the policy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Direct decision-matrix tests for the new policy module — no client, no
MockTransport: retryable->delay (bounds), non-retryable/non-eligible
re-raise, streaming refusal, exhaustion note, Retry-After exact/exceeds,
budget refusal with __cause__, and moved max_attempts validation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document the shared stateless _RetryPolicy + thin-wrapper structure in
architecture/resilience.md. Includes lint cleanups surfaced by just lint:
drop a redundant PLR0912 noqa on decide, fix a docstring mood + magic
value in the new seam tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Set status: shipped, pr: 76, and outcome on the change bundle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the leftover 'Label in mattpocock/skills' seed-template header; the
column is the canonical role name, mapped to our tracker's label.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit 4744f11 into main Jun 23, 2026
5 checks passed
@lesnik512 lesnik512 deleted the chore/setup-agent-skills-config branch June 23, 2026 11:29
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.

1 participant