Files
openclaw/extensions/thread-ownership
Miorbnli 9d0836ee25 fix(thread-ownership): bound 409 response read and preserve cancel semantics (#98941)
* fix(thread-ownership): bound 409 response read and preserve cancel semantics

The thread-ownership 409 conflict path still used unbounded resp.json(),
inconsistent with the bounded readers shipped across the other channel/provider
success paths. A compromised or buggy forwarder returning a multi-GB 409 body
would buffer the entire body before JSON.parse, OOMing the agent.

Bound the 409 body via readResponseTextLimited (8 KiB cap; a 409 owner field is
~30 bytes). Wrap the parse in try/catch so a truncated or malformed 409 body
still cancels the send (owner logged as "unknown") — the 409 status itself
means another agent owns this thread, independent of body parseability.

The discord webhook and huggingface /v1/models success reads from the original
PR were superseded upstream by #98098 and #101079 (readProviderJsonResponse),
so this branch now carries only the thread-ownership fix.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(thread-ownership): bound forwarder conflict handling

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-19 00:01:09 +01:00
..