# Request body limit observations

The packaged provider measures the UTF-8 bytes of the complete JSON request, including tool definitions. For ordinary model requests, at or above the effective byte ceiling it requests recovery before transport. The existing special compaction-request bypass is unchanged. This byte boundary is separate from the token compaction threshold: a 700,000-byte ceiling does not guarantee that a request can contain 250,000 tokens.

The two recognized HTTPS BLUN API endpoints use a 700,000-byte fallback. Unknown endpoints receive no guessed product limit. Explicit configuration remains effective, including an explicitly configured 500,000-byte ceiling. A fresh lower ceiling reported by a provider error still bounds that configuration.

New learned observations contain a version, a byte limit and a local observation timestamp. They expire after fifteen minutes. The newest valid observation wins; equal timestamps choose the smaller limit. Invalid, future-dated and expired records are ignored. An expired versioned runtime record cannot reactivate its numeric compatibility shadow. Provider clones replace records rather than mutating shared records.

The migration ignores only the unversioned historic value 500,000 at the recognized product endpoints. Other legacy numeric observations retain their previous behavior, including those for foreign endpoints. A fresh, versioned 500,000-byte server observation remains effective until expiry. A later higher server observation can replace an earlier lower one.

Records stay in the existing request_body_byte_limits TOML table, keyed by the existing endpoint hash. The normal configuration writer merges the latest table. No message text, credentials, account identifier or new destination is added, and learning uses the existing provider-error path. This change adds no network request. Expiry affects whether a record is used; it does not automatically erase the record from disk. The fifteen-minute lifetime is a local cache policy, not a server-provided promise.

The existing configuration lock and atomic writer are reused. The lock retains its best-effort timeout and stale-lock behavior. Tests cover parallel saves, an overlapping save and stale configuration write under an intact lock, and preservation of unrelated settings; they do not establish race freedom under every interprocess failure.

Regression tests extract measurement and learning from both packaged cores. A separate test imports the main bundle as a library without running its entry point and uses its actual TOML parser, serializer, atomic writer and configuration writer. Patch guards reject missing or duplicate target definitions and partial helper injection. These checks do not prove live server settings, a response-time bound, or final installation behavior.

This repair targets the packaged runtime. The source runtime differs, and the final composed package still needs installation checks and independent package review before publication.
