Model request stops making progress
Use Agent phase logs to distinguish input assembly, model stream waits, and output processing
When a tool appears to remain active, inspect the Agent phase logs. Generating tool arguments through the model stream and executing the tool are separate stages.
Locate the wait
The Session executor records these boundaries:
| Log | Meaning |
|---|---|
[agent] step.input_start | Committing pending input and assembling the step |
[agent] step.input_ready | Input is ready; includes model ID, context window, message count, and tool count |
[agent] model_request.request_start | Starting one model invocation |
[agent] model_request.stream_open | The model client returned an event stream |
[agent] model_request.first_event | First event consumed; this may only be model_start, not generated content |
[agent] model_request.waiting | Current stage and latest event, recorded every 30 seconds while the call remains active |
[agent] model_request.stream_end | Stream closed and protocol validation passed; tools may still be executing |
[agent] model_request.request_failed | Invocation or event handling failed; consult failure logs for the cause |
[agent] step.finish | Model step and its tools finished |
Filter by session_id and turn_id, then use invocation_id to identify each model call. attempt counts attempts within the same step.
In waiting records, stage distinguishes opening (waiting for the model client to return a stream), reading (waiting for the next event), and accepting (processing an event and its output callback). last_event_type, last_event_at, and event_count show whether events are still arriving. Records do not include message bodies or tool arguments.
If input_start has no matching input_ready, inspect pending input commits and context assembly. If stream_end has no subsequent step.finish, inspect tool execution and step finalization.
Inspect request rejections
On model failure, request_failed.model_error includes the stable code, retryable, and, when available, status_code, provider_request_id, provider_error_code, provider_error_param, and provider_error_reason. The same fields appear in warning / model_request notifications. Parameter paths exclude values, and reason summaries use predefined descriptions rather than raw provider error bodies.
For example, code: invalid_request, status_code: 400, provider_error_param: reasoning_effort, and provider_error_reason: Unsupported request parameter identify a rejected parameter. Use the request ID, when available, to investigate with your provider. Model request rejected means the request was refused; consult these diagnostic fields for its cause.
HTTP rejections and errors inside the stream share one classification policy. Explicit rate limits, temporary service failures, connection failures, response-stream establishment timeouts, and first-output timeouts can be retried only before partial output and tool side effects, at most five times. The safety check includes reasoning and tool Parts; reasoning_start can already prevent retry before visible text appears. Protocol parsing failures, unknown request rejections, idle or total timeout, and failures after partial output are not automatically retried.
Every model client consumed by Agent has the shared deadline guard, including in-process clients. Defaults are 120 seconds to establish the response stream (not a TCP connection timeout), 120 seconds of cumulative upstream wait before useful output, 120 seconds of cumulative read wait between useful outputs, and 900 seconds total. Establishment defaults to the first-output budget; consumer backpressure consumes neither first-output nor idle, but total time keeps running. Metadata and empty deltas do not refresh progress.
All model attempts and backoff for a step share a default 900-second recovery budget. Backoff uses 300, 1,000, 2,000, 4,000, and 8,000 milliseconds with ±10% jitter. retry_at_ms preserves an upstream Retry-After as an absolute Unix millisecond deadline; next_retry_at_ms in warning / model_request shows the scheduled retry. If that wait cannot fit within the remaining budget, recovery stops. Check timeout_phase: connect and first_output may be transient; idle, total, and recovery_budget are not retryable. Budget expiry is provider_timeout / 504 with Model recovery budget exhausted, not user cancellation. Stopping immediately interrupts waiting and stream reads and does not publish retry warnings.
Check the context window
Inspect context_window in input-ready or model-request records. null means the execution has no valid window size and cannot calculate context pressure. Check the model definition and catalog metadata propagation instead of inferring capacity from the model name.
With a valid window, the current pressure threshold is 95%. Before sending, the runtime also conservatively estimates the final request and subtracts the output reserve and safety margin from the window to obtain input_budget. When optional automatic images exceed the request budget, they first fall back to path references. If the request still exceeds the budget, fixed system messages and tool schemas that exhaust it are rejected; otherwise the runtime advances stable-history compaction, then rebuilds and measures the request. Individual large user messages and tool inputs in that history can also be summarized.
Each request allows at most 8 advances. Cancellation, an estimate that does not decrease after an advance, no stable history to compact, or reaching the limit stops the process. Budget errors include the stopping reason, category (fixed_system_tools, single_input, or total_request), the total estimate, and the budget. largest_item locates the largest message or content part: message_index is 1-based within the current derived message list, excluding separately supplied system messages; part_index is 1-based and is null for a whole message. Tool inputs and results also include tool_name and tool_call_id. These fields contain no message bodies, tool arguments, or file data. text_estimated_tokens and image_estimated_tokens separately record text and native image estimates, and image_count records the image count. The two token estimates sum to the total input estimate. Native images use conservative dimensions-based reservations, with nonzero reservations for unknown dimensions; their Base64 payload is not scanned as body text tokens. Encoded strings in body text, tool arguments, and ordinary JSON still use text estimation. PDFs and other media retain conservative accounting. media_encoded_bytes records inline media encoding bytes and request_bytes records request bytes; transfer size is not visual token usage. The default image heuristic is not a Provider billing formula or a strict upper bound for every model. Estimates are not actual Provider usage.
A long context without a compaction record does not by itself indicate a compaction failure. The logs diagnose the current execution; the runtime does not automatically resume after partial output or reconstruct an interrupted session.
Rebuild the runtime and restart its host to enable logs for new calls. Requests already in progress will not receive historical phase records.