Skip to content

Commit

Permalink
bump openctx for quieter provider errors (#5644)
Browse files Browse the repository at this point in the history
Incorporates sourcegraph/openctx#207 and
sourcegraph/openctx#206.

Fixes
https://linear.app/sourcegraph/issue/CODY-3799/quieter-openctx-provider-ui-notifs-in-vs-code-and-better-error-logging.

## Test plan

Open VS Code with an OpenCtx provider that throws an error. Ensure that
no VS Code error notification is shown in the UI, and that it's logged
to the `OpenCtx` output channel with the provider URI mentioned.
  • Loading branch information
sqs authored Sep 20, 2024
1 parent de22fc8 commit 5bd253c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"vitest": "^2.0.5"
},
"dependencies": {
"@openctx/client": "^0.0.28",
"@openctx/client": "^0.0.29",
"@sourcegraph/telemetry": "^0.18.0",
"ignore": "^5.3.1",
"observable-fns": "^0.6.1",
Expand Down
36 changes: 24 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@
"dependencies": {
"@anthropic-ai/sdk": "^0.20.8",
"@openctx/provider-linear-issues": "^0.0.9",
"@openctx/vscode-lib": "^0.0.24",
"@openctx/vscode-lib": "^0.0.25",
"@opentelemetry/api": "^1.7.0",
"@opentelemetry/core": "^1.18.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.45.1",
Expand Down
14 changes: 12 additions & 2 deletions vscode/src/context/openctx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
authStatus,
combineLatest,
createDisposables,
debounceTime,
distinctUntilChanged,
featureFlagProvider,
graphqlClient,
Expand All @@ -28,7 +29,7 @@ import type {
} from '@openctx/client'
import type { createController } from '@openctx/vscode-lib'
import { Observable, map } from 'observable-fns'
import { logDebug, outputChannel } from '../log'
import { logDebug } from '../log'
import { gitMentionsProvider } from './openctx/git'
import LinearIssuesProvider from './openctx/linear-issues'
import RemoteDirectoryProvider, { createRemoteDirectoryProvider } from './openctx/remoteDirectorySearch'
Expand All @@ -52,6 +53,7 @@ export function exposeOpenCtxClient(
),
authStatus.pipe(
distinctUntilChanged(),
debounceTime(0),
mergeMap(auth =>
auth.authenticated
? promiseFactoryToObservable(signal =>
Expand All @@ -78,10 +80,16 @@ export function exposeOpenCtxClient(
? getMergeConfigurationFunction()
: undefined

if (!openctxOutputChannel) {
// Don't dispose this, so that it stays around for easier debugging even if the
// controller (or the whole extension) is disposed.
openctxOutputChannel = vscode.window.createOutputChannel('OpenCtx')
}

const controller = createController({
extensionId: context.extension.id,
secrets: context.secrets,
outputChannel,
outputChannel: openctxOutputChannel!,
features: isCodyWeb ? {} : { annotations: true, statusBar: true },
providers: isCodyWeb
? Observable.of(getCodyWebOpenCtxProviders())
Expand All @@ -102,6 +110,8 @@ export function exposeOpenCtxClient(
)
}

let openctxOutputChannel: vscode.OutputChannel | undefined

export function getOpenCtxProviders(
authStatusChanges: Observable<Pick<AuthStatus, 'endpoint'>>,
isValidSiteVersion: boolean
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"build-ts": "tsc --build"
},
"devDependencies": {
"@openctx/vscode-lib": "^0.0.24",
"@openctx/vscode-lib": "^0.0.25",
"@sourcegraph/cody": "workspace:*",
"@sourcegraph/cody-shared": "workspace:*",
"@sourcegraph/prompt-editor": "workspace:*",
Expand Down

0 comments on commit 5bd253c

Please sign in to comment.