Skip to content

Conversation

@tkattkat
Copy link
Collaborator

@tkattkat tkattkat commented Oct 29, 2025

why

currently, log level one has too many noisy logs, and not enough basic ones

what changed

moved various logs to level 2
added logs for act extract and observe on level one with the method being called, and the instruction

image

test plan

@changeset-bot
Copy link

changeset-bot bot commented Oct 29, 2025

🦋 Changeset detected

Latest commit: 4d56ded

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-evals Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

This PR refactors the logging system to reduce noise at log level 1 while adding more useful high-level operation logs.

Key Changes:

  • Added level 1 logs for act, extract, and observe operations showing the instruction/description being executed
  • Moved auxiliary fields (like instruction text) directly into log messages using bracket notation (e.g., [act] click the button)
  • Demoted noisy internal logs to level 2: LLM responses, navigation checks, iframe handling, and URL detection
  • Simplified handlePossibleNavigation signature by removing unused actionDescription and xpath parameters

Impact:
Level 1 logging now provides a cleaner view focused on user-facing operations, while level 2 captures detailed internal mechanics for debugging.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are purely cosmetic logging improvements with no behavioral modifications. All function signature changes are correctly propagated to call sites, and the logging level adjustments follow a clear and consistent pattern throughout the codebase.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/core/lib/v3/handlers/actHandler.ts 5/5 Added level 1 logging for act calls with instruction text
packages/core/lib/v3/handlers/extractHandler.ts 5/5 Simplified extraction logging - moved instruction to message from auxiliary field
packages/core/lib/v3/handlers/handlerUtils/actHandlerUtils.ts 5/5 Moved various action utility logs from level 1 to level 2, simplified handlePossibleNavigation signature
packages/core/lib/v3/handlers/observeHandler.ts 5/5 Simplified observation logging - moved instruction to message from auxiliary field

Sequence Diagram

sequenceDiagram
    participant User
    participant Stagehand
    participant ActHandler
    participant ExtractHandler
    participant ObserveHandler
    participant v3Logger
    
    User->>Stagehand: act(instruction)
    Stagehand->>ActHandler: act()
    ActHandler->>v3Logger: log [act] instruction (level 1)
    ActHandler->>ActHandler: doObserveAndAct()
    ActHandler->>v3Logger: log internal details (level 2)
    ActHandler-->>User: ActResult
    
    User->>Stagehand: extract(instruction)
    Stagehand->>ExtractHandler: extract()
    ExtractHandler->>v3Logger: log [extract] instruction (level 1)
    ExtractHandler->>ExtractHandler: perform extraction
    ExtractHandler-->>User: ExtractionResult
    
    User->>Stagehand: observe(instruction)
    Stagehand->>ObserveHandler: observe()
    ObserveHandler->>v3Logger: log [observe] instruction (level 1)
    ObserveHandler->>ObserveHandler: analyze DOM
    ObserveHandler-->>User: Action[]
    
    Note over v3Logger: Level 1: High-level operations<br/>Level 2: Internal details/debugging
Loading

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

2 participants