fix: apply runtime telemetry settings to web and remote clients
DS Web and remote Agent launch paths omitted shared telemetry opt-out settings. Reuse one environment definition for local launches, remote runtime profiles, and the remote model bridge helper while preserving existing update controls and user-requested networking. Validation: 16 focused tests passed at commit time. Prior local real-model validation passed; modified Agent real-Host validation and background network monitoring remain outstanding. Release note: 补齐 DS Web 与远程 Runtime 启动时的遥测关闭配置,保留现有自动更新关闭设置,不影响模型、MCP 和用户主动联网请求。
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { runtimePrivacyEnvironment } from '../shared/runtime-privacy-environment'
|
||||
import { randomBytes, randomUUID } from 'node:crypto'
|
||||
import { spawn as nodeSpawn } from 'node:child_process'
|
||||
import { mkdtemp, writeFile, rm } from 'node:fs/promises'
|
||||
@@ -931,7 +932,9 @@ function credentialFreeHelperEnvironment(
|
||||
'XDG_STATE_HOME'
|
||||
] as const
|
||||
const environment: NodeJS.ProcessEnv = {
|
||||
...runtimePrivacyEnvironment,
|
||||
OPENCODE_CONFIG_CONTENT: config,
|
||||
|
||||
OPENCODE_ENABLE_QUESTION_TOOL: 'true'
|
||||
}
|
||||
for (const name of allowed) {
|
||||
|
||||
@@ -60,6 +60,11 @@ describe('OpenCode direct launch profile', () => {
|
||||
workMode
|
||||
})
|
||||
const config = JSON.parse(profile.env.OPENCODE_CONFIG_CONTENT!)
|
||||
expect(profile.env).toMatchObject({
|
||||
DO_NOT_TRACK: '1', OTEL_SDK_DISABLED: 'true',
|
||||
OTEL_LOGS_EXPORTER: 'none', OTEL_METRICS_EXPORTER: 'none', OTEL_TRACES_EXPORTER: 'none',
|
||||
OPENCODE_DISABLE_AUTOUPDATE: '1', OPENCODE_DISABLE_MODELS_FETCH: '1'
|
||||
})
|
||||
expect(config.snapshot).toBe(false)
|
||||
expect(config.permission).toBe(workMode === 'ask' ? 'ask' : 'allow')
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { runtimePrivacyEnvironment } from "../shared/runtime-privacy-environment";
|
||||
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
||||
import {
|
||||
OPENCODE_REMOTE_RUNTIME_ENVIRONMENT_NAMES,
|
||||
@@ -148,6 +149,7 @@ export function createOpenCodeLaunchProfile(input: {
|
||||
|
||||
const environmentBase = {
|
||||
...executeEnvironment(process.env, workspaceDirectory),
|
||||
...runtimePrivacyEnvironment,
|
||||
...(isContinue ? {} : { ...OPEN_CODE_RUNTIME_ENVIRONMENT,
|
||||
OPENCODE_CONFIG_DIR: join(bundleDirectory, "config", "opencode") }),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user