Repository navigation
arch(ws-2): strategy traits beta - batch, gate, recovery - #3552
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the strategy trait contracts for the agent loop, defining the core interfaces and data structures for batch policy, gate handling, and error recovery. The implementation includes comprehensive serialization tests for all new enums and structs. Review feedback suggests consolidating 5xx-like error variants in the CapabilityErrorClass and ModelErrorClass enums to simplify retry logic and ensure consistent recovery semantics. Additionally, it is recommended to replace std::time::Duration with a primitive u64 for backoff delays to improve the stability and compatibility of the serialized wire format for non-Rust consumers.
| pub enum CapabilityErrorClass { | ||
| Transient, | ||
| Permanent, | ||
| InputInvalid, | ||
| PolicyDenied, | ||
| Unavailable, | ||
| Internal, | ||
| } |
There was a problem hiding this comment.
The CapabilityErrorClass enum splits 5xx-like errors into Transient, Unavailable, and Internal. According to the general rules, all HTTP 5xx errors should be grouped into a single variant (e.g., Unavailable) because they share the same recovery semantics (retry with backoff). This simplifies the retry logic and ensures consistency across the system. Specific error details can still be preserved in the safe_summary or via the diagnostic_ref for debugging.
| pub enum CapabilityErrorClass { | |
| Transient, | |
| Permanent, | |
| InputInvalid, | |
| PolicyDenied, | |
| Unavailable, | |
| Internal, | |
| } | |
| pub enum CapabilityErrorClass { | |
| /// Transient or 5xx-class error (BadGateway, ServiceUnavailable, etc). | |
| /// Shared recovery semantics: retry with backoff. | |
| Unavailable, | |
| Permanent, | |
| InputInvalid, | |
| PolicyDenied, | |
| } |
References
- Group all HTTP 5xx errors into a single 'BadGateway' or 'temporarily unavailable' error variant to maintain consistent recovery semantics.
| pub enum ModelErrorClass { | ||
| Transient, | ||
| ContextOverflow, | ||
| ContentFiltered, | ||
| Unavailable, | ||
| Internal, | ||
| } |
There was a problem hiding this comment.
Similar to CapabilityErrorClass, the ModelErrorClass enum should group 5xx-like errors (Transient, Unavailable, Internal) into a single variant to align with the general rule regarding HTTP 5xx error handling and recovery semantics.
pub enum ModelErrorClass {
/// Transient or 5xx-class error. Shared recovery semantics: retry with backoff.
Unavailable,
ContextOverflow,
ContentFiltered,
}References
- Group all HTTP 5xx errors into a single 'BadGateway' or 'temporarily unavailable' error variant to maintain consistent recovery semantics.
SummaryReviewed WS2 PR #3552 only. PR adds crate-internal strategy traits beta: batch, gate, recovery. Merge stance for reviewed scope: no blocking security/correctness findings. Tests run:
Findings
Security/data-flow notes
Correctness/invariant notes
Missing tests
Suggested fixes
|
Security/correctness review: PR #3552Reviewed current PR stack state for #3552 ( v2 impact verdict: Clean in reviewed scope. Internal trait-contract landing only. No direct behavior change or durable side-effect path added in changed files. FindingsNo actionable security/correctness findings in requested scope. Checked categories
Validation run
|
Review notes — WS2 strategy traits βTwo items worth resolving. Tests reference
|
|
Addressed the WS2 review notes across 9ebcd03, 62c7038, and a57ae7e. Highlights: retry scope is now encoded with |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
* arch: ws-2 — strategy traits β (batch, gate, recovery) (iter 1, approved) * arch(ws-2): align beta strategies with skeleton spec * fix(ws-2): address review feedback * fix(ws-2): encode retry contracts * fix(ws-2): validate strategy safe summaries * docs(ws-2): align strategy contract docs
Context
Second strategy-trait slice. It covers decisions around capability batch execution, gate handling, and error recovery while still leaving concrete execution to the canonical executor and host ports.
Master spec:
docs/reborn/agent-loop-skeleton.mdWorkstream brief:
docs/reborn/agent-loop-briefs/strategy-traits-beta.mdStack base:
arch/ws-0Latest stack maintenance on 2026-05-14:
origin/reborn-integrationthrough WS17 before publishing the PR descriptions.What landed
BatchPolicyStrategyplus sequential/parallel batch-policy values derived from the capability view.GateHandlingStrategyand gate outcomes that let the executor block, skip, or abort through the normalLoopExitpath.RecoveryStrategyand recovery outcomes for transient model/capability failures.Reviewer focus
ConcurrencyHintand visible descriptor metadata, not raw lower-layer capability internals.Non-goals / deferred work
Validation
arch/level1-mergedvalidation:cargo check -p ironclaw_agent_loop -p ironclaw_reborn.Stack position