Note
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
- Last reviewed commit: b1098a9176c5e1bd6a73c52b24d8a023f5471a3b
- Latest commit, not reviewed: 4f6b29158165cbfee2133e543f2f541c0a327490
Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.
Use the checkboxes below for quick actions:
- Resume reviews
- Trigger review
No actionable comments were generated in the recent review.
Walkthrough
-
The macOS window lookup now sends its JavaScript source to
osascriptthrough stdin instead of an inline-eargument. Tests verify script delivery and process failure handling.Changes: macOS Snapshot lookup
Layer / File(s) Summary Run and test the lookup through stdin
apps/desktop/src/snapShot/ActiveWindow.ts,apps/desktop/src/snapShot/ActiveWindow.test.tsrunMacLookuppasses the script through stdin and ignores stdin write errors. Tests verify the command arguments, script delivery, stdin termination, and rejection whenosascriptexits after a stdin error.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- pingdotgg/t3code#22624: Both PRs change the macOS
ActiveWindowlookup. This PR changes script transport; PR#22624changes JXA results and window selection. - pingdotgg/t3code#24572: Both PRs change the same lookup implementation. This PR changes script transport; PR
#24572changes window-owner matching for invalid PIDs.
Suggested reviewers:
t3dotgg - pingdotgg/t3code#22624: Both PRs change the macOS
Merge Risk: Minimal · previous review b1098
-
The lookup preserves process-error propagation, timeout, and buffer handling; native macOS validation remains advisable but is not an established merge blocker.
Security architecture risk: Low · up to 554e8
-
The lookup still executes the same fixed script with no added privileges or caller-supplied code. The change is narrow, but its interaction with managed-device security policies has not been independently verified.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The changed execution path remains bounded to desktop macOS window metadata lookup. Successful execution can expose the same window title, bounds, application identity, process identifier, and application path as before; the inspected change adds no new data destination.
Trust Boundaries and Controls
- observed — The child executable remains the absolute path /usr/bin/osascript, invoked through execFile without a shell. Script text is a fixed constant rather than caller input; window metadata is collected as data and JSON-encoded, not interpolated into executable source.
Resilience and Maintainability Implications
- inferred — Each lookup owns its child process and stdin, with no shared mutable or persistent state introduced. Repetition and concurrency do not introduce shared-state ordering requirements in this helper; process failure remains bounded by the existing callback and timeout rather than requiring rollback.
-
Pre-merge checks: 4
-
Check name Status Explanation Title check The title clearly and concisely describes the main change: making desktop snapshot window lookup survive endpoint security agents. It follows the repository's conventional commit style. Linked Issues check Issue [ #21747] requires the macOS window lookup to avoid the inline-escript that endpoint security agents kill. Whole-PR diff (merge base to head) forapps/desktop/src/snapShot/ActiveWindow.tss…Out of Scope Changes check The whole-PR diff for the inspected paths touches only apps/desktop/src/snapShot/ActiveWindow.tsandapps/desktop/src/snapShot/ActiveWindow.test.ts. TheActiveWindow.tschange is the stdin trans…Description check The description includes all required sections. It explains the problem and expected behavior, describes the change and scope, and gives focused test and manual verification results. Full details: Linked Issues check
-
Explanation
Issue [
#21747] requires the macOS window lookup to avoid the inline-escript that endpoint security agents kill. Whole-PR diff (merge base to head) forapps/desktop/src/snapShot/ActiveWindow.tsshowsrunMacLookup()now calls/usr/bin/osascriptwith["-l", "JavaScript", "-"]and writesMAC_LOOKUP_SCRIPTthroughchild.stdin?.end(...). The-eargument is removed from this path. Timeout (MAC_LOOKUP_TIMEOUT_MS),maxBuffer(1 MiB) and the error and resolve callback are unchanged. Since the previous review, the head addschild.stdin?.on("error", () => undefined), so a broken-pipe write does not raise an unhandled error. TheexecFilecallback still reports the process exit.ActiveWindow.test.tsasserts the exact arguments["-l", "JavaScript", "-"], asserts onestdin.endcall containingCGWindowListCopyWindowInfo, and adds a case wherestdinemitsEPIPEand the process failure is rejected. These tests cover the stdin requirement. The modifier-pair poller is not part of this requirement and is unchanged. Limit: the native behavior (SIGKILL avoidance on a managed Mac in a packaged build) is not verifiable from repository tests. The reported measurements in the PR description support it but are not reproduced here. Coding requirement is met at code and unit-test level.
Full details: Out of Scope Changes check
-
Explanation
The whole-PR diff for the inspected paths touches only
apps/desktop/src/snapShot/ActiveWindow.tsandapps/desktop/src/snapShot/ActiveWindow.test.ts. TheActiveWindow.tschange is the stdin transport for the macOS lookup, the stdin error handler, and a code comment. Each directly implements [#21747]. TheActiveWindow.test.tschanges are supporting test changes: the stdin argument and write assertions, thestdinfake instubMacLookup, the EPIPE failure-path test, and avi.mockof../electron/WindowsForeground.ts. TheWindowsForegroundmock is not tied to the lookup change. Its purpose is unclear from the diff alone. It is test setup only and does not change runtime behavior, so it is not a demonstrated unrelated change. The raw summary lists no other changed files. The file list was truncated, so the full set of changed paths was not confirmed.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: ce9e016
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4176e7ac-7fd5-409b-ab1d-1aac6563e487
Commits
-
Reviewing files that changed from the base of the PR and between c4f2ec3a0052853dbed5cd062401291d12ca58b0 and b1098a9176c5e1bd6a73c52b24d8a023f5471a3b.
Files selected for processing: 2
-
apps/desktop/src/snapShot/ActiveWindow.test.tsapps/desktop/src/snapShot/ActiveWindow.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Recent review info
-
Run configuration
-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: ce9e016
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4176e7ac-7fd5-409b-ab1d-1aac6563e487
Commits
-
Reviewing files that changed from the base of the PR and between c4f2ec3a0052853dbed5cd062401291d12ca58b0 and b1098a9176c5e1bd6a73c52b24d8a023f5471a3b.
Files selected for processing: 2
-
apps/desktop/src/snapShot/ActiveWindow.test.tsapps/desktop/src/snapShot/ActiveWindow.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-