Repository navigation
Conversation
Follow up #2199 and #2183. Replace invalid cross-process WM_PRINT DC delivery with PrintWindow in one owned, deadline- and memory-bounded helper. Return metadata summaries by default through MCP with explicit retained image reads. Verified actual pixels through CLI and MCP on Windows x64, including a non-elevated desktop, live redraws, PNG capacity refusal and retry, and target identity rejection. Final expanded acceptance and CI results are recorded in the pull request.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61b6408bb7
ℹ️ 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".
[High impact] Adds Windows native window capture through new addon code. Fix session-level readiness recovery before merging so a temporary native check failure does not permanently disable captures. Findings
Fix with agent prompt### Issue 1
src/windows/NativeWindowsUiProviderMetadata.ts:26
If the first native check fails temporarily, `nativeWindowsUiCapabilities` now returns `available: false`, and composition saves that result in `LazyAnalysisProvider`. Every later capture is rejected by `prepareSessionExecution` before the loader can retry. Fixing temporary-directory access or reopening the target does not refresh the saved result, so captures remain disabled for the session.
Keep admission fail-closed, but refresh retryable readiness before rejecting later calls. The new test calls the factory again; the session does not.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds selected-window screenshots for Windows PE applications through an owned, bounded helper.
The three earlier unnumbered threads are addressed: native capture refuses changed bounds, the helper receives the selected environment, and requests travel through stdin rather than arguments. None requires a numbered previous-finding entry. Review used source inspection; no runtime tests were executed. Checking for a superseding PR was blocked because GitHub authentication was unavailable. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Create session] --> B[Check native capture readiness]
B -->|Success| C[Save available capability]
B -->|Retryable failure| D[Save unavailable capability]
C --> E[Capture request]
E --> F[Owned helper checks identity and captures PNG]
F --> G[Retain frame and return summary]
D --> H[Later capture request]
H --> I[Execution gate rejects request]
I -. Retry loader is never reached .-> D
Reviews (5) · Last reviewed commit: "fix(windows): preserve unresolved readin..." · Reviewed by Greptile |
Send bounded UTF-8 requests through supervised stdin rather than expanded Windows command lines. Carry the selected provider environment to the helper and reject changed client dimensions after rendering. Update the effects audit and test real command input delivery, blocked readers, early close, long request encoding and provider environment propagation. Real Windows non-admin CLI/MCP and Character Map validation passed for the stdin transport.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb9df948cc
ℹ️ 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".
Reject malformed IHDR lengths and high-bit chunk names instead of interpreting them through lossy ASCII decoding. Reproduced both false accepts before the change; focused parser, capture and delivery checks pass after sharing the existing byte-level header owner.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62a20fff19
ℹ️ 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".
Keep filesystem and owned-process admission in the parent. The supervised worker verifies artifact identity and the in-memory capture facet without probing its selected temporary directory. Reproduced failure with TEMP and TMP pointing to a source-owned file before the fix. The updated packed runtime passes that real Windows non-admin case plus the full CLI/MCP and Character Map matrix. One earlier Character Map CLI failure lacked exit diagnostics; unchanged-artifact retry passed, with the unexplained attempt retained in verification notes.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dcccb4fca7
ℹ️ 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".
Do not report a retryable failed capture admission as available. A fresh capability declaration must observe actual admission success. Report combined window resources when closing a session, preserving helper and executable cleanup observations without assigning the wrong owner. Both regressions fail before the change. Focused provider, loader, helper and lazy-client checks pass after the fixes.
| ): readonly CapabilityDescriptor[] => { | ||
| const loaded = | ||
| platform === "win32" && architecture === "x64" ? load() : undefined; | ||
| const captureReady = loaded?.available === true; |
There was a problem hiding this comment.
Captures stay disabled after recovery
If the first native check fails temporarily, nativeWindowsUiCapabilities now returns available: false, and composition saves that result in LazyAnalysisProvider. Every later capture is rejected by prepareSessionExecution before the loader can retry. Fixing temporary-directory access or reopening the target does not refresh the saved result, so captures remain disabled for the session.
Keep admission fail-closed, but refresh retryable readiness before rejecting later calls. The new test calls the factory again; the session does not.
Knowledge Base Used: Native runtime and bridges
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/windows/NativeWindowsUiProviderMetadata.ts
Line: 26
Comment:
**Captures stay disabled after recovery**
If the first native check fails temporarily, `nativeWindowsUiCapabilities` now returns `available: false`, and composition saves that result in `LazyAnalysisProvider`. Every later capture is rejected by `prepareSessionExecution` before the loader can retry. Fixing temporary-directory access or reopening the target does not refresh the saved result, so captures remain disabled for the session.
Keep admission fail-closed, but refresh retryable readiness before rejecting later calls. The new test calls the factory again; the session does not.
**Knowledge Base Used:** [Native runtime and bridges](https://app.greptile.com/pre/-/custom-context/knowledge-base/morluto/rea/-/docs/native-runtime-and-bridges.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 283292edda
ℹ️ 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".
| }, | ||
| { | ||
| identity: NATIVE_WINDOWS_UI_PROVIDER_IDENTITY, | ||
| capabilities: nativeWindowsUiCapabilities(platform), |
There was a problem hiding this comment.
Re-probe retryable capture readiness before execution
If the initial native inspection fails transiently—for example while the temporary directory is briefly unavailable—this stores an unavailable descriptor for the lifetime of the CLI/MCP composition. prepareSessionExecution rejects unavailable descriptors before loading the provider, so systemWindowsWindowCaptureAuthority() is never queried again and its explicit retryable-cache path cannot recover after the condition clears. Refresh this descriptor or defer retryable admission so a later request can observe current readiness.
AGENTS.md reference: AGENTS.md:L46-L48
Useful? React with 👍 / 👎.
baron
left a comment
There was a problem hiding this comment.
Reviewed pinned head 283292eddac84ea5d4a044d44bac42df96ac4a4d; holding approval.
This is not just static inspection: PrintWindow invokes the selected target's paint handler, with possible target UI/filesystem/network effects. Killing the owned helper does not establish cancellation of target-side paint work. The PR correctly declares those effects, but its scope section records a claimed maintainer decision without linking the actual decision covering this final workflow. Linked #2183 and #2199 could not be retrieved through REST/GraphQL during this review (their comment endpoints remain readable); the accessible issue comments did not establish that decision. Please provide the traceable maintainer issue/design decision covering the final PrintWindow workflow, including that target/helper cancellation distinction, before integration. I have not treated CI or an implementation claim as authority approval.
The existing retryable readiness finding also remains valid at this head: composition freezes an unavailable capability in LazyAnalysisProvider, while prepareSessionExecution rejects it before the loader can retry. Reopening the target does not reconstruct that provider declaration. Keep fail-closed admission but refresh readiness at its owner; calling the capability factory again only in a test does not exercise session recovery. No duplicate inline finding added.
All 41 emitted current-head checks are successful, including the Windows capability/package lane. That does not resolve either hold. Stopped further implementation-level investigation at this material authority/verification gate. No target/provider execution, installation, builds, or local tests were performed; the reported real Windows matrix and blocked-paint cancellation coverage were not independently verified.
|
@N0zoM1z0 thanks for the PR — there are 2 open review threads here:
Could you address or reply to these? Once they're resolved and CI is green we can take another look. |
|
@N0zoM1z0 also, this branch has merge conflicts with |
Summary
Fixes #2183. Continues the implementation from #2199 by @SoGeRiEn, with real Windows validation and corrections to rendering, resource ownership and delivery.
Problem and expected behavior
The original raw
SendMessageTimeout(WM_PRINT)cross-process HDC was invalid in the target: the fixture observedGetObjectType=0,FillRect=0, Win32 error 6. It returned a valid all-black PNG and DPI-scaled dimensions. The new workflow must return pixels from the exact selected PE application's client area, preserve identity and fail within a bounded helper lifetime.Change and scope
PrintWindow(PW_CLIENTONLY)inside one owned Windows Job Object helper, with a 5 s deadline, 64 MiB JavaScript heap and 256 MiB job commit limit. Reuse process supervision and retained cleanup owners.detail: completereturn full Evidence. Captures remain live; stable native admission is cached, frames are not reused for a new capture.Maintainer scope decision: @N0zoM1z0, the human owner and maintainer, explicitly selected this narrow feature from #2183 and authorized implementation, testing, PR and merge. This PR records that decision and the declared target-paint effects. No desktop selection, window enumeration, input, target launch or elevation is exposed.
Contract and boundary impact
capture_windows_window_screenshot; retained image view:windows-window/screenshot.PrintWindowcan execute existing target paint code and cause target UI/filesystem/network effects; effect metadata and limitations report this. Only the owned helper is terminated on timeout/cancellation. Failed cleanup keeps its owner for retry.Evidence and regression coverage
Executed on a real Windows x64 interactive desktop, including a non-elevated, non-administrator token:
Coverage limits: the new post-render bounds check refuses resizing, but the resize race was not deterministically forced locally. These runs do not prove complete rendering for GPU/protected/minimized/elevated windows or physical-display contents. ANSI capture passed; this host did not reproduce the documented DBCS length overestimate. Cancellation verifies a request written to the transport, not an observed blocked paint handler. Fresh Windows npm installs timed out during setup; the local packaged-runtime runs used unchanged packed CLI/MCP/helper/native leaves with reused dependencies whose versions match the lockfile. They are not fresh-install verification. CI separately exercises the complete built checkout and native artifact.
Observed noisy-frame MCP summary excerpt (other Evidence fields omitted):
{"normalized_result":{"kind":"summary","summary":{"screenshot":{"width":512,"height":512,"bytes":793362}}}}Reading its
parent_evidence_idwithinspect_analysis_viewandview: {"kind":"windows-window","facet":"screenshot"}returns the retained PNG without another capture.Review follow-up and CI
bb9df948csends a bounded UTF-8 JSON request over supervised stdin, passes the provider's selected environment, requires native protocol-stdin support, and refuses dimensions changed during rendering. Regressions cover a request larger than the Windows command-line limit, real input delivery, blocked-reader timeout, early-close cleanup and the complete provider environment path. The final packed runtime/native artifact passed the non-admin Windows matrix again.First CI run: Windows GUI/package and all other selected lanes passed. Source tests failed because this PR omitted the new tool from the destructive-effects audit's expected list; the Portable tests aggregate reported that same failure. The list is corrected and its six checks pass locally. The corrected
62a20fff1CI run passed every selected lane. Current-head CI is rerunning after the additional worker-admission fix below.62a20fff1removes the duplicate PNG-header interpretation and usesreadPngHeaderDimensions. Both malformed IHDR-length and high-bit chunk-type cases were accepted before the fix and rejected afterward; 40 focused parser/provider/delivery checks pass.dcccb4fcakeeps full filesystem/process admission in the parent and validates only the artifact/capture facet inside the supervised worker. A real Windows TEMP/TMP-is-a-file case failed before this change and passes afterward; the new case is in the Windows CI verifier. The complete non-admin GUI/CLI/MCP/Character Map matrix passed with the new packed runtime. One earlier Character Map CLI attempt failed before exit diagnostics were retained; an unchanged-artifact retry with added diagnostics passed. Its cause remains unknown and is not classified as an infrastructure failure or a fixed product bug.283292eddpreserves failed readiness even when retryable, and reports session-close cleanup under combined selected-window resources. Both regressions failed before the change; 54 focused provider/loader/helper/lazy-client checks pass afterward. Capability declarations remain snapshots: a fresh declaration reports availability only after actual admission succeeds.Validation performed
npm run check:fast— passed on the updated main base.npm run test:local --eight relevant source files — 127 passed initially; 53 focused follow-up checks passed (overlapping existing cases).npm run test:focused --CLI/MCP/runtime bundle boundaries — 5 passed; follow-up stdin/MCP checks passed 20 tests (18 owned-command, 2 MCP).npm run build:windows-nativeandnpm run verify:windows-native:artifact— passed.npm run docs:check— passed, including 5 README consistency tests.npm run verify:test-discovery— 1,355 files discovered exactly once.npm run knip, changed-file formatting andgit diff --check— passed.Compatibility, safety, and release
Additive capability; no migration. Output limits: 4,194,304 source pixels, maximum dimension 4,096 (default 2,048), retained PNG 3 MiB. Incomplete painting remains an explicit limitation. Screenshots and titles can contain application data and are retained through existing Evidence/session semantics. Local measurements use bounded CPU affinity and helper memory controls.
Author readiness
Human owner: @N0zoM1z0
The owner explicitly authorized recording these declarations on their behalf for this work.
Before merge
type(scope): outcome.