Skip to content

docs: add MercNET literature lookup workflow - #556

Open
harrisboatworks wants to merge 1 commit into
browser-use:mainfrom
harrisboatworks:codex/mercnet-literature-skill
Open

docs: add MercNET literature lookup workflow#556
harrisboatworks wants to merge 1 commit into
browser-use:mainfrom
harrisboatworks:codex/mercnet-literature-skill

Conversation

@harrisboatworks

@harrisboatworks harrisboatworks commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • document the authenticated MercNET literature search selectors
  • record the read-only document, serial, and model lookup endpoint
  • explain safe internal PDF download and title-page validation
  • include copyright, auth, supersession, and result-scope safeguards

Validation

  • git diff --cached --check
  • reviewed for dealer identifiers, credentials, cookies, tokens, and user-specific state

Summary by cubic

Add a guide for the authenticated MercNET literature lookup workflow. It documents stable search selectors, read-only JSON endpoints (document/serial/model), how to find current manuals when a number is missing, and safe internal PDF download with title-page validation and compliance safeguards.

Written for commit 314339d. Summary will update on new commits.

Review in cubic

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 314339dd37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +114 to +117
meta = js(f"""
fetch({file_url!r}).then(async r => {{
if (!r.ok) throw new Error(`HTTP ${{r.status}}`);
const blob = await r.blob();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Start the PDF download before awaiting its full body

When a manual takes more than five seconds to transfer, this js() call waits for r.blob() before clicking the anchor, while src/browser_harness/helpers.py::_send gives the IPC socket a five-second read timeout and js() awaits returned promises. The caller therefore raises a timeout instead of printing meta or continuing with verification; the browser-side promise may still finish later, making the result additionally ambiguous. Trigger the same-origin download without awaiting the entire PDF in Runtime.evaluate, then poll the destination for completion.

Useful? React with 👍 / 👎.

Comment on lines +107 to +112
cdp(
"Browser.setDownloadBehavior",
behavior="allow",
downloadPath=output_dir,
eventsEnabled=True,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the browser's download behavior after completion

Because this workflow attaches to the user's long-lived browser and omits a browserContextId, Browser.setDownloadBehavior changes the default browser context and remains set to allow with this custom directory after the script ends. Subsequent downloads initiated by the user can therefore be silently redirected away from their normal Downloads folder. Reset the behavior to default in a finally block after the download completes, as the harness's video-download path does.

Useful? React with 👍 / 👎.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="agent-workspace/domain-skills/mercnet/literature.md">

<violation number="1" location="agent-workspace/domain-skills/mercnet/literature.md:107">
P2: `Browser.setDownloadBehavior` is invoked without a `browserContextId`, so it modifies the default browser context. Because this workflow attaches to the user's existing authenticated browser, the `allow` + custom `downloadPath` setting persists after the script finishes. Subsequent user-initiated downloads could be silently redirected away from their normal Downloads folder. Reset the behavior to `default` in a `finally` block after the download completes (or after verifying the file landed).</violation>

<violation number="2" location="agent-workspace/domain-skills/mercnet/literature.md:117">
P2: This documented workflow awaits `r.blob()` inside the `js()` call, which means the entire PDF must download before the promise resolves. If the underlying browser harness enforces a short read timeout on its IPC socket (e.g., 5 seconds), large service manuals will trigger a timeout exception before the blob completes—leaving the download in an ambiguous state. Consider triggering the same-origin download without awaiting the full response body in `Runtime.evaluate`, then polling the output directory for file completion separately.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

file_url = "/mnetdata/" + result["docWorldviewFile"]
file_name = result["docPartNbr"] + ".pdf"

cdp(

@cubic-dev-ai cubic-dev-ai Bot Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Browser.setDownloadBehavior is invoked without a browserContextId, so it modifies the default browser context. Because this workflow attaches to the user's existing authenticated browser, the allow + custom downloadPath setting persists after the script finishes. Subsequent user-initiated downloads could be silently redirected away from their normal Downloads folder. Reset the behavior to default in a finally block after the download completes (or after verifying the file landed).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At agent-workspace/domain-skills/mercnet/literature.md, line 107:

<comment>`Browser.setDownloadBehavior` is invoked without a `browserContextId`, so it modifies the default browser context. Because this workflow attaches to the user's existing authenticated browser, the `allow` + custom `downloadPath` setting persists after the script finishes. Subsequent user-initiated downloads could be silently redirected away from their normal Downloads folder. Reset the behavior to `default` in a `finally` block after the download completes (or after verifying the file landed).</comment>

<file context>
@@ -0,0 +1,139 @@
+file_url = "/mnetdata/" + result["docWorldviewFile"]
+file_name = result["docPartNbr"] + ".pdf"
+
+cdp(
+    "Browser.setDownloadBehavior",
+    behavior="allow",
</file context>
Fix with cubic

meta = js(f"""
fetch({file_url!r}).then(async r => {{
if (!r.ok) throw new Error(`HTTP ${{r.status}}`);
const blob = await r.blob();

@cubic-dev-ai cubic-dev-ai Bot Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This documented workflow awaits r.blob() inside the js() call, which means the entire PDF must download before the promise resolves. If the underlying browser harness enforces a short read timeout on its IPC socket (e.g., 5 seconds), large service manuals will trigger a timeout exception before the blob completes—leaving the download in an ambiguous state. Consider triggering the same-origin download without awaiting the full response body in Runtime.evaluate, then polling the output directory for file completion separately.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At agent-workspace/domain-skills/mercnet/literature.md, line 117:

<comment>This documented workflow awaits `r.blob()` inside the `js()` call, which means the entire PDF must download before the promise resolves. If the underlying browser harness enforces a short read timeout on its IPC socket (e.g., 5 seconds), large service manuals will trigger a timeout exception before the blob completes—leaving the download in an ambiguous state. Consider triggering the same-origin download without awaiting the full response body in `Runtime.evaluate`, then polling the output directory for file completion separately.</comment>

<file context>
@@ -0,0 +1,139 @@
+meta = js(f"""
+fetch({file_url!r}).then(async r => {{
+  if (!r.ok) throw new Error(`HTTP ${{r.status}}`);
+  const blob = await r.blob();
+  const a = document.createElement("a");
+  a.href = URL.createObjectURL(blob);
</file context>
Fix with cubic

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