You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Register consumer handlers before client startup and clean partial, failed, retired, and cancelled setup without changing restart scheduling. Keep hook resources separate from pre-stop state listeners.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 85ef72cc-9e26-4bc4-b1c3-55256d9bef91
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Environment overrides can fail to remove inherited variables after the language-client merge, and Windows case-insensitive aliases can cause inherited values to override replacements.
Adds opt-in lifecycle hooks to the shared TypeScript runtime so tool extensions can customize launch environments and register client handlers without replacing lifecycle management.
Changes:
Adds per-launch environment patches and synchronous pre-start client configuration.
Tracks hook disposables across replacement, failure, and shutdown.
Documents the APIs and adds lifecycle, environment, and type-check coverage.
File
Description
typescript/tests/toolExtension.typecheck.ts
Checks hook types and rejects async setup callbacks.
typescript/tests/toolExtension.test.ts
Tests hook execution and generation cleanup.
typescript/tests/server.test.ts
Tests environment precedence, setup failures, and cancellation.
typescript/tests/activation.test.ts
Checks cleanup when the interpreter is cleared.
typescript/tests/_languageclient_mock.ts
Adds notification registration and simulation.
typescript/src/toolExtension.ts
Accepts and forwards optional hooks.
typescript/src/server.ts
Implements environment patches and client setup ownership.
typescript/src/index.ts
Exports the public hook types.
typescript/src/activation.ts
Integrates setup retirement and shutdown cancellation.
Verification: Automated verification is best effort. The PR author remains responsible for testing.
Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "c5d588b17c674aebef0aff78c260127b95ad3613c6573f6091d7f84dd2649fc9": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found
Update and remove matching inherited aliases without creating competing casing, preserve other platforms and environment layering, and verify actual executable child environments.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 85ef72cc-9e26-4bc4-b1c3-55256d9bef91
Acknowledged the automated-review ownership notice. I have not changed ownership or the review automation. The actionable environment feedback has been investigated and answered on its review threads, with the Windows alias fix pushed as 2a58e1f.
Regarding the container verification report: this is a Podman/container startup failure before any tests ran, not a failing test in this PR. I have not changed or bypassed reviewer infrastructure; its owner can rerun verification once the container issue is repaired.
Independently verified updated head 2a58e1f locally with Node 24.17.0: all 187 TypeScript tests, build, source/test lint and whitespace checks pass (existing lint warnings only), including real executable child-environment checks.
Thanks for the approval. A follow-up to the Windows casing recommendation is now pushed as 2a58e1f; it preserves case-sensitive behavior elsewhere and adds executable child-environment regressions. All 187 tests, build and lint pass (existing warnings only).
Regarding the Copilot review summary: Windows inherited-name matching is fixed in 2a58e1f, with mixed-case replacement/removal and env-file reintroduction tests. The reported general environment remerge does not apply to the pinned 8.1.0 executable transport; I verified its actual transport method launches a child without a deleted inherited sentinel. Details are answered on both inline threads.
All 187 TypeScript tests, build, source/test lint and whitespace checks pass (existing lint warnings only).
Reconcile removal aliases with later env-file and static values before executable spawn. Preserve the concurrent explicit-undefined representation while validating actual child behavior and case-sensitive matching elsewhere.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 85ef72cc-9e26-4bc4-b1c3-55256d9bef91
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
On Windows, a defined hook environment value can defeat a later differently cased override, causing the child process to receive the wrong value.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Case-insensitive env overrides leave defined Windows aliases in conflict
typescript/src/server.ts:231
On Windows, this only reconciles undefined aliases, so a defined hook value can defeat a later env-file or static override. For example, a hook returning { TOOL_FLAG: 'hook' } followed by extraEnvVars: { tool_flag: 'static' } leaves both spellings defined, and Node selects the lexicographically first alias, passing 'hook' to the child. Apply later environment layers case-insensitively to all matching aliases while preserving PATH/PYTHONPATH merging, and add a regression for a defined hook value followed by a differently cased override.
Regarding the latest review's defined-value Windows alias concern: this is a real limitation. I checked the pre-S7 base (85155e2): env-file and static assignments already use exact property names, so the same conflict can occur without hooks when the defined value is inherited. The current fix addresses hook replacement/removal and undefined-alias reintroduction; it does not claim to make all later environment layers case-insensitive.
I am deferring the broader request rather than expanding this lifecycle-hook PR into a Windows environment-assembly rewrite through another review round. A separate stacked PR should define case-insensitive precedence across inherited, hook, env-file, built-in and static layers; preserve PATH/PYTHONPATH append semantics; and characterize no-hook behavior with native Windows regressions. That follow-up needs the author's approval before creation. No additional code change is made for this review summary; the tested head remains e7e7875 (187 passing tests, build and lint passing with existing warnings).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debtCode Cleanup, Refactorings and Repo health. Not feature relatedreview-auto:approvedAutomated review: no blocking findings (approval posted).
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
npm test(TypeScript compilation and 183 tests passed)