Skip to content

Trim large payloads before sending report to avoid 413 errors#20

Closed
amir-prompt wants to merge 1 commit intomainfrom
cut_old_data
Closed

Trim large payloads before sending report to avoid 413 errors#20
amir-prompt wants to merge 1 commit intomainfrom
cut_old_data

Conversation

@amir-prompt
Copy link
Collaborator

@amir-prompt amir-prompt commented Feb 18, 2026

User description

Add _trim_payload helper that progressively halves large list fields (tool_calls, web_activity, etc.) until the JSON payload fits under 5 MB. Improves error message for HTTP 413 responses.


Generated description

Below is a concise technical summary of the changes proposed in this PR:
Implements a payload trimming mechanism in openclaw_usage.py to ensure reports stay within the 5 MB limit by progressively reducing the size of large list fields. Enhances error reporting for HTTP 413 responses to provide clearer guidance when payloads remain too large after trimming.

TopicDetails
Payload Trimming Introduces _trim_payload to recursively halve specific list fields like tool_calls and web_activity until the serialized JSON fits within MAX_PAYLOAD_BYTES.
Modified files (1)
  • openclaw_usage.py
Latest Contributors(2)
UserCommitDate
vitaly@prompt.securityExtract-shared-aggrega...February 16, 2026
amir@prompt.securityFix-linter-errors-grou...February 16, 2026
Reporting Logic Updates send_report to utilize the new trimming logic and provides a more descriptive error message specifically for HTTP 413 status codes.
Modified files (1)
  • openclaw_usage.py
Latest Contributors(2)
UserCommitDate
vitaly@prompt.securityExtract-shared-aggrega...February 16, 2026
amir@prompt.securityFix-linter-errors-grou...February 16, 2026
This pull request is reviewed by Baz. Review like a pro on (Baz).

Add _trim_payload helper that progressively halves large list fields
(tool_calls, web_activity, etc.) until the JSON payload fits under 5 MB.
Improves error message for HTTP 413 responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant