Commit Graph

8459 Commits

Author SHA1 Message Date
Saurav Panda fc27ac9bb2 fixed table selector formatting 2026-02-05 17:19:33 -08:00
Saurav Panda c946451221 Merge branch 'main' into experiment-js-codegen-extraction 2026-02-05 16:53:42 -08:00
Saurav Panda 257f89ac01 added milder nudge for action loop (#4039)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Softened the action-loop and page-stagnation nudges to be
awareness-focused, keeping detection thresholds unchanged and removing
directive language.

- **Refactors**
- Reworded loop nudges at 5/8/12 repeats to use “Heads up” and encourage
checking progress.
- Made page-stagnation message gentler and suggest trying a different
element or approach.
- Updated tests to match new phrasing and confirm no “done” or “cannot
be completed” directives.

<sup>Written for commit 3c57cdc756.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-05 12:14:15 -08:00
Saurav Panda 3c57cdc756 Merge branch 'main' into update-action-loop-prompt 2026-02-05 12:08:33 -08:00
Saurav Panda c0a9cb5cc7 updated default max step to 500 (#4040)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Increased the default max_steps from 100 to 500 in agent run and
run_sync to allow longer executions by default.
This lets agents complete more complex tasks without needing manual
configuration.

<sup>Written for commit 995cb0176b.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-05 11:33:30 -08:00
Saurav Panda 995cb0176b updated default max step to 500 2026-02-05 11:20:47 -08:00
Saurav Panda bb5914f251 added milder nudge for action loop 2026-02-05 11:17:20 -08:00
laithrw b4a423edb0 fix: correct docker build context path in build-base-images.sh (#4018)
The build context on line 27 was set to ../../.. but the script cd's
into docker/ at the start, so only .. is needed to reach the repo root.
Running it as-is would point docker build to the wrong directory and
fail.

Fixes #4011

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixed the Docker build context in docker/build-base-images.sh to use ..
instead of ../../.. because the script runs from docker/. This points
builds at the repo root and avoids failures; fixes #4011.

<sup>Written for commit 1d9ae7e8ca.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-04 21:46:32 -05:00
laithrw 1d9ae7e8ca Merge branch 'main' into fix/docker-build-context-path 2026-02-04 21:44:25 -05:00
laithrw 69cb06d545 fix(#3657): agent not switching tabs after new opened (#4034)
Include in agent context that new tab was opened

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Notify the agent when a click opens a new browser tab so it knows to
switch to it. Addresses #3657 where the agent stayed on the old tab
after actions that opened a new page.

- **Bug Fixes**
- Detect new tabs by comparing tab IDs before and after clicks in
_click_by_coordinate and _click_by_index.
- Append a note to the action memory with the new tab’s short ID,
prompting the agent to switch.

<sup>Written for commit 99be7b1b48.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-04 21:26:35 -05:00
laithrw 99be7b1b48 Merge branch 'main' into fix/no-tab-switch 2026-02-04 21:24:34 -05:00
laithrw 5d19f5704a Add HarRecordingWatchdog for HTTPS HAR capture (#3543)
#3063

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Add HarRecordingWatchdog to capture HTTPS network traffic via CDP and
write a HAR 1.2 file on browser shutdown. Auto-attaches when
browser_profile.record_har_path is set and supports configurable content
storage and capture modes.

- **New Features**
- Records HTTPS requests/responses (bodies and request postData) and
saves to browser_profile.record_har_path on stop.
- Supports record_har_content: embed (text or base64), attach (sidecar
dir: <har_stem>_har_parts), or omit.
- Supports record_har_mode: full or minimal (main doc + same-origin
subresources).
- Adds browser/version metadata, page refs, and DOMContentLoaded/load
timings.

- **Migration**
  - Set browser_profile.record_har_path to enable.
- Optional: configure record_har_content (embed|attach|omit) and
record_har_mode (full|minimal).

<sup>Written for commit 9d81f64b2e.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Introduce HarRecordingWatchdog to capture HTTPS traffic via CDP and
write a HAR 1.2 file on shutdown, configurable for content storage and
capture scope, and auto-attached to sessions.
> 
> - **Watchdogs**:
>   - **HarRecordingWatchdog (new)**:
> - Captures HTTPS requests/responses via CDP (`Network`, `Page`) and
writes HAR 1.2 on `BrowserStopEvent`.
> - Configurable: `record_har_content` (embed/attach/omit) with sidecar
dir for attach; `record_har_mode` (full/minimal).
> - Records response bodies, headers, sizes, compression, timings;
includes pages with titles and DOMContentLoaded/load metrics; embeds
browser metadata.
> - **Session Integration**:
> - Import, initialize, and attach `HarRecordingWatchdog` in
`BrowserSession.attach_all_watchdogs()` (auto-enabled when
`record_har_path` is set).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b53a593d33. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-02-04 21:19:35 -05:00
laithrw 9d81f64b2e Merge branch 'main' into kalil0321/har_watchdog 2026-02-04 21:17:10 -05:00
Laith Weinberger 7455b3c1af deduplicate code; allow CDP events to propagate; error handling 2026-02-04 21:14:14 -05:00
Laith Weinberger d66181cdc6 notify agent if new tab opened 2026-02-04 21:02:13 -05:00
Saurav Panda f21bbb3f31 increased threshold for loop detection (#4033)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Raised loop detection thresholds and expanded the window to reduce false
positives and make nudges less aggressive. Also updated the simple judge
to include today's date so recent timestamps aren’t flagged as
fabricated.

- **Refactors**
- Increased default loop_detection_window from 10 to 20; repetition
thresholds now trigger at 5/8/12, and page stagnation at 5 consecutive
identical pages.
- Improved action hashing: renamed click_element/input_text to
click/input for hashing, scroll hashes include element index, and
wait/done/go_back actions are excluded from loop tracking.

- **Bug Fixes**
- Fewer false-positive loop warnings, especially around waits, terminal
actions, and repeated scrolls.
- Critical loop message no longer instructs calling “done”; it suggests
trying a different approach or reporting progress.
- Judge prompt includes today’s date and clarifies that near-current
timestamps are not fabricated, reducing false failures.

<sup>Written for commit 332694bf1a.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-04 17:20:18 -08:00
Saurav Panda 332694bf1a Added date info to simple judge 2026-02-04 17:04:39 -08:00
Saurav Panda b3f2cc179e Improve JS codegen prompt 2026-02-04 16:39:39 -08:00
Saurav Panda cec4aea3bc increased threshold for loop detection 2026-02-04 16:34:42 -08:00
Saurav Panda e206616e98 added result deduplication 2026-02-03 21:45:28 -08:00
Saurav Panda a488a2d852 Revert "added html de duplication"
This reverts commit cf22532963.
2026-02-03 21:26:34 -08:00
Saurav Panda cf22532963 added html de duplication 2026-02-03 20:06:55 -08:00
Saurav Panda e58c435ce7 reverted MAX HTML chars to 100k 2026-02-03 18:52:51 -08:00
Saurav Panda 257b834273 improve text field handling (#4023)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Improves text input reliability by auto-fixing concatenated values when
clearing fails and by adding a short delay for JS-driven autocomplete
fields to let suggestions appear.

- **Bug Fixes**
- Auto-retry: if clear=True and readback shows old+new text, set the
value via the element’s native setter and dispatch input/change events
to match the intended text.
- Autocomplete/combobox: detect these fields and wait 400ms after typing
so the dropdown can populate before the next action. Skip delay for
native datalist inputs.

<sup>Written for commit d24dea0aa4.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-03 18:39:44 -08:00
Saurav Panda d24dea0aa4 Merge branch 'main' into improve-input-field-handling 2026-02-03 18:22:19 -08:00
Saurav Panda 12628fb904 added hrefs and pagination clues 2026-02-03 18:11:35 -08:00
Saurav Panda 5d7ff041d3 improved concatenation heuristic 2026-02-03 18:02:58 -08:00
Saurav Panda 4d69796045 Action Loop detection (#4027)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds behavioral loop detection to the agent with escalating context
nudges when actions repeat or the page doesn’t change, reducing wasted
steps. Includes normalized action hashing and page fingerprints, with
settings to enable and size the detector.

- **New Features**
- Added ActionLoopDetector with a rolling window to track action
repetition and page stagnation; nudges at 3/5/8 repeats and after 3
stagnant pages.
- Introduced PageFingerprint and normalized action hashing for search,
click, input, navigate, and scroll.
- Integrated into Agent: new settings (loop_detection_window,
loop_detection_enabled), records actions/page state, and injects nudges
into context messages.
- Added comprehensive tests covering hashing, detector behavior, page
stagnation, and agent integration.

<sup>Written for commit bbf3cc0164.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-03 17:20:12 -08:00
Saurav Panda bbf3cc0164 Merge branch 'main' into action-detection-loop 2026-02-03 17:18:06 -08:00
Saurav Panda b96b9436fc fixed agent loop detection 2026-02-03 16:00:08 -08:00
Saurav Panda d210ba06a9 removed strip tags and added structure probe 2026-02-03 15:45:22 -08:00
Saurav Panda bd4ead5d2e Action Loop detection 2026-02-03 15:19:59 -08:00
laithrw 045ad9d170 feat: read_long_content action for long webpages and files (#3994)
Made read_file smarter for PDFs - instead of just reading the first 20
pgs, it reads up to 60k chars and uses IDF scoring to prioritize pgs w
unique content

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds read_long_content to quickly find and extract relevant info from
long webpages and files. Also upgrades PDF reading to prioritize
distinctive pages and respect a 60k-char budget with clear page markers.

- **New Features**
- read_long_content: intelligently reads the current page or files,
extracts 3–5 search terms from the goal, and returns only the most
relevant sections (or PDF pages) up to ~50k chars.
- Smarter PDF reading: reads all content when under 60k chars; otherwise
scores pages using IDF, always includes page 1, and adds page markers
plus a truncation note with skipped pages.

- **Bug Fixes**
- Restricted read_long_content file access to whitelisted paths
(available_file_paths or downloaded files) to mitigate injection risks.
- Prevented negative slice indices when fitting the last page into the
remaining char budget and truncated overbudget pages instead of dropping
them.

<sup>Written for commit f9c36f11a4.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-03 18:02:56 -05:00
Laith Weinberger f9c36f11a4 lint 2026-02-03 17:59:24 -05:00
laithrw bcb5a2ad63 Merge branch 'main' into feat/smart-pdf-reading 2026-02-03 17:44:37 -05:00
laithrw 07241b58c9 fix(#3619): add hidden content hints for iframes in DOM context (#3941)
Resolves 3619. Elements in iframes beyond viewport threshold are
filtered from selector_map, causing agents to scroll excessively and
blindly to find them.

Added hints to the LLM context indicating hidden content:
- "N more interactive elements below - scroll to reveal" when
buttons/inputs are hidden
- "more content below viewport - scroll to reveal" when only
text/content is hidden

The hints also include the locations of each element, mapping distance
directly to the scroll(pages=N) action, allowing the agent to jump
directly to hidden content instead of scrolling incrementally.

Example:
... (3 more elements below - scroll to reveal):
<button> "Target Button Far Down" ~5.3 pages down
      <button> "Submit Final Form Button" ~7.3 pages down


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes #3619 by adding iframe hidden content hints in the DOM context so
agents know exactly how far to scroll instead of searching blindly. Also
makes the viewport threshold configurable.

- **New Features**
- Collect hidden interactive elements per iframe and store details (tag,
text, pages down) in hidden_elements_info.
- Serializer adds context lines: "... (N more elements below - scroll to
reveal)" with per-element hints like <tag> "text" ~X pages down, or a
generic "... (more content below viewport - scroll to reveal)" when only
non-interactive content is hidden.
- New viewport_threshold option in DOM service (default 1000px). Set to
None to disable viewport-based filtering.

<sup>Written for commit a511ba2f1e.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-03 17:44:02 -05:00
Laith Weinberger 799e714c2b mitigate injection; don't drop overbudget pages
- restricted read_long_content file access to only paths in available_file_paths or browser_session.download_files to mitigate injection
- made PDF page selection truncate pages that exceed char budget instead of dropping them entirely
- fixed truncation hint in file_system.py to reference read_long_context instead of search_page
2026-02-03 17:42:02 -05:00
laithrw a511ba2f1e Merge branch 'main' into 3619 2026-02-03 17:32:46 -05:00
Saurav Panda 2a5768f3da fixed pyright issues 2026-02-03 13:02:03 -08:00
Saurav Panda 749fa56d1a improve text field handling 2026-02-03 12:52:56 -08:00
Saurav Panda 36e85ae85c added reuseable script id 2026-02-03 12:46:14 -08:00
Saurav Panda 14de7f5610 added empty partial detection and JS caching 2026-02-03 11:30:51 -08:00
Laith Weinberger 38fb5b12df Merge remote-tracking branch 'origin/main' into feat/smart-pdf-reading 2026-02-03 14:15:49 -05:00
Saurav Panda 8af979dda6 made extraction strategy more prescriptive 2026-02-03 10:24:39 -08:00
Shobhit Sahani 51dbeff043 fix: correct docker build context path in build-base-images.sh
Build context was set to ../../.. but the script cd's into docker/ on
line 31, so only .. is needed to reach the repo root. This caused the
build to fail when running from the repo root.

Fixes #4011

fix: add missing newline at end of file

fix: remove accidental heredoc wrapper from build script
2026-02-03 11:23:20 +00:00
Saurav Panda f7ccd2bf42 excluded the extract function 2026-02-02 23:20:03 -08:00
Saurav Panda 4d5794ad7d updated agent success with simple judge (#4014)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds a lightweight, always-on judge that validates agent success using
only the task and final response to reduce false positives. The full
judge now logs verdicts without changing success; the simple judge can
override success when requirements aren’t met.

- **New Features**
- Simple judge: text-only check runs at completion and flips success to
failure when the final result doesn’t fully satisfy the task; adds a
brief note to extracted content.
- New SimpleJudgeResult schema and construct_simple_judge_messages
helper.

- **Refactors**
- Full judge no longer overrides success; it attaches verdicts and logs
differences for telemetry comparison.
- Simple judge runs only when the agent self-reports success and ignores
errors to avoid unintended overrides.

<sup>Written for commit da5b4237ba.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-02-02 23:04:30 -08:00
Saurav Panda da5b4237ba fixed lint issue 2026-02-02 23:01:52 -08:00
Saurav Panda 0dba38ed95 Merge branch 'main' into align-agent-success-with-judge 2026-02-02 22:16:11 -08:00
Saurav Panda 8565c7d267 updated agent success with simple judge 2026-02-02 22:14:45 -08:00