Skip to content

fix(har-derived-api-client): handle postData: null in HAR entries - #84977

Open
thaingo72-ctrl wants to merge 1 commit into
NousResearch:mainfrom
thaingo72-ctrl:fix/har-to-client-postdata-null
Open

thaingo72-ctrl wants to merge 1 commit into
NousResearch:mainfrom
thaingo72-ctrl:fix/har-to-client-postdata-null

Conversation

@thaingo72-ctrl

Copy link
Copy Markdown

Summary

har_to_client.py crashes with AttributeError: 'NoneType' object has no attribute 'get' when a HAR entry contains "postData": null — which is common for GET-only requests (Chrome/Playwright HARs include the key explicitly with a null value).

req.get("postData", {}) only defaults when the key is absent, not when it's explicitly null.

Fix

req.get("postData") or {} — null and absent both become an empty dict.

Verification

  • Reproduced: fed a HAR with postData: null → crash at line 91
  • After fix: derives endpoints correctly (Wikipedia search-title example), replay over plain HTTP returns 200 with matching results

req.get("postData", {}) returns None when a HAR entry explicitly has
postData: null (common for GET-only requests), crashing har_to_client.py
with AttributeError: 'NoneType' object has no attribute 'get'. Use
req.get("postData") or {} so null and absent both become an empty dict.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/browser Browser automation (CDP, Playwright) labels Aug 13, 2026
Adolanium added a commit to Adolanium/hermes-agent that referenced this pull request Aug 13, 2026
Failed --action specs IndexError and skip context.close(), so the HAR
never lands. CDP attach drives pages[0] (and --goto navigates it), and
derivation drops form params and base64 response bodies.

Share a validated run_action helper (bad specs fail with a clear
ValueError, including empty selectors), flush the Playwright HAR in
finally, listen on every CDP context, and open a new tab for --goto so
it cannot wipe the tab Hermes is driving. In-flight requests left after
--wait are flushed as entries with a null response, after detaching the
listeners. Calling the waiting request.response() there could hang the
capture (no timeout) or record a late response twice. har_to_client now
reads params-only postData and decodes base64 content.

Does not change header redaction, scheme printing, or CDP queryString
(NousResearch#85053). Null postData is handled by the new body helper, which
supersedes NousResearch#84977.
@Enough1122

Copy link
Copy Markdown

AI code review — automated review for reference, author can ignore or act on any point.

fix(har-derived-api-client): handle postData: null in HAR entries

  1. optional-skills/web-development/har-derived-api-client/scripts/har_to_client.py:90 — the post = req.get("postData") or {} guard correctly handles postData: null, but the neighboring reads are not equally defensive: g["headers"][name] = trunc(h["value"], 120) will raise if a header value is null, and resp = entry.get("response", {}) would fail on response: null in the same malformed-HAR family. If the intent is robustness against real-world HAR exports, consider guarding the sibling accesses too (or a single normalization pass at the top of the loop).

  2. No test accompanies the change. A tiny regression test feeding a HAR entry with "postData": null (and asserting the entry still processes) would pin the fix — the one-liner is easy to re-break during later refactors of the script.

Adolanium added a commit to Adolanium/hermes-agent that referenced this pull request Oct 1, 2026
Failed --action specs IndexError and skip context.close(), so the HAR
never lands. CDP attach drives pages[0] (and --goto navigates it), and
derivation drops form params and base64 response bodies.

Share a validated run_action helper (bad specs fail with a clear
ValueError, including empty selectors), flush the Playwright HAR in
finally, listen on every CDP context, and open a new tab for --goto so
it cannot wipe the tab Hermes is driving. In-flight requests left after
--wait are flushed as entries with a null response, after detaching the
listeners. Calling the waiting request.response() there could hang the
capture (no timeout) or record a late response twice. har_to_client now
reads params-only postData and decodes base64 content.

Does not change header redaction, scheme printing, or CDP queryString
(NousResearch#85053). Null postData is handled by the new body helper, which
supersedes NousResearch#84977.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have tool/browser Browser automation (CDP, Playwright) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants