Skip to content

Conversation

@quanru
Copy link
Collaborator

@quanru quanru commented Dec 31, 2025

No description provided.

@netlify
Copy link

netlify bot commented Dec 31, 2025

Deploy Preview for midscene ready!

Name Link
🔨 Latest commit 41ccfb0
🔍 Latest deploy log https://app.netlify.com/projects/midscene/deploys/695cf82130a55900081a25c2
😎 Deploy Preview https://deploy-preview-1703--midscene.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@quanru quanru marked this pull request as draft December 31, 2025 09:49
@quanru quanru requested a review from Copilot January 4, 2026 02:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for directory-based report format with local image files, providing an alternative to the traditional single HTML file with embedded base64 images. This is particularly useful for large reports where embedding many base64 images can make the HTML file unwieldy.

Key Changes:

  • Added useDirectoryReport option to agent configuration that generates reports with separate PNG screenshot files instead of embedded base64 data
  • Implemented image extraction to script tags for improved memory performance when parsing large JSON dumps in traditional reports
  • Added frontend support to restore image references from script tags

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/core/src/types.ts Added useDirectoryReport option to AgentOpt interface
packages/core/src/agent/agent.ts Passes useDirectoryReport option to report writing logic
packages/core/src/utils.ts Implements directory report generation, screenshot extraction to files, and image extraction to script tags for traditional reports
apps/report/src/utils/image-restoration.ts New utility to load and restore image references from script tags in the frontend
apps/report/src/App.tsx Integrates image restoration logic when loading dump data
packages/web-integration/tests/ai/web/puppeteer/directory-report.test.ts New test suite validating directory-based report format
packages/web-integration/tests/ai/web/puppeteer/open-new-tab.test.ts Explicitly disables directory report to maintain existing behavior
apps/site/docs/en/api.mdx Documents the new useDirectoryReport option (English)
apps/site/docs/zh/api.mdx Documents the new useDirectoryReport option (Chinese)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 15 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 15 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

quanru added 14 commits January 5, 2026 20:30
…r navigation in Banner and CTAButtons"

This reverts commit 0fc67f2.
…tions and local testing

refactor(agent): remove redundant comment about base64 clearing in writeDirectoryReport
refactor(utils): update type definitions for dumpData in multiple functions for better clarity
test(directory-report): rename variable for consistency in base64 check
… and improve logging in writeDirectoryReport
@quanru quanru marked this pull request as ready for review January 5, 2026 12:35
@quanru quanru requested a review from Copilot January 6, 2026 06:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 42 out of 44 changed files in this pull request and generated 13 comments.

Comments suppressed due to low confidence (1)

packages/core/src/agent/agent.ts:277

  • Potential race condition: The screenshotScale is computed lazily and stored in screenshotScalePromise. If multiple calls to getScreenshotScale happen concurrently before the first one completes, all will create new promises and compute the scale multiple times. The second check on line 259 should happen after the promise settles. Consider using a proper once-only pattern or mutex.
  private async getScreenshotScale(
    rawContext: RawUIContextData,
  ): Promise<number> {
    if (this.screenshotScale !== undefined) {
      return this.screenshotScale;
    }

    if (!this.screenshotScalePromise) {
      this.screenshotScalePromise = (async () => {
        const pageWidth = rawContext.size?.width;
        assert(
          pageWidth && pageWidth > 0,
          `Invalid page width when computing screenshot scale: ${pageWidth}`,
        );

        debug('will get image info of base64');
        const { width: screenshotWidth } = await imageInfoOfBase64(
          rawContext.screenshotBase64,
        );
        debug('image info of base64 done');

        assert(

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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