Skip to content

fix(windows): fail closed on unknown PTY identity - #10674

Merged
AmethystLiang merged 2 commits into
mainfrom
fix-windows-taskkill-identity
Jul 26, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
fix-windows-taskkill-identity

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary

Windows PTY tree teardown now authorizes taskkill /T /F only when the live verifier returns exactly own and the caller still owns the PTY root. unknown, including unavailable, rejected, timed-out, or ambiguous process probes, fails closed for tree-kill authorization; foreign and absent also skip tree-kill. The existing killRoot path still runs in finally, so root teardown is preserved even when identity evidence is unavailable or taskkill races an exited tree.

Tests

  • pnpm exec vitest run --config config/vitest.config.ts src/main/pty-descendant-termination.test.ts src/main/windows-pty-root-identity.test.ts (56 passed)
  • pnpm exec oxlint --quiet src/main/pty-descendant-termination.ts src/main/pty-descendant-termination.test.ts src/main/windows-pty-root-identity.ts src/main/windows-pty-root-identity.test.ts

Accepted residuals

  • A PID reused by another process inside the same Orca subtree remains indistinguishable from the intended PTY root and can still classify as own.
  • The verify-to-taskkill check remains subject to a race; immutable creation identity or a retained process handle/Job Object would be needed to close it fully.
  • The SSH relay has a separate teardown implementation and is unchanged.
  • Live Windows/WSL smoke coverage is still missing in this environment.

Release scan

The local finding is recorded in /private/tmp/prod-release-worker-reports/platform.md (also summarized in /private/tmp/prod-release-worker-reports/FINAL.md); the internal report is not uploaded. This change addresses the fail-open portion of the finding introduced by #10100 and #10339, following the partial identity guard in #10484.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8cb8da5e-a875-4ba0-adef-bcd7e954a585

📥 Commits

Reviewing files that changed from the base of the PR and between 3e7c32a and 6589e0b.

📒 Files selected for processing (5)
  • src/main/daemon/terminal-session-teardown.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/pty-descendant-termination.ts
  • src/main/windows-pty-root-identity.test.ts
  • src/main/windows-pty-root-identity.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/windows-pty-root-identity.ts
  • src/main/windows-pty-root-identity.test.ts

📝 Walkthrough

Walkthrough

Windows PTY descendant sweeping now requires an own identity result and root ownership before invoking process-tree termination. Unknown identity results and verification errors skip tree termination while still terminating the root. Tests and documentation were updated for these semantics, including classification of descendants whose ancestry matches the PTY root.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and testing, but omits required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections, especially Screenshots, AI Review Report, Security Audit, and Notes, and briefly summarize cross-platform review and follow-up risks.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main change: Windows PTY teardown now fails closed on unknown identity.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Only taskkill when the identity probe returns `own`; skip tree-kill for
`unknown`/`foreign`/`absent` to avoid terminating unrelated processes.
Clarifies the fail-closed behavior across agent and plain shell teardown
paths, matching the POSIX descendant-snapshot discipline.
@AmethystLiang
AmethystLiang merged commit 8cb4531 into main Jul 26, 2026
8 checks passed
bbingz added a commit to bbingz/orca that referenced this pull request Aug 5, 2026
Drop redundant Windows root-identity plumbing already covered by
upstream stablyai#10484/stablyai#10674, document Job Object as the primary reaper with
identity-gated taskkill as fallback, guard Apple/OpenBSD spawn helpers
to avoid unused-function -Werror noise, and regenerate the node-pty
patch so it applies cleanly to 1.1.0.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(windows): fail closed on unknown PTY identity

* Gate Windows tree-kill on PTY identity verification

Only taskkill when the identity probe returns `own`; skip tree-kill for
`unknown`/`foreign`/`absent` to avoid terminating unrelated processes.
Clarifies the fail-closed behavior across agent and plain shell teardown
paths, matching the POSIX descendant-snapshot discipline.
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.

1 participant