[maui-labs docs] Document AgentClient transient retry properties (PR #287)
- Dominant language
- No language data
- Stars
- 282
- Forks
- 265
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
## Source PR
**PR**: https://github.com/dotnet/maui-labs/pull/287
**Title**: Harden Android DevFlow integration tests
**Author**: @Redth (Jonathan Dick)
**Merged**: 2026-05-20
---
## Summary of Changes
PR #287 adds three new public properties to `AgentClient` (the `Microsoft.Maui.DevFlow.Driver` NuGet package) that allow callers to configure opt-in transient transport retry behavior. This is particularly relevant on Android, where ADB port forwards can drop intermittently during automated testing.
The new properties control:
1. **`TransientFailureRetryCount`** (`int`, default `0`) — number of additional retry attempts on transient transport errors (e.g. `SocketException`, `IOException`, non-timeout `TaskCanceledException`). Defaults to `0`, preserving the existing fail-fast behavior.
2. **`RetryMutatingRequests`** (`bool`, default `true`) — whether retries apply to mutating HTTP methods (POST, PUT, DELETE). Setting this to `false` when `TransientFailureRetryCount > 0` limits retries to idempotent GET requests only, avoiding potential duplicate side effects (double-tap, double-navigate, etc.).
3. **`TransientFailureRetryDelay`** (`TimeSpan`, default `250 ms`) — base delay between retry attempts.
---
## Documentation Pages Affected
- **Driver / AgentClient API reference**: `docs/developer-tools/devflow/agent-client.md` (or wherever `AgentClient` properties are documented)
- **DevFlow overview / getting started**: `docs/developer-tools/devflow/` — any page that describes Android setup or reliability considerations
---
## Suggested Changes
### Add a "Transient retry configuration" section to the AgentClient reference page
Insert after the existing connection/constructor docs and before (or as part of) any "advanced configuration" section:
````markdown
## Transient retry configuration
On unstable transports such as Android ADB port forwards, `AgentClient` can optionally retry requests that fail with transient transport errors (`SocketException`, `IOException`, or a non-timeout `TaskCanceledException`).
| Property | Type | Default | Description |
|---|---|---|---|
| `TransientFailureRetryCount` | `int` | `0` | Number of additional attempts after a transient failure. `0` keeps the default fail-fast behavior. |
| `RetryMutatingRequests` | `bool` | `true` | Whether retries apply to mutating HTTP methods (POST/PUT/DELETE). Set to `false` to restrict retries to idempotent GET requests and avoid duplicate side effects. |
| `TransientFailureRetryDelay` | `TimeSpan` | `250 ms` | Base delay between retry attempts. |
> **Warning**
> Retrying mutating requests can produce duplicate side effects if a response is lost in flight — for example, a tap may fire twice or a Shell navigation may push the same route twice. Production callers that do not accept this risk should set `RetryMutatingRequests = false` when enabling retries.
### Example — enabling retries for Android integration tests
```csharp
var client = new AgentClient(agentPort)
{
TransientFailureRetryCount = 3,
RetryMutatingRequests = false, // only retry idempotent GETs
TransientFailureRetryDelay = TimeSpan.FromMilliseconds(500)
};
```
````
### Placement note
- If `AgentClient` properties are listed in a table on the DevFlow driver/API page, add the three new rows to that table.
- If there is an "Android-specific considerations" section in the DevFlow docs, cross-reference the retry properties there as a recommendation for flaky ADB environments.
> Generated by [PR Documentation Check](https://github.com/dotnet/maui-labs/actions/runs/26182288148) for issue #287 · [◷](https://github.com/search?q=repo%3Adotnet%2Fdocs-maui+is%3Aissue+%22gh-aw-workflow-call-id%3A+dotnet%2Fmaui-labs%2Fpr-docs-check%22&type=issues)
Contributor guide
Assessment
This issue has not been assessed yet.