Repository navigation
fix(runtime): attribute destructive close requests - #12238
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughThe daemon kill handler records session ID, immediate-kill status, and authenticated client ID for successful, tolerated, and failed kills. Runtime close tracing covers terminal, terminal-tab, session-tab, and lifecycle-close operations. The changes add device, request, target, outcome, and terminal metadata while excluding bearer credentials. Tests cover close outcomes, concurrent identities, runtime calls, and session inventory behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
18a3105 to
1c84777
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/daemon/daemon-server-kill-attribution.test.ts (1)
34-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover kill completion ordering and the tolerated outcome.
The success mock resolves immediately. The test can pass if
routeRequeststartshost.kill()but emitssession-killedbefore the kill completes. Use a deferred promise. Assert thatsession-killedis absent before resolving it. Then resolve it and assert the success log.Add a test for the tolerated kill condition. Assert its event payload includes
sessionId,immediate, andclientId.Based on PR objectives: this PR requires attribution for successful, tolerated, and failed kill outcomes.
Also applies to: 51-79
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 67c58e81-3c63-43ee-979c-d8c186f5dcae
📒 Files selected for processing (8)
config/reliability-gates.jsoncsrc/main/daemon/daemon-server-kill-attribution.test.tssrc/main/daemon/daemon-server.tssrc/main/runtime/rpc/methods/session-tab-close-methods.tssrc/main/runtime/rpc/methods/terminal.tssrc/main/runtime/rpc/runtime-close-attribution-topology.test.tssrc/main/runtime/rpc/runtime-close-attribution.test.tssrc/main/runtime/rpc/terminal-close-attribution.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- src/main/runtime/rpc/runtime-close-attribution.test.ts
- src/main/runtime/rpc/methods/terminal.ts
- src/main/daemon/daemon-server.ts
- src/main/runtime/rpc/terminal-close-attribution.ts
- src/main/runtime/rpc/methods/session-tab-close-methods.ts
b9a5e81 to
b6fe6d0
Compare
Attribute destructive runtime and daemon close diagnostics to the requesting client and exact target, record outcomes only after completion, and add reliability-gated attribution regressions.
Summary
session-killedonly after kill completion.clientId.main.Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildValidation on exact head
b9a5e813b:mise exec [email protected] -- pnpm exec vitest run --config config/vitest.config.ts src/main/daemon/daemon-server-kill-attribution.test.ts- 3/3 passed.mise exec [email protected] -- pnpm typecheck- Node, CLI, and Web TypeScript passed.mise exec [email protected] -- pnpm check:code-quality:changed- zero new native, type-aware, or React Doctor findings across the changed code.Full
pnpm lint, full repositorypnpm test, andpnpm buildwere not run. No Docker command was run.Hosted status for exact head
b9a5e813b:PR Checksrun 30829700381 -action_required.Computer-use e2erun 30829701308 -action_required.The predecessor head
1c847773bcompleted 48 hosted checks (44 successful and 4 skipped), but those results are not being treated as exact-head CI for the test-only follow-up.AI Review Report
The review compared the focused follow-up with current
main, the closed #8888 branch, and theOrcaWincompletion commit. It checked that the already-shipped close-policy and capability gates were not restored or changed, that existingRpcContext.pairedDeviceIdwas reused instead of adding a duplicate identity field, and that daemon-control identity remained distinct from paired-device credentials.CodeRabbit's follow-up review identified two missing test contracts: completion ordering and the tolerated pending-spawn not-found outcome. Exact-head tests now hold the kill promise unresolved before asserting that no success event exists, and verify that a canceled pending spawn retains
sessionId,immediate, andclientIdattribution without being logged as a failure. Temporary mutations demonstrated that each test fails for its targeted regression.Cross-platform compatibility was reviewed for macOS, Linux, and Windows. The follow-up is test-only and does not alter shortcuts, labels, paths, shell commands, process spawning, Electron platform branches, SSH behavior, or folder-workspace behavior.
Security Audit
The review covered authentication identity, trace serialization, IPC context propagation, secret exposure, input handling, command execution, paths, and dependencies. The bearer credential in
RpcContext.clientIdis never passed to the span helper; close spans use the existing non-sensitivepairedDeviceId, and regression tests scan serialized records to prove the bearer value is absent. The daemonclientIdfield is the local authenticated control-client identity, not the paired-device bearer credential.The change introduces no dependency, command execution, path handling, user-derived input, permission change, or new IPC/schema field. The exact-head follow-up changes tests only. No follow-up security action is currently identified.
Notes
Focused follow-up to #8888 and the residual work identified in its maintainer closeout. The destructive-close incident itself is already fixed on
main; this PR intentionally contains only attribution and forensics improvements.The PR is currently non-draft and MERGEABLE at exact head
b9a5e813b. Its new hosted workflows require maintainer approval before they can run, soUNSTABLEis not being treated as complete required-CI coverage. Build/package, Electron E2E, and real runtime smoke validation were not run locally.