Skip to content

Diffs: extend image quality configs and add PDF as a format option#31342

Merged
gumadeiras merged 10 commits intomainfrom
codex/diffs-reconcile-main-hardening
Mar 2, 2026
Merged

Diffs: extend image quality configs and add PDF as a format option#31342
gumadeiras merged 10 commits intomainfrom
codex/diffs-reconcile-main-hardening

Conversation

@gumadeiras
Copy link
Member

@gumadeiras gumadeiras commented Mar 2, 2026

Summary

  • extends rendering configs for different image quality settings
  • adds PDF as an output format → use it to bypass image compression in certain channels (Telegram, WhatsApp)
  • rebased the diffs plugin work onto latest main hardening instead of carrying older file snapshots
  • preserved upstream security protections (local-only viewer policy with security toggle, strict browser asset routing, store root path guards, render limits)
  • kept newer diffs capabilities (file output mode, PNG/PDF rendering options, quality/scale/max-width controls, file* defaults)
  • restored backward compatibility aliases for image* inputs/details/config while keeping docs focused on canonical file* options
  • clarified docs wording to describe outputs as viewer, file (PNG or PDF), or both

Testing

  • pnpm test extensions/diffs/index.test.ts extensions/diffs/src/config.test.ts extensions/diffs/src/render.test.ts extensions/diffs/src/tool.test.ts extensions/diffs/src/browser.test.ts extensions/diffs/src/http.test.ts extensions/diffs/src/viewer-payload.test.ts extensions/diffs/src/store.test.ts

Copilot AI review requested due to automatic review settings March 2, 2026 05:59
@openclaw-barnacle openclaw-barnacle bot added docs Improvements or additions to documentation size: XL maintainer Maintainer-authored PR labels Mar 2, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR successfully rebases the diffs plugin onto the latest main hardening branch while preserving all upstream security protections and adding new file rendering capabilities.

Key Changes:

  • Adds PDF rendering support alongside PNG format
  • Introduces quality presets (standard, hq, print) with appropriate scale/maxWidth/maxPixels limits
  • Adds explicit file mode for artifact-only rendering (alongside existing image mode)
  • Implements automatic retry logic with scale reduction when renders exceed pixel limits
  • Maintains full backward compatibility with image* parameters while introducing canonical file* options

Implementation Quality:

  • Comprehensive test coverage for new features, backward compatibility, and edge cases
  • Security measures properly maintained (local-only viewer policy, strict browser asset routing, root path guards, render limits)
  • Clean configuration resolution with proper fallback chains between new file* and legacy image* parameters
  • Documentation thoroughly updated to reflect new capabilities while preserving key operational guidance

Backward Compatibility:
All existing image* parameters (imageFormat, imageQuality, imageScale, imageMaxWidth) are preserved as aliases, ensuring zero breaking changes for existing configurations.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • Score reflects thorough testing, careful backward compatibility handling, preserved security protections, and clean implementation. The rebase successfully reconciles main hardening with new features without introducing regressions.
  • No files require special attention.

Last reviewed commit: c514a8e

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 rebases the diffs plugin's file mode enhancements onto the latest main branch that added security hardening. It introduces PDF rendering as an output format, adds quality presets (standard, hq, print), adds a mode=file canonical mode (deprecating mode=image), and preserves backward compatibility with image* parameter aliases and the deprecated format/imageFormat aliases.

Changes:

  • New mode=file canonical output mode (alias for deprecated mode=image), plus PNG and PDF rendering via fileFormat, fileQuality, fileScale, fileMaxWidth options with backward-compatible image* aliases
  • Browser rendering updated with pixel-cap retry logic, PDF generation via page.pdf(), and dynamic viewport sizing based on maxWidth
  • Documentation and test coverage updated for all new modes and options

Reviewed changes

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

Show a summary per file
File Description
extensions/diffs/src/types.ts Adds DiffFileDefaults, DiffImageQualityPreset, DiffOutputFormat types; extends DiffToolDefaults; adds image options to DiffRenderOptions; adds filePath to DiffArtifactMeta
extensions/diffs/src/config.ts Adds quality preset profiles, new file* defaults, resolveDiffImageRenderOptions export, and backward-compatible image* alias resolution
extensions/diffs/src/tool.ts Wires resolveDiffImageRenderOptions into execution, adds mode=file, backward-compat aliases, refactors screenshot path into renderDiffArtifactFile helper
extensions/diffs/src/store.ts Adds updateFilePath/allocateFilePath/allocateStandaloneFilePath with format support; aliases old image* methods for backward compat
extensions/diffs/src/browser.ts Adds pixel-cap retry loop, dynamic viewport, PDF output via page.pdf(), configurable scale/maxWidth
extensions/diffs/src/render.ts Passes imageMaxWidth to buildHtmlDocument replacing hardcoded 960px
extensions/diffs/src/config.test.ts Tests for new file defaults, quality presets, format aliases, and resolveDiffImageRenderOptions
extensions/diffs/src/tool.test.ts Tests for mode=file, PDF output, image* backward compat aliases, and defaults
extensions/diffs/src/browser.test.ts Tests PDF path, mock page updated with pdf/screenshot spies
extensions/diffs/src/store.test.ts Tests for updateFilePath, allocateFilePath/Standalone, PDF path allocation, image alias compat
extensions/diffs/src/render.test.ts Tests that imageHtml uses configured maxWidth
extensions/diffs/src/prompt-guidance.ts Updates agent guidance from mode=image/imagePath to mode=file/filePath
extensions/diffs/openclaw.plugin.json Adds file* and image* alias schema entries; updates mode enum to include "file"
extensions/diffs/index.ts Updates description to mention PNG/PDF
extensions/diffs/README.md Updates docs for new file* options, removes old image* primary references
docs/tools/diffs.md Simplifies doc page for new file-mode terminology

@gumadeiras gumadeiras changed the title Diffs: reconcile main hardening with file mode enhancements Diffs: extend image quality configs and add PDF as a format option Mar 2, 2026
Copy link

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

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: 29dbe0fe85

ℹ️ 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".

Copy link

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

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: b08559211f

ℹ️ 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".

Copy link

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

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: 2202d0b7c7

ℹ️ 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".

Copy link

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

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: 061cf3981e

ℹ️ 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".

@openclaw-barnacle openclaw-barnacle bot added the gateway Gateway runtime label Mar 2, 2026
@gumadeiras gumadeiras force-pushed the codex/diffs-reconcile-main-hardening branch 2 times, most recently from d7b2d6c to 86e29e5 Compare March 2, 2026 08:04
Copy link

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

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: 86e29e5037

ℹ️ 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".

@gumadeiras gumadeiras force-pushed the codex/diffs-reconcile-main-hardening branch from f57dae7 to cc12097 Compare March 2, 2026 09:38
@gumadeiras gumadeiras merged commit 5f49a5d into main Mar 2, 2026
12 of 14 checks passed
@gumadeiras gumadeiras deleted the codex/diffs-reconcile-main-hardening branch March 2, 2026 09:38
@gumadeiras
Copy link
Member Author

Merged via squash.

Thanks @gumadeiras!

mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 2, 2026
* main: (212 commits)
  fix(ci): annotate feishu hoisted mock type
  fix(ci): align strict nullable typing across channels and ui
  refactor(tests): dedupe macos ipc smoke setup blocks
  refactor(tests): dedupe ios gateway and deeplink fixtures
  refactor(tests): dedupe openclawkit chat test helpers
  test(runtime): trim timer-heavy regression suites
  test(config): reuse fixtures for faster validation
  test(cli): reduce update/program suite overhead
  refactor(tests): dedupe ios defaults and setup-code helpers
  refactor(tests): dedupe swift gateway and chat fixtures
  Diffs: extend image quality configs and add PDF as a format option (openclaw#31342)
  refactor(scripts): dedupe installer CLI verification
  refactor(extensions): dedupe channel config, onboarding, and monitors
  refactor(core): extract shared usage, auth, and display helpers
  refactor(ui): dedupe state, views, and usage helpers
  refactor(scripts): dedupe guard checks and smoke helpers
  fix(browser): honor profile attachOnly for loopback CDP (openclaw#31429)
  [AI-assisted] test: fix typing and test fixture issues (openclaw#31444)
  chore(tsgo/lint): fix CI errors
  fix(browser): support configurable CDP auto-port range start (openclaw#31352)
  ...
hanqizheng pushed a commit to hanqizheng/openclaw that referenced this pull request Mar 2, 2026
…penclaw#31342)

Merged via squash.

Prepared head SHA: cc12097
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
…penclaw#31342)

Merged via squash.

Prepared head SHA: cc12097
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
dawi369 pushed a commit to dawi369/davis that referenced this pull request Mar 3, 2026
…penclaw#31342)

Merged via squash.

Prepared head SHA: cc12097
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
OWALabuy pushed a commit to kcinzgg/openclaw that referenced this pull request Mar 4, 2026
…penclaw#31342)

Merged via squash.

Prepared head SHA: cc12097
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…penclaw#31342)

Merged via squash.

Prepared head SHA: cc12097
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants