Skip to content

Conversation

@parameja1
Copy link
Contributor

@parameja1 parameja1 commented Aug 5, 2025

Problem

In order to set appropriate Origin Info on LSP side for SMUS CodeEditor, link, clientInfo needs to be distinct and with current logic that uses vscode.env.appName whose value will be same for all sagemaker codeeditor instances

  • The original PR was reverted here due to failing unit tests
  • Unit test failure was due to env variable SERVICE_NAME being modified directly from test code causing failure in other tests which identified the environment to be SMUS without clean isolation
  • Fixed the test failure by using sinon stub instead of modifying env vars in node process

Solution

  • To check if the environment is SageMaker and a Unified Studio instance and set corresponding clientInfo Name which is AmazonQ-For-SMUS-CE

Testing

  • Built artefact locally using npm run compile && npm run package and tested on a SMUS CE space
  • Ran npm run test -w packages/toolkit which succeeded
  • LSP logs are attached to show the respective client Info details
[Trace - 9:55:46 PM] Sending request 'initialize - (0)'.
Params: {
    "processId": 6395,
    "clientInfo": {
        "name": "vscode",
        "version": "1.90.1"
    },
....
"initializationOptions": {
        "aws": {
            "clientInfo": {
                "name": "AmazonQ-For-SMUS-CE",
                "version": "1.90.1",
                "extension": {
                    "name": "AmazonQ-For-VSCode",
.....
  • Tested the debug artefact in SMUS and SMAI spaces

As observed below, the sign out was only disabled for SMUS case initially with this change, a CR followed up which overrode the logic in isSageMaker and returned true for all cases irrespective of the appName passed

SMUS

image

SMAI

image
  • Observing Q sendMessage failure in SMAI CE instance due to missing permissions, again unrelated to this change

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@parameja1 parameja1 requested a review from a team as a code owner August 5, 2025 17:05
@amazon-inspector-ohio
Copy link

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

@amazon-inspector-ohio
Copy link

✅ I finished the code review, and didn't find any security or code quality issues.

@parameja1 parameja1 changed the title Feature/fix smus lsp clientname feat(toolkit): update lsp clientname to support sagemaker unified studio case Aug 5, 2025
@parameja1
Copy link
Contributor Author

Close and open PR to retrigger CI runs

@parameja1 parameja1 closed this Aug 5, 2025
@parameja1 parameja1 reopened this Aug 5, 2025
@amazon-inspector-ohio
Copy link

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

@github-actions
Copy link

github-actions bot commented Aug 5, 2025

  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@amazon-inspector-ohio
Copy link

✅ I finished the code review, and didn't find any security or code quality issues.

…o and fix unit tests

- Revert the revert of LSP client name update for SageMaker Unified Studio
- Fix unit tests to use sinon stubs instead of directly modifying process.env
- Consolidate test cases for better maintainability
@parameja1 parameja1 force-pushed the feature/fix-smus-lsp-clientname branch from e800840 to 8b92f76 Compare August 5, 2025 20:58
@parameja1 parameja1 changed the title feat(toolkit): update lsp clientname to support sagemaker unified studio case feat(amazonq): update lsp clientname to support sagemaker unified studio case Aug 5, 2025
@bywang56 bywang56 merged commit 71a4aef into aws:master Aug 5, 2025
39 of 40 checks passed
laileni-aws added a commit that referenced this pull request Aug 9, 2025
…or agentic chat (#7857)

## Problem
In order to set appropriate Origin Info on LSP side for SMAI CodeEditor,
[link](https://github.com/aws/language-servers/blob/68adf18d7ec46a7ecf9c66fd9d52b1b8f7bc236e/server/aws-lsp-codewhisperer/src/shared/utils.ts#L377),
clientInfo needs to be distinct
- related [PR to support
SMUS](#7817)

## Solution
- To check if the environment is SageMaker and a Unified Studio instance
and set corresponding clientInfo Name which is ```AmazonQ-For-SMUS-CE```

## Testing
- Built artefact locally using ```npm run compile && npm run package```
and tested on a SMAI CE space
- Ran ```npm run test -w packages/toolkit``` which succeeded
- LSP logs show the respective client Info details
```

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time.
- Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

Co-authored-by: Laxman Reddy <[email protected]>
laura-codess pushed a commit to laura-codess/aws-toolkit-vscode that referenced this pull request Aug 11, 2025
…or agentic chat (aws#7857)

## Problem
In order to set appropriate Origin Info on LSP side for SMAI CodeEditor,
[link](https://github.com/aws/language-servers/blob/68adf18d7ec46a7ecf9c66fd9d52b1b8f7bc236e/server/aws-lsp-codewhisperer/src/shared/utils.ts#L377),
clientInfo needs to be distinct
- related [PR to support
SMUS](aws#7817)

## Solution
- To check if the environment is SageMaker and a Unified Studio instance
and set corresponding clientInfo Name which is ```AmazonQ-For-SMUS-CE```

## Testing
- Built artefact locally using ```npm run compile && npm run package```
and tested on a SMAI CE space
- Ran ```npm run test -w packages/toolkit``` which succeeded
- LSP logs show the respective client Info details
```

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time.
- Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

Co-authored-by: Laxman Reddy <[email protected]>
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.

4 participants