Learning outcome
Diagnose a failed request without hiding it behind a fake result.
Explicit setup, validation failure and retry paths.
A missing endpoint blocks Send and presents connection setup. A failed discovery request, rejected model output or unavailable agent becomes an error with Retry. Retry uses the remembered request but a fresh surface ID; it does not fetch an old template. A renderer error removes the visible failed surface and presents an error. The sample does not automatically send renderer errors back to Gemini for self-correction.
Retry uses a new response identity
fun retry() {
if (!state.value.busy)
lastRequest?.let {
submit(it.copy(surfaceId = UUID.randomUUID().toString()))
}
}
Inspect shows inbound A2UI messages and outbound events. It is useful for tracing a click to its surface and event ID. It is not a provider billing dashboard, persistent log or proof of token streaming. Avoid publishing traces that contain personal prompts. The server does not log request bodies, but requests are still sent to the configured endpoint and Gemini.
Failure drill
| Trigger | Expected evidence | Interpretation |
|---|---|---|
| Server stopped | Error, no replacement event, Retry available | Network path failed |
| Unset server key then restart | Server configuration error | Renderer does not supply inference |
| Unavailable model name | Model access/quota error | Health presence check is insufficient |
| Cycle in test response | Validator rejects graph | Do not render partial arbitrary content |
| New conversation while request runs | Old result does not populate new conversation | Generation epoch protects ownership |
Use local environment changes and deterministic test fixtures for failure drills; do not corrupt a shared service. Restore the valid model/key after a drill. A slow blocking request may consume provider resources after UI reset. Backend authentication, per-user limits, bounded provider response streaming and operational metrics require further production work.
Practice and checkpoint
Run two failure drills and one recovery on your own debug build. Record the exact error and whether the composer becomes usable. Distinguish a repository failure test from a live provider failure: they exercise different boundaries and should be reported separately.
Source and next steps
- Pinned implementation — The exact app and server revision used by this lesson.
Back to roadmap · Practice this unit in the codelab