← Back to Pull requests

Fix authentication provider cleanup when an extension host stops #345127

Closed
unknown closed this pull request without merging on Nov 09, 2026 16:32 UTC
View on GitHub
unknown unknown commented on Oct 30, 2026 05:37 UTC
Author

Related to #343316.

Authentication providers can remain in AuthenticationService after their owning MainThreadAuthentication customer is disposed, leaving discovery to reuse a provider backed by the old RPC proxy. The customer already is disposed when its extension host stops; the missing cleanup is the service's independent provider registration.

Provider deregistration now belongs to the registration's disposer, so both explicit unregistration and customer disposal use the same cleanup. External unregistration also releases the local registration, and cleanup suppresses only the owning host's unregister echo.

The focused regression tests check that disposal deregisters the provider without additional client-registration writes. The RPCProtocol test models the manager's teardown order, verifies cancellation through the old proxy, and checks that a fresh host can register with the same authentication service. Three additional tests cover explicit unregistration, external unregistration followed by registration on another host and teardown of the old host, and notifications to surviving hosts.

Earlier validation for ecaef8a5b708092acb0dff35fc8ea3323aa81d5f passed in this isolated fork run: changed-file hygiene and ESLint, full client typecheck/transpilation, and the official Electron suites (12 MainThreadAuthentication tests and 24 AuthenticationService tests, plus one clean-state harness check per invocation; JUnit totals 13 and 25, no failures/errors/skips).

The same RPC regression was then run with only the production mainThreadAuthentication.ts replaced by its unpatched version from cd2259bdf72ec7421e70ae80999ceb46f8bd86fe. It failed at provider discovery: actual dynamic-provider, expected undefined, after the real cancellation assertion had passed. Logs and JUnit artifact. The validation workflow stays on a separate fork branch, not in this PR.

This establishes the component-level lifecycle defect, not the original live Datadog OAuth/Add Folder to Workspace scenario. I have not reproduced that end-to-end flow or confirmed this resolves all of #343316.

The official Electron suites and client typecheck have not been rerun for revision e5886065e6ebcff0e1a712c49407c23233b71b61.

Diff: 302 lines (+226 / -76) across 3 files Reviewer: wozhenbang2004 Review duration: 15054m
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.63) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 302 lines diff across 3 files
0.63
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.342
Shallow Review Depth shallow_review_depth
0.289
Sensitive Paths sensitive_paths
0.063
Real PR Conversation Timeline
1 comments
"Review active on #345127"
general weight: 0.35
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed sensitive_module
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 63.3% (MEDIUM) · Higher = larger blast radius
63.3%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 27.4% · Safe to merge
27.4%