-
Notifications
You must be signed in to change notification settings - Fork 1.2k
update logging #1201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
update logging #1201
Conversation
🦋 Changeset detectedLatest commit: 4d56ded The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
There was a problem hiding this 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, andobserveoperations 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
handlePossibleNavigationsignature by removing unusedactionDescriptionandxpathparameters
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
5 files reviewed, no comments
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
test plan