Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cody: Reduce scroll threshold for auto scroll #39

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

umpox
Copy link
Contributor

@umpox umpox commented Jul 10, 2023

Description

To give a typing feel, we reduced streaming intervals between character chunks in this PR

We should also adjust this scroll threshold, as it is now more likely that a new chunk will come in while a user scrolls, and move them back to the bottom of the threshold.

@umpox umpox requested review from a team July 10, 2023 16:27
@umpox umpox merged commit 7fcdb53 into main Jul 10, 2023
@umpox umpox deleted the tr/halve-scroll-threshold branch July 10, 2023 16:54
valerybugakov pushed a commit that referenced this pull request Nov 28, 2024
Backports keep giving an error about not finding the right team, testing
to see if it's a lint issue
abeatrix added a commit that referenced this pull request Dec 16, 2024
)

FIX https://linear.app/sourcegraph/issue/CODY-4529

# Fix Deep Cody Rate Limiter Reset Logic

This PR fixes an issue where users were unable to use Deep Cody even
after the 24-hour cooldown period had elapsed.

## Changes

- Added explicit 24-hour reset check in
`DeepCodyRateLimiter.isAtLimit()`
- Simplified quota replenishment logic
- Improved handling of initial quota state

## Technical Details

Previously, the rate limiter used a continuous time-based quota
replenishment system that calculated partial quotas based on elapsed
time. This led to unexpected behavior where users wouldn't get a
fresh quota even after not using Deep Cody for over 24 hours.

The updated implementation:
1. First checks if a full day (24 hours) has passed since last usage
2. If yes, immediately resets to full quota
3. If no, calculates remaining quota using time-based replenishment


## Test plan



Added new test case resets quota after 24 hours of non-use that
specifically tests the 24-hour reset functionality
Test verifies that:

- When last use was 25 hours ago (>24h)
- With an empty quota (0)
- The limiter resets to full quota (50)
- Confirms the storage is updated with new quota and timestamp

Maintained all existing test cases to ensure no regressions
Uses the same test infrastructure (mocks, beforeEach setup)

## Changelog


 <br> Backport 34d5e74 from #6366

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Dec 16, 2024
FIX https://linear.app/sourcegraph/issue/CODY-4529

# Fix Deep Cody Rate Limiter Reset Logic

This PR fixes an issue where users were unable to use Deep Cody even
after the 24-hour cooldown period had elapsed.

## Changes

- Added explicit 24-hour reset check in
`DeepCodyRateLimiter.isAtLimit()`
- Simplified quota replenishment logic
- Improved handling of initial quota state

## Technical Details

Previously, the rate limiter used a continuous time-based quota
replenishment system that calculated partial quotas based on elapsed
time. This led to unexpected behavior where users wouldn&#39;t get a
fresh quota even after not using Deep Cody for over 24 hours.

The updated implementation:
1. First checks if a full day (24 hours) has passed since last usage
2. If yes, immediately resets to full quota
3. If no, calculates remaining quota using time-based replenishment


## Test plan



Added new test case resets quota after 24 hours of non-use that
specifically tests the 24-hour reset functionality
Test verifies that:

- When last use was 25 hours ago (&gt;24h)
- With an empty quota (0)
- The limiter resets to full quota (50)
- Confirms the storage is updated with new quota and timestamp

Maintained all existing test cases to ensure no regressions
Uses the same test infrastructure (mocks, beforeEach setup)

## Changelog


 <br> Backport 34d5e74 from #6366

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Dec 17, 2024
…n issue (#6378)

Follow up on #6366

This PR fixes several issues with the Deep Cody rate limiter
implementation:

Root Cause Fix: Rate Limit State Synchronization

- Fixed race condition in LocalStorageProvider.ts where concurrent
Promise.all() usage led to inconsistent state between quota and
timestamp storage
- Changed to sequential storage operations to ensure timestamp is always
saved after quota update
- This resolves the core issue where users were locked out due to
incorrect time calculations (CODY-4529)

## Test plan



- Added precise tests for time-based quota calculations
- Enhanced test coverage for various timing scenarios

Before this change, the Deep Cody rate limit error would always return
the &quot;Retry time&quot; with current time + 24 hours to indicate the
current time is being used as the last used time.

Submitted at 6:44


![image](https://github.com/user-attachments/assets/d9b50ff8-bc09-473b-a387-497d1ccbe0c2)

Submitted again at 6:45


![image](https://github.com/user-attachments/assets/e1b0266b-cfbc-40f8-807b-a9d4c93be682)

After this change, the &quot;Retry Time&quot; should stick with the last
used time until it&#39;s been reset after 24 hours.

## Changelog


 <br> Backport a7339ef from #6377

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Dec 17, 2024
…ue (#6379)

Follow up on #6366

This PR fixes several issues with the Deep Cody rate limiter
implementation:

Root Cause Fix: Rate Limit State Synchronization

- Fixed race condition in LocalStorageProvider.ts where concurrent
Promise.all() usage led to inconsistent state between quota and
timestamp storage
- Changed to sequential storage operations to ensure timestamp is always
saved after quota update
- This resolves the core issue where users were locked out due to
incorrect time calculations (CODY-4529)

## Test plan



- Added precise tests for time-based quota calculations
- Enhanced test coverage for various timing scenarios

Before this change, the Deep Cody rate limit error would always return
the &quot;Retry time&quot; with current time + 24 hours to indicate the
current time is being used as the last used time.

Submitted at 6:44


![image](https://github.com/user-attachments/assets/d9b50ff8-bc09-473b-a387-497d1ccbe0c2)

Submitted again at 6:45


![image](https://github.com/user-attachments/assets/e1b0266b-cfbc-40f8-807b-a9d4c93be682)

After this change, the &quot;Retry Time&quot; should stick with the last
used time until it&#39;s been reset after 24 hours.

## Changelog


 <br> Backport a7339ef from #6377

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Dec 17, 2024
CLOSE
https://linear.app/sourcegraph/issue/CODY-4533/layout-bug-in-prompts-tab-and-new-user-menu-ui


![image](https://github.com/user-attachments/assets/a7d5fe5c-2635-47f1-8ffa-00c781287f62)

Fix UserMenu dropdown appearing underneath PromptList search box
The UserMenu dropdown and PromptList search box were competing for
z-index positioning since both had z-index: 1. Because PromptList was
rendered after UserMenu in the DOM order, it would appear on top of the
UserMenu dropdown when opened.

This fix increases UserMenu&#39;s z-index to 2, ensuring it properly
stacks above the PromptList search box while maintaining both
components&#39; ability to overlay their respective underlying content.

Changes

- Updated UserMenu dropdown z-index from 1 to 2 to create proper
stacking hierarchy
- Maintains existing stacking contexts for both components

## Test plan



After


![image](https://github.com/user-attachments/assets/9341c4cf-b90c-4e28-806e-5c6ce15d69ab)

1. Open Cody sidebar
2. Navigate to Prompts tab
3. Click on user avatar to open UserMenu dropdown
4. Verify UserMenu dropdown appears above the PromptList search box
5. Verify PromptList search box still properly overlays its content when
scrolling
6. Verify UserMenu dropdown properly overlays all other UI elements


## Changelog


 <br> Backport 03dbec6 from #6380

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Dec 17, 2024
…#6393)

CLOSE
https://linear.app/sourcegraph/issue/CODY-4533/layout-bug-in-prompts-tab-and-new-user-menu-ui


![image](https://github.com/user-attachments/assets/a7d5fe5c-2635-47f1-8ffa-00c781287f62)

Fix UserMenu dropdown appearing underneath PromptList search box
The UserMenu dropdown and PromptList search box were competing for
z-index positioning since both had z-index: 1. Because PromptList was
rendered after UserMenu in the DOM order, it would appear on top of the
UserMenu dropdown when opened.

This fix increases UserMenu&#39;s z-index to 2, ensuring it properly
stacks above the PromptList search box while maintaining both
components&#39; ability to overlay their respective underlying content.

Changes

- Updated UserMenu dropdown z-index from 1 to 2 to create proper
stacking hierarchy
- Maintains existing stacking contexts for both components

## Test plan



After


![image](https://github.com/user-attachments/assets/9341c4cf-b90c-4e28-806e-5c6ce15d69ab)

1. Open Cody sidebar
2. Navigate to Prompts tab
3. Click on user avatar to open UserMenu dropdown
4. Verify UserMenu dropdown appears above the PromptList search box
5. Verify PromptList search box still properly overlays its content when
scrolling
6. Verify UserMenu dropdown properly overlays all other UI elements


## Changelog


 <br> Backport 03dbec6 from #6380

Co-authored-by: Beatrix <[email protected]>
abeatrix pushed a commit that referenced this pull request Dec 23, 2024
…query (#6440)

When we remove the mentions, for some reason we&#39;re trimming spaces
from the start, but not the end. This means our exact match heuristics
won&#39;t work as well for these situations because there&#39;s a rogue
space at the end of the query.

This just fixes the logic to trim spaces from both the start and end

## Test plan

This query used to give less relevant results because we kept the
trailing space:
![CleanShot 2024-12-20 at 10 53
31@2x](https://github.com/user-attachments/assets/f49246ee-99cf-47b2-835a-34505ab7ac5d)
 <br> Backport 78da6bb from #6432

Co-authored-by: Camden Cheek <[email protected]>
abeatrix pushed a commit that referenced this pull request Dec 23, 2024
…#6446)

When we remove the mentions, for some reason we&#39;re trimming spaces
from the start, but not the end. This means our exact match heuristics
won&#39;t work as well for these situations because there&#39;s a rogue
space at the end of the query.

This just fixes the logic to trim spaces from both the start and end

## Test plan

This query used to give less relevant results because we kept the
trailing space:
![CleanShot 2024-12-20 at 10 53
31@2x](https://github.com/user-attachments/assets/f49246ee-99cf-47b2-835a-34505ab7ac5d)
 <br> Backport 78da6bb from #6432

Co-authored-by: Camden Cheek <[email protected]>
abeatrix added a commit that referenced this pull request Jan 13, 2025
…text settings (#6619)

CLOSE https://linear.app/sourcegraph/issue/CODY-4632

Updates the `ToolboxButton` component that provides a UI for managing
agent context settings with a more detailed description of the feature.

- Updates toggles for agentic context and terminal access, with
appropriate warnings
- Displays the button on all messages
- Debounces the settings update to avoid excessive API calls with the
removed save button
- Display button on all messages
- Display button without title text in non-first message
- Hide terminal context on unsupported instance/clients

## Test plan



UI update without feature change - storybook updated.


![image](https://github.com/user-attachments/assets/0459f2b1-e0b9-463f-83c8-0d20e6f789b4)


![image](https://github.com/user-attachments/assets/37ee046a-0b6c-4d1c-916f-fd593d636c5a)

Hide shell command on unsupported client or instances


![image](https://github.com/user-attachments/assets/24cc5215-7118-4cfa-a5de-0b643cdf2a1f)

### Before

The current one doesn&#39;t explain what agentic context and terminal
context are:


![image](https://github.com/user-attachments/assets/27da9d5f-bf5e-4a34-8ed8-6e37a80dbd48)
 <br> Backport d865d65 from #6596

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Jan 13, 2025
…6618)

CLOSE https://linear.app/sourcegraph/issue/CODY-4671

Fixes a regression where the agent would mark a context as needed but
got filtered out during the validation step

- Simplify the context review logic by directly extracting context names
from the response and fetching the full content for the requested files.
- Remove unnecessary callbacks and optimize the context fetching
process.
- Add a helper function to check if the response is ready to answer.


## Test plan



Manual testing:

1. Ask in new chat: &quot;how does agentic context work in
@_cody_repo&quot;
2. Add a follow up: &quot;how many loop does deep cody run for the
review step?&quot;

Before

Deep Cody requested a file:


![image](https://github.com/user-attachments/assets/a15b9e8e-3d2f-4eaa-b143-db9384540f28)

But it wasn&#39;t included in the final selected context:

&lt;img width=&quot;829&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/07f0d283-0e84-4879-81e8-f6f38c807ccb&quot;
/&gt;

After:

&lt;img width=&quot;839&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/bb846639-7a04-4ad8-a247-982dd9ede381&quot;
/&gt;


 <br> Backport 54982b5 from #6602

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Jan 13, 2025
… settings (#6626)

CLOSE https://linear.app/sourcegraph/issue/CODY-4632

Updates the `ToolboxButton` component that provides a UI for managing
agent context settings with a more detailed description of the feature.

- Updates toggles for agentic context and terminal access, with
appropriate warnings
- Displays the button on all messages
- Debounces the settings update to avoid excessive API calls with the
removed save button
- Display button on all messages
- Display button without title text in non-first message
- Hide terminal context on unsupported instance/clients

## Test plan



UI update without feature change - storybook updated.


![image](https://github.com/user-attachments/assets/0459f2b1-e0b9-463f-83c8-0d20e6f789b4)


![image](https://github.com/user-attachments/assets/37ee046a-0b6c-4d1c-916f-fd593d636c5a)

Hide shell command on unsupported client or instances


![image](https://github.com/user-attachments/assets/24cc5215-7118-4cfa-a5de-0b643cdf2a1f)

### Before

The current one doesn&#39;t explain what agentic context and terminal
context are:


![image](https://github.com/user-attachments/assets/27da9d5f-bf5e-4a34-8ed8-6e37a80dbd48)
 <br> Backport d865d65 from #6596

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Jan 13, 2025
CLOSE https://linear.app/sourcegraph/issue/CODY-4671

Fixes a regression where the agent would mark a context as needed but
got filtered out during the validation step

- Simplify the context review logic by directly extracting context names
from the response and fetching the full content for the requested files.
- Remove unnecessary callbacks and optimize the context fetching
process.
- Add a helper function to check if the response is ready to answer.


## Test plan



Manual testing:

1. Ask in new chat: &quot;how does agentic context work in
@_cody_repo&quot;
2. Add a follow up: &quot;how many loop does deep cody run for the
review step?&quot;

Before

Deep Cody requested a file:


![image](https://github.com/user-attachments/assets/a15b9e8e-3d2f-4eaa-b143-db9384540f28)

But it wasn&#39;t included in the final selected context:

&lt;img width=&quot;829&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/07f0d283-0e84-4879-81e8-f6f38c807ccb&quot;
/&gt;

After:

&lt;img width=&quot;839&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/bb846639-7a04-4ad8-a247-982dd9ede381&quot;
/&gt;


 <br> Backport 54982b5 from #6602

Co-authored-by: Beatrix <[email protected]>
hitesh-1997 pushed a commit that referenced this pull request Jan 21, 2025
…d of changelog entries (#6712)

This works by using the title as the changelog entry instead.
We cannot use the compact mode version with this feature enabled, it
fails to find a `section` `formatEntry` command and exits before the
changelog is generated.

Also updated the changelog marker since it&#39;s different now?


## Test plan
I ran the
[action](https://github.com/sourcegraph/cody/actions/runs/12799005063/job/35684227555)
which produced this [PR](#6668)

 <br> Backport 4ce3794 from #6669

Co-authored-by: Anish Lakhwara <[email protected]>
hitesh-1997 pushed a commit that referenced this pull request Jan 22, 2025
…ime error (#6729)

- By testing locally, I reproduced the runtime error we see in our
analytics data. It&#39;s coming from the diagnostics retriever where
line numbers are not clamped.
- Closes [CODY-4717: Fix the `illegal line` runtime
error](https://linear.app/sourcegraph/issue/CODY-4717/fix-the-illegal-line-runtime-error)

## Test plan

CI + updated unit tests
 <br> Backport 962666c from #6727

Co-authored-by: Valery Bugakov <[email protected]>
kalanchan added a commit that referenced this pull request Jan 22, 2025
…s to keep workflow referen… (#6739)

running into errors in generate changelog action where it can&#39;t
create the PRs due to conflicts, this removes the non essential git
configuration steps to keep the reference branch the same


## Test plan
N/A, couldn&#39;t test locally need the github UI

 <br> Backport bfa18e6 from #6737

Co-authored-by: Kalan <[email protected]>
umpox pushed a commit that referenced this pull request Jan 22, 2025
…aces vscode sign-in flow) (#6742)

Part of
https://linear.app/sourcegraph/issue/DES-235/[onboarding-polish]-extensions-logout-guidance-step

This small change allows us to specify the instance URL for sigh up /
auth flow, it&#39;s useful for workspace flow when we don&#39;t
originally start our log-in flow from vscode and fill in the workspace
URL but right from the workspace instance and we should notify cody to
which URL it should try to log in with access token (code URL param)

This PR is primarily needed for the workspace log-in into VSCode Cody PR
in the Sourcegraph repository.


https://github.com/user-attachments/assets/1dd1b90d-970e-4c2d-a71a-89cdaddf354a

@mmanela I saw your contributions about instance param in this flow, do
you think we should make users go through this flow manually? I still
left your logic in there so we can switch it later if we want.

@kalanchan, this PR is important for workspace setup flow. Can I ask you
to make sure it&#39;s included in the upcoming Cody release? I think
it&#39;s going to be 1.62, right?

## Test plan
- Check that the standard auth flow has no regression
- The workspace flow will be tested in the Sourcegraph repository PR
 <br> Backport 7e4dbf9 from #6730

Co-authored-by: Vova Kulikov <[email protected]>
umpox pushed a commit that referenced this pull request Jan 22, 2025
… when enabled (#6758)

FIX https://linear.app/sourcegraph/issue/CODY-4737

The issue was that the Tool Cody model was being added to the list of
primary models regardless of whether the feature was enabled or not. The
root cause was that the check for the existence of the Tool Cody model
was not properly scoped to the `isToolCodyEnabled` flag but was checking
the observable instead, which would always returns true as the
observable is defined.

This change fixes the issue by only adding the Tool Cody model to the
list of primary models if the `isToolCodyEnabled` flag is true and the
Tool Cody model is not already present in the list of primary models.

Included some minor clean up.

## Test plan



Verify Tool Cody is not showing up in your model dropdown if you
don&#39;t have the configuration in your settings:

&lt;img width=&quot;603&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/6ebdbb6e-650d-4bc4-ad62-40a285a13f5f&quot;
/&gt;

 <br> Backport ae351c2 from #6753

Co-authored-by: Beatrix <[email protected]>
umpox pushed a commit that referenced this pull request Jan 22, 2025
…n enabled (#6759)

FIX https://linear.app/sourcegraph/issue/CODY-4737

The issue was that the Tool Cody model was being added to the list of
primary models regardless of whether the feature was enabled or not. The
root cause was that the check for the existence of the Tool Cody model
was not properly scoped to the `isToolCodyEnabled` flag but was checking
the observable instead, which would always returns true as the
observable is defined.

This change fixes the issue by only adding the Tool Cody model to the
list of primary models if the `isToolCodyEnabled` flag is true and the
Tool Cody model is not already present in the list of primary models.

Included some minor clean up.

## Test plan



Verify Tool Cody is not showing up in your model dropdown if you
don&#39;t have the configuration in your settings:

&lt;img width=&quot;603&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/6ebdbb6e-650d-4bc4-ad62-40a285a13f5f&quot;
/&gt;

 <br> Backport ae351c2 from #6753

Co-authored-by: Beatrix <[email protected]>
umpox pushed a commit that referenced this pull request Jan 27, 2025
… for quick sign-in (#6653) (#6818)

This is cherry-picking @mmanela commit from
#6653

It was recently reverted here
#6794 due to problems with
reverting other PRs and merge conflicts.

This PR contains a required change for a successful Workspace Auth flow
so we should include this in the upcoming 1.64 release

## Original PR description 
VS Code side part of

https://linear.app/sourcegraph/issue/SRC-908/automate-cody-authflow-vs-code

After a user creates a workspace we want to make it easy for them to
sign-in to the instance in their editor. For enterprise instances today,
they need to copy the instance url, go into VS Code and then choose to
signin with enterprise instance and then paste the url.

This change will help stream-line that flow by allowing the UI in
sourcegraph to link to VS Code with a url like

`vscode://sourcegraph.cody-ai?instance=someinstance.sourcegraphdev.app`

VS Code will handle and either switch to that account if you already are
auth&#39;d OR pop-open the signin menu directly


![image](https://github.com/user-attachments/assets/cdab4135-2dae-48d3-945c-2e70187c37f0)

Note: For initial version I limited just to workspace domains. But we
can generalize that to allow other instance domains.

## Test plan

1. Validate when client doesn&#39;t have instance already
2. Validate when client already has instance connected

(cherry-picked from commit 9719dc4)

 <br> Backport ef65034 from #6812

Co-authored-by: Vova Kulikov <[email protected]>
umpox pushed a commit that referenced this pull request Jan 27, 2025
… URL for quick sign-in (#6653) (#6817)

This is cherry-picking @mmanela commit from
#6653

It was recently reverted here
#6794 due to problems with
reverting other PRs and merge conflicts.

This PR contains a required change for a successful Workspace Auth flow
so we should include this in the upcoming 1.64 release

## Original PR description 
VS Code side part of

https://linear.app/sourcegraph/issue/SRC-908/automate-cody-authflow-vs-code

After a user creates a workspace we want to make it easy for them to
sign-in to the instance in their editor. For enterprise instances today,
they need to copy the instance url, go into VS Code and then choose to
signin with enterprise instance and then paste the url.

This change will help stream-line that flow by allowing the UI in
sourcegraph to link to VS Code with a url like

`vscode://sourcegraph.cody-ai?instance=someinstance.sourcegraphdev.app`

VS Code will handle and either switch to that account if you already are
auth&#39;d OR pop-open the signin menu directly


![image](https://github.com/user-attachments/assets/cdab4135-2dae-48d3-945c-2e70187c37f0)

Note: For initial version I limited just to workspace domains. But we
can generalize that to allow other instance domains.

## Test plan

1. Validate when client doesn&#39;t have instance already
2. Validate when client already has instance connected

(cherry-picked from commit 9719dc4)

 <br> Backport ef65034 from #6812

Co-authored-by: Vova Kulikov <[email protected]>
umpox pushed a commit that referenced this pull request Jan 28, 2025
…tic model (#6828)

The display name for the deep-cody model has been updated from
&#39;Agentic Chat&#39; to &#39;Agentic chat&#39;.


## Test plan



Verify the name update:

&lt;img width=&quot;496&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/8e1cc5a3-d8bc-44ea-94c9-1a1488e39541&quot;
/&gt;
 <br> Backport ca3fcd1 from #6827

Co-authored-by: Beatrix <[email protected]>
umpox pushed a commit that referenced this pull request Jan 28, 2025
…model (#6829)

The display name for the deep-cody model has been updated from
&#39;Agentic Chat&#39; to &#39;Agentic chat&#39;.


## Test plan



Verify the name update:

&lt;img width=&quot;496&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/8e1cc5a3-d8bc-44ea-94c9-1a1488e39541&quot;
/&gt;
 <br> Backport ca3fcd1 from #6827

Co-authored-by: Beatrix <[email protected]>
dominiccooney added a commit that referenced this pull request Jan 30, 2025
… some clean up (#6883)

- Name all of the release workflows consistently so they will appear
together in GitHub&#39;s actions list.
- Remove the unused experimental changelog generator.
- Remove stale release instructions from CONTRIBUTING.md, instead point
to Notion.

## Test plan

I am release captain, I will dogfood this week. <br> Backport
495962e from #6879

Co-authored-by: Dominic Cooney <[email protected]>
dominiccooney added a commit that referenced this pull request Jan 30, 2025
…ease.sh about release branches (#6884)

These scripts predate release branches and used to always look at global
tags. This change makes it work on release branches. It uses git to list
the commits on the release branch, then does the same version bump
calculation using the branch&#39;s tags.

It takes care to handle newly budding branches which are just a commit
on `main` that has no backports yet. In that case it looks at all of the
available tags.

It will work carrying a branch from prerelease through to release:

```
# At the start of the branch
$ ./scripts/push-git-tag-for-next-release.sh --minor --nightly
# During prerelease, assume we have accumulated some commits on the branch now:
$ ./scripts/push-git-tag-for-next-release.sh --patch --nightly
# Transitioning to release:
$ ./scripts/push-git-tag-for-next-release.sh --minor
# Hopefully never needed, but making emergency patches on stable:
$ ./scripts/push-git-tag-for-next-release.sh --patch
```

There are some caveats with this tool:
- When working on a release branch, it only has *local* view of *that
branch&#39;s tags.* Misusing it should be harmless because creating a
tag which conflicts with an existing tag will fail when the tag is
pushed.
- It does not enforce the new practice of stable builds having even
version numbers and prerelease builds having odd version numbers.

If you ever need to work around this tool, just author and push git tags
yourself. To this point release captains have been doing that anyway.

Adds a `--dry-run` option which makes testing easier. Removes outdated
docs and points to Notion instead.

## Test plan

```
# Pretend you&#39;re just cooking up a release branch
$ git remote update origin
$ git checkout -b my-release-branch origin/main
$ cd jetbrains
$ ./scripts/push-git-tag-for-next-release.sh --minor --nightly --dry-run
# It should suggest a minor version bump based on all the version tags in the repo
...
# Pretend you&#39;re on a release branch, we&#39;re doing a patch release
$ git fetch origin refs/heads/jb-v7.8.x
$ git checkout FETCH_HEAD
$ git checkout &lt;this PR&gt; -- scripts/next-release.sh scripts/push-git-tag-for-next-release.sh
$ git commit -m &#39;test test test do not push&#39;  # script insists the repo is clean
$ ./scripts/push-git-tag-for-next-release.sh --minor --dry-run
# It should suggest v7.8.1
```

I am the release captain and will dogfood this script in the current
release. <br> Backport b912145 from
#6881

Co-authored-by: Dominic Cooney <[email protected]>
julialeex pushed a commit that referenced this pull request Feb 7, 2025
…s. (#6977)

We will create releases in sourcegraph/cody now, because that&#39;s
where the commits are! And link to this page to display them:


https://github.com/sourcegraph/cody/releases?q=JetBrains&amp;expanded=true

## Test plan

```
cd jetbrains
./gradlew verifyPlugin
```

Land this, backport it, then release a v7.67 nightly and check that [the
JetBrains Marketplace
page](https://plugins.jetbrains.com/plugin/9682-cody-ai-code-assistant/edit/versions/nightly)
looks good. <br> Backport 15147f6 from
#6976

Co-authored-by: Dominic Cooney <[email protected]>
julialeex pushed a commit that referenced this pull request Feb 7, 2025
… follow-up message (#7009)

The user knows who they are, why show it next to every message? It
clutters the UI. So I removed the avatar from the human messages (we
still have the avatar in the top right).

I also removed the name from the follow-up message. It doesn&#39;t add
anything.

Ideally we&#39;d remove the &quot;user name&quot; every where but when I
did that, the layout looked kinda bad because there was still the
&#39;split into chat&#39; button.

## Before

![before](https://github.com/user-attachments/assets/2ce844e1-275a-42e4-876c-5d18bb011a47)

## After

![after](https://github.com/user-attachments/assets/364a23a7-242b-4ed7-a49f-08de8df6b47f)

## Test plan

- N/A <br> Backport 127d52c from #6981

Co-authored-by: Thorsten Ball <[email protected]>
julialeex pushed a commit that referenced this pull request Feb 7, 2025
…S Code (#7006)

Previously, pressing Enter in a chat message in VS Code&#39;s Cody chat
would cause the iframe to be shifted up by ~5px. This was an annoying
visual jitter. Now, this no longer happens.

## Test plan

CI

Also: Run in VS Code, type a chat message, press Enter, and ensure there
is no jitter. Also ask a long chat question and ensure that the
scroll-to-end works.

## Changelog

- Fixed an issue where pressing Enter in chat would cause brief visual
jitter in the UI. <br> Backport bc8f1fb
from #6991

Co-authored-by: Quinn Slack <[email protected]>
julialeex pushed a commit that referenced this pull request Feb 7, 2025
…constant (#7019)

This bugged me while reading and to warm up to the codebase, I decided
to replace the hardcoded strings with the reference. Can&#39;t do it in
`lib/shared`, but in `vscode`.


## Test plan

- Run Cody and see that agentic chat works.
 <br> Backport 386c0b6 from #6958

Co-authored-by: Thorsten Ball <[email protected]>
julialeex pushed a commit that referenced this pull request Feb 12, 2025
…ing images (#7055)

## Description

closes
https://linear.app/sourcegraph/issue/CODY-4869/auto-edit-support-custom-font-size-and-line-height

Use the users&#39; default font size and determine a suitable line
height from this when we are generating image suggestions

## Test plan

Manually testing when creating auto edits

Tested on MacOS and Linux


 <br> Backport 5d7d4e5 from #7036

Co-authored-by: Tom Ross <[email protected]>
julialeex pushed a commit that referenced this pull request Feb 12, 2025
Upgrades changelog generator from my old script to dev infra&#39;s. I
added a new `betweenCommit` strategy to their tooling, which let&#39;s
us parse total git history between 2 commits. see
sourcegraph/devx-service#299 for full details.

Using the dev infra changelog binary will now let us group PRs by their
titles and types ($type/$domain) and will make the changelog process
much easier. We should start following the conventions laid out on the
[Cody PR conventions
page](https://www.notion.so/sourcegraph/PR-and-Changelog-conventions-ecfd817301614c399d4c8b9aa5832370)

Release captains can now run this workflow from the milestone branch to
generate the changelog.

See #7077 as an example of what
this outputs.


// TODO for after
Force push the changelog PR branch so that subsequent workflow runs
won&#39;t fail trying to create the same branch


## Test plan
tested the new workflow on my branch kalan/changelog-M68, worked well
for upcoming milestone 68 release

 <br> Backport 5c5b448 from #7081

Co-authored-by: Kalan <[email protected]>
hitesh-1997 added a commit that referenced this pull request Feb 24, 2025
…logging payload (#7198)

Currently `insert` events are missing in the smart apply logging because
they return early, the PR adds them in the current logging pipeline

## Test plan
- Open a empty file and ask the chat to make some changes
- Click on the smart apply event
- Observe the telemetry in the `Cody by Sourcegraph` output channel
```
█ telemetry-v2 recordEvent: cody.smart-apply.context/applied: {
    // ... metadata ....
    &quot;privateMetadata&quot;: {
      &quot;smartApplyContext&quot;: {
        &quot;smartApplyModel&quot;: &quot;anthropic::2024-10-22::claude-3-5-haiku-latest&quot;,
        &quot;userQuery&quot;: &quot;Similar to fireworks.ts add the anthropic provide in the file anthropic.ts &quot;,
        &quot;replacementCodeBlock&quot;: &quot;import from &#39;../ [...other chars] }\n}&quot;,
        &quot;filePath&quot;: &quot;src/autoedits/adapters/anthropic.ts&quot;,
        &quot;fileContent&quot;: &quot;&quot;,
        &quot;selectionType&quot;: &quot;insert&quot;,
        &quot;selectionRange&quot;: [
          0,
          0
        ],
        &quot;applyTaskId&quot;: &quot;57b470f50a63a8af761abb9c5ed73c4806c78d473e5526067ea92f4d1fc22a4e&quot;
      }
    },
  },
}
```
 <br> Backport 96bc4a4 from #7197

Co-authored-by: Hitesh Sagtani <[email protected]>
julialeex pushed a commit that referenced this pull request Feb 24, 2025
…ssage (#7210)

RE: https://linear.app/sourcegraph/issue/CODY-4785

This PR adds a simple hack to support rendering &lt;think&gt; tags in
the ChatMessageContent component.

The &lt;think&gt; content is displayed in a collapsible details element,
allowing users to view the AI&#39;s internal thought process.

The MarkdownFromCody component is also updated to allow the
&lt;think&gt; element.


## Test plan



Ask Cody &quot;how many files are there in the codebase? Enclose your
thoughts inside &lt;think&gt; tags before answering&quot;

- Verify that &lt;think&gt; tags are properly extracted and displayed in
the ChatMessageContent component
- Ensure that the collapsible details element functions as expected,
allowing users to view the think content
- Confirm that the MarkdownFromCody component correctly renders the
&lt;think&gt; element

Example:



https://github.com/user-attachments/assets/0a5cff8f-1b08-48e4-9cf9-4fd6d13ef05a

 <br> Backport 710ac73 from #6845

Co-authored-by: Beatrix <[email protected]>
julialeex pushed a commit that referenced this pull request Feb 24, 2025
…ssage (#7209)

RE: https://linear.app/sourcegraph/issue/CODY-4785

This PR adds a simple hack to support rendering &lt;think&gt; tags in
the ChatMessageContent component.

The &lt;think&gt; content is displayed in a collapsible details element,
allowing users to view the AI&#39;s internal thought process.

The MarkdownFromCody component is also updated to allow the
&lt;think&gt; element.


## Test plan



Ask Cody &quot;how many files are there in the codebase? Enclose your
thoughts inside &lt;think&gt; tags before answering&quot;

- Verify that &lt;think&gt; tags are properly extracted and displayed in
the ChatMessageContent component
- Ensure that the collapsible details element functions as expected,
allowing users to view the think content
- Confirm that the MarkdownFromCody component correctly renders the
&lt;think&gt; element

Example:



https://github.com/user-attachments/assets/0a5cff8f-1b08-48e4-9cf9-4fd6d13ef05a

 <br> Backport 710ac73 from #6845

Co-authored-by: Beatrix <[email protected]>
hitesh-1997 pushed a commit that referenced this pull request Feb 26, 2025
…or (#7239)

This PR addresses the issue where models with reasoning capabilities
were causing edits to fail when selected in the Inline Edit model
selector.

Changes Made

- Added logic to filter out the ModelUsage.Edit capability from any
model that has the reasoning capability Introduced new model
capabilities reasoning and tools to properly identify models with these
features Added corresponding model tags Reasoning and Tools to the tag
enum Updated code to maintain the model capabilities but selectively
remove edit usage when reasoning is detected Added entry to the
changelog to document this fix
- Implementation Details
- The core fix is implemented by checking if a model&#39;s capabilities
include &#39;reasoning&#39; and, if so, removing the Edit usage from
that model&#39;s available usages. This prevents reasoning-enabled
models from appearing in the Inline Edit model selector while
maintaining their availability for chat and other supported features.

## Test Plan

The change has been tested to ensure that:

- Reasoning models no longer appear in the Inline Edit model selector 
- Reasoning models remain available for chat and other supported
features
- Non-reasoning models with edit capability still work as expected

Before - connect to dotcom and open the inline edit model selector, 3.7
sonnet is listed in the dropdown


![image](https://github.com/user-attachments/assets/585dc922-5eb1-4009-8e03-28826013c4f4)


After - 3.7 removed


![image](https://github.com/user-attachments/assets/df30e861-08a1-4b1d-a9b3-545635f280a4)
 <br> Backport a7ec5fb from #7238

Co-authored-by: Beatrix <[email protected]>
hitesh-1997 pushed a commit that referenced this pull request Feb 26, 2025
This PR improves VS Code release notes generation by introducing
changelog summarization. The new `release-notes.ts` script creates easy
to understand, categorized release notes with emojis and clear
formatting. This refactoring also makes it more simple to plugin future
changelogs.

The following output is an example of what will be used in the release
script.

Example output for `v1.70.1`:
```
✨ For the full technical changelog, see [What’s new in v1.70.0](https://github.com/sourcegraph/cody/blob/main/vscode/CHANGELOG.md) since v1.68.0 ✨

This release brings significant improvements to the chat interface, enhanced auto-edit functionality, and various bug fixes to improve the overall user experience.

✨ New Features
- Support for dynamic mentions in prompt templates, making @ mentions more flexible and context-aware [#6793](#6793)
- Enhanced image handling in auto-edit with better alignment and user-specific font size support [#7036](#7036)

🔄 Improvements
- Streamlined chat interface with simplified UI and improved user experience [#6992](#6992)
- Enhanced prompt caching for code context messages, improving response times [#6953](#6953)
- Improved code border styles for better visual clarity [#7024](#7024)

🐛 Bug Fixes
- Fixed 500ms delay when submitting chat messages [#6991](#6991)
- Resolved issues with @ mention menu appearing outside the editor window [#7045](#7045)
- Fixed low resolution images on low DPI screens [#7112](#7112)
- Corrected language filters in rules not applying properly [#7025](#7025)

🎨 UI Enhancements
- Improved repository filter dropdown functionality [#6994](#6994)
- Enhanced history search interface with fixed border styling [#6983](#6983)
- Simplified chat UI by removing user avatars and streamlining message presentation [#6981](#6981)


**Full Comparison**: M68...M70
```


Example output for `v1.70.1`:
```
✨ For the full technical changelog, see [What’s new in v1.70.1](https://github.com/sourcegraph/cody/blob/main/vscode/CHANGELOG.md) since v1.70.0 ✨

This minor update addresses a specific issue with Cody&#39;s agentic chat functionality.

🐛 Bug Fixes
- Fixed an issue where terminal and openCtx tools were not properly registered in agentic chat, ensuring better functionality and tool availability [#7132](#7132)


**Full Comparison**: M68...M70
```

## Test plan
tested locally using `npx ts-node ./scripts/release-notes.ts`


 <br> Backport 2e3b785 from #7150

Co-authored-by: Kalan <[email protected]>
umpox added a commit that referenced this pull request Mar 12, 2025
…mpletion menu (#7406)

https://github.com/user-attachments/assets/5d105794-516b-44dd-b81f-b0c991c835a1



## Description

Fixes an issue where we attempt to suggest an auto-edit that could
conflict with the completion menu in a bad way. E.g. it may delete or
add code that doesn&#39;t reflect the selected item in the menu. If the
user was to accept this item with Tab, the edit would be accepted
including the unwanted code.

## Test plan

- Unit tests
- Manual testing with completion items <br> Backport
2c430e9 from #7389

Co-authored-by: Tom Ross <[email protected]>
julialeex pushed a commit that referenced this pull request Mar 19, 2025
Fixes
#7446 (comment)

Potential fix for the issue with multiple agents spawned in parallel.
In our current restart code we do not sufficiently guard us against
parallel cody restarts.

In what situations it can happen?
For example if agent is starting doing multiple independent actions
(e.g. syncing some files, updating chat state, etc) and it will crash,
each of those action can attempt to restart a server. That should be
limited to actions explicitly triggered by user, but I also fixed one
place where it was not (and which could have been source of the
problem).
Regardless, we should also safeguard it on the level of the `restart`
function.

## Test plan

1. Run &#39;Cody: Restart Cody&#39; a dozen of times as quickly as you
can (you can assign it shortcut to make it easier)
2. Using process monitor make sure number of the agent processes is not
increasing
3. Make sure cody is functioning properly after restart is done
 <br> Backport 137fe67 from #7466

Co-authored-by: Piotr Kukiełka <[email protected]>
julialeex pushed a commit that referenced this pull request Mar 19, 2025
#7257)" (#7475)

This reverts commit a31acd0.

I&#39;m reverting this as we get few reports of multiple agent processes
being spawned, and this is only recent change in this area of code.

There is a chance that my fix is solving the underlaying issue:
#7466
But if my fix is proper, then we do no need
`WebUIService.getInstance(project).reset()` in both `start` and `stop`
methods.
I believe before my PR it was sometimes beneficial because there was
race between `stop` and `start` code.
But there is also a chance that it was breaking something is timing was
slightly different.

## Test plan

N/A
 <br> Backport 27990ca from #7469

Co-authored-by: Piotr Kukiełka <[email protected]>
julialeex pushed a commit that referenced this pull request Mar 19, 2025
…s default model (#7473)

This PR fixes a critical issue where reasoning models could be
incorrectly set as the default model for Edit operations, causing the
application to break for users.

This commit addresses an issue where reasoning models could be
incorrectly set as the default model for Edit operations. The problem
occurred because when Edit model is not available, Edit would fallback
to the `firstModelUserCanUse` logic which doesn&#39;t filter out
reasoning models for Edit usage. This could cause Inline Edit to use
reasoning model even when they are not assigned for Edit usage.

### The Problem

The issue occurred in the `getDefaultModel` and `getDefaultEditModel`
methods in `modelsService.ts`. When a user didn&#39;t have a selected
model preference for Edit and the server didn&#39;t provide a default
Edit model, the code would use the first available model that the user
could access. However, this logic didn&#39;t properly filter out
reasoning models, which are not suitable for Edit operations.

This resulted in scenarios where reasoning models were being used for
Edit operations, causing unexpected behavior or application failures.

### The Solution

The fix includes:

1. Enhanced filtering in `getDefaultModel` to explicitly exclude
reasoning models when finding the first available model for Edit usage
2. Improved fallback logic in `getDefaultEditModel` to:
   - First try to use a valid Edit model (non-reasoning)
- If that&#39;s not available, fall back to a valid Chat model
(non-reasoning)
   - If neither is available, return undefined

3. Added comprehensive test coverage to ensure:
   - Reasoning models are never used for Edit operations
- Models with problematic tags (Waitlist, OnWaitlist, Deprecated) are
not used for Edit
   - The fallback mechanism to Chat models works correctly
   - User preferences are respected when valid
   - Invalid user preferences (like reasoning models) are ignored

## Changes

- Added filtering to exclude reasoning models from being used for Edit
operations
- Improved fallback logic to use valid Chat models when no suitable Edit
models are available
- Added comprehensive test coverage to ensure reasoning models and other
problematic model types (waitlist, deprecated) are never used for Edit
- Updated existing tests to reflect the new behavior
-   Filtering out deprecated models from the available models list.
-   Preventing the selection of reasoning models for Edit usage.
- Prioritizing chat models as a fallback when no valid edit model is
available.
- Ensuring that user preferences for edit models are respected unless
the selected model is a reasoning model.
-   Handling the scenario where only reasoning models are available.


## Test plan




Added a new test suite `Default model selection for Edit and Chat` with
8 test cases covering all the scenarios mentioned above. Updated
existing tests to reflect the new behavior.
 <br> Backport e927763 from #7461

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Mar 21, 2025
…sCell (#7516)

Close
https://linear.app/sourcegraph/issue/CODY-5444/bug-search-results-and-file-tool-results-are-not-clickable

The Issue: In the original implementation, if the vscodeAPI prop was
undefined during initial component render (because the VSCode API
wasn&#39;t fully initialized yet), the onFileLinkClicked function would
be created with a reference to that undefined value. Even if the API
became available later, the callback would still reference the initial
undefined value due to how closures work.

The Fix: By calling getVSCodeAPI() at the time the link is clicked
(rather than capturing the value during render), the code now gets the
most current API reference at the exact moment it&#39;s needed. This
guarantees that even if the API wasn&#39;t available during the
component&#39;s first render, the link functionality will still work
when clicked as long as the API is available by then.


## Test plan



Clicking on agent search result should open the file link in editor for
you

&lt;img width=&quot;593&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/468e39d3-0a9a-4050-bd2b-a8c9bf7285f8&quot;
/&gt;


 <br> Backport 5b8c338 from #7496

Co-authored-by: Beatrix <[email protected]>
abeatrix added a commit that referenced this pull request Mar 27, 2025
…ents (#7586)

This commit addresses an issue where completion requests might not have
associated events that is causing unexpected error that stops chat
requests. These changes ensure that the completion service gracefully
handles scenarios where no usage data is available for a completion
request, preventing potential errors and improving the robustness of the
system.

### Root Cause

The error occurs in the sendEvents method of the
SourcegraphCompletionsClient class when it tries to process events but
there are no events to process.

### Summary

Implemented Fixes:

1. In nodeClient.ts:

- Added a check to ensure we only call sendEvents when there are
actually events to process
- Added better error logging when no events are detected
- Improved the error handling in the request.on(&#39;close&#39;) handler
to provide more detailed diagnostics

2. In client.ts:

- Added a guard clause at the beginning of sendEvents to handle empty
event arrays gracefully
- Added a warning log instead of throwing an error when no events are
detected

3. Improved Error Handling:

- Enhanced the error messages to be more descriptive
- Added better logging to help diagnose the issue in the future
- Made the code more robust by handling edge cases where no events are
received

Implementation details:

- In `vscode/src/completions/nodeClient.ts`, a check is added to ensure
that `parseResult.events` has a length greater than 0 before sending
events. If no events are detected, a warning is logged, but the request
is not failed.
- In `lib/shared/src/sourcegraph-api/completions/client.ts`, a check is
added in `sendEvents` to handle cases where no events are provided. A
warning is logged to the console, and the function returns early to
prevent errors.

These changes will prevent the &quot;no usage data detected for
completion request&quot; error from occurring and provide better
diagnostics when there are issues with the completion requests. The code
now gracefully handles cases where no events are received from the
server, which could happen due to network issues or upstream LLM
provider outages.

## Test plan

Green CI

Reproduce steps

### Before

1. Ask Cody in Agent mode: `create a unified component for all the
components in vscode/webviews/chat/cells/toolCell directory, or a base
component that each component could build on. Use the
ContextItemToolState interface for reference @message.ts`
2. Agent would try to gather all the info it needs but would exit the
task with `Request Failed: no usage data detected for completion
request`

| Take 1 | Take 2 |
|:----------------------:|:----------------------:|
|
![](https://github.com/user-attachments/assets/8d868f67-6085-4cc2-8d32-dac8e51d63c0)
|
![](https://github.com/user-attachments/assets/135d9169-cdae-4008-b95a-35587e2da19a)
|

### After

Task completed with no error

&lt;img width=&quot;740&quot; alt=&quot;image&quot;
src=&quot;https://github.com/user-attachments/assets/f3818e84-51f7-4629-a722-da76c17254cb&quot;
/&gt;
 <br> Backport 0f3aa23 from #7585

Co-authored-by: Beatrix <[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.

2 participants