Remove unsupported Zcode settings option

Zcode 0.16.1 advertises --settings but rejects it, so restore native default configuration and prevent failed invocations.

Checks: native CLI and adapter against an isolated local mock; Zcode and frontend tests; desktop pack.
This commit is contained in:
Ryder Sun committed 2026-11-07 00:58:26 +08:00
1 parent 936af81088
commit ce7741bd5d
10 files changed
+13 -56

No files matched your search

@@ -177,7 +177,6 @@ function invocation(kind, executable, workdir, sessionRef = '', options = {}) {
command: executable,
args: ['--json', '--no-color', '--verbose', '--cwd', workdir,
'--mode', options.sandbox === 'workspace-write' ? 'edit' : 'plan',
...(options.nativeSettingsFile ? ['--settings', options.nativeSettingsFile] : []),
...(sessionRef ? ['--resume', sessionRef] : []), '--prompt'],
promptArg: true,
}
+1 -1
View File
@@ -371,7 +371,7 @@ function nativeCredentialState(kind, options = {}) {
}
const jsonFiles = {
zcode: [options.nativeSettingsFile || path.join(home, '.zcode', 'cli', 'config.json')],
zcode: [path.join(home, '.zcode', 'cli', 'config.json')],
codex: [path.join(codexHome, 'auth.json'), path.join(codexHome, 'config.json')],
hermes: [path.join(hermesHome, 'auth.json'), path.join(hermesHome, 'config.json')],
openclaw: [path.join(home, '.openclaw', 'openclaw.json')],
+2 -12
View File
@@ -8,7 +8,6 @@ const NATIVE_CONFIG_DIRECTORIES = Object.freeze({
pi: { key: 'PI_CODING_AGENT_DIR', files: ['settings.json', 'auth.json', 'models.json'] },
deepseek: { key: 'DSH_HOME', files: ['cordis.patch.yml', '.credentials.yaml'], directories: ['profiles'] },
workbuddy: { key: 'CODEBUDDY_CONFIG_DIR', files: ['models.json', 'settings.json', '.credentials.json'] },
zcode: { files: ['config.json'] },
})
function nativeConfigEnvironment(kind, preferences, env = {}) {
@@ -17,16 +16,7 @@ function nativeConfigEnvironment(kind, preferences, env = {}) {
if (!spec || directory === undefined || directory === '') return env
if (typeof directory !== 'string' || directory.length > 4096
|| directory.includes('\u0000') || !path.isAbsolute(directory)) throw new Error('LOCAL_NATIVE_CONFIG_INVALID')
return spec.key ? { ...env, [spec.key]: directory } : env
}
function nativeConfigSettingsFile(kind, preferences) {
if (kind !== 'zcode') return ''
const directory = preferences?.zcode?.nativeConfigDirectory
if (directory === undefined || directory === '') return ''
if (typeof directory !== 'string' || directory.length > 4096
|| directory.includes('\u0000') || !path.isAbsolute(directory)) throw new Error('LOCAL_NATIVE_CONFIG_INVALID')
return path.join(directory, 'config.json')
return { ...env, [spec.key]: directory }
}
function validateNativeConfigDirectory(kind, directory) {
@@ -46,4 +36,4 @@ function validateNativeConfigDirectory(kind, directory) {
return resolved
}
module.exports = { NATIVE_CONFIG_DIRECTORIES, nativeConfigEnvironment, nativeConfigSettingsFile, validateNativeConfigDirectory }
module.exports = { NATIVE_CONFIG_DIRECTORIES, nativeConfigEnvironment, validateNativeConfigDirectory }
+1 -6
View File
@@ -4,7 +4,7 @@ const fs = require('node:fs')
const path = require('node:path')
const { redactSecrets } = require('./security/secret-redaction.cjs')
const { ensurePrivateDirectory } = require('./security/private-file.cjs')
const { NATIVE_CONFIG_DIRECTORIES, nativeConfigEnvironment, nativeConfigSettingsFile } = require('./agents/native-config-directory.cjs')
const { NATIVE_CONFIG_DIRECTORIES, nativeConfigEnvironment } = require('./agents/native-config-directory.cjs')
const { AttachmentStore } = require('./attachments/attachment-store.cjs')
const { ContentBlobStore } = require('./attachments/content-blob-store.cjs')
const { ContextPackStore } = require('./collaboration/context-pack-store.cjs')
@@ -248,7 +248,6 @@ async function nativeShellEnvironment(options = {}) {
const resolved = await resolveNativeShellEnvironment({ home, refresh: options.refresh === true })
const env = { ...process.env, ...resolved.env }
for (const [kind, { key }] of Object.entries(NATIVE_CONFIG_DIRECTORIES)) {
if (!key) continue
const directory = typeof env[key] === 'string' ? env[key] : ''
if ((nativeSkillDirectories[key] || '') !== directory) skillCatalog?.invalidate(kind)
nativeSkillDirectories[key] = directory
@@ -400,9 +399,6 @@ async function runCoreAgent(agent, prompt, workdir, options = {}) {
: {}
return runAgent(agent, prompt, workdir, {
...runOptions,
...(connectorCredentialIsolation ? {} : {
nativeSettingsFile: nativeConfigSettingsFile(agent.kind, workspace?.state.agentPreferences),
}),
...injected,
env: {
...networkEnvironment(shellEnvironment?.env),
@@ -582,7 +578,6 @@ function createWorkspace() {
env: nativeConfigEnvironment(kind, workspace?.state.agentPreferences, shellEnvironment.env),
home: shellEnvironment.home,
credentialSource: shellEnvironment.source,
nativeSettingsFile: nativeConfigSettingsFile(kind, workspace?.state.agentPreferences),
...(kind === 'workbuddy' ? { modelId: workspace?.state.agentPreferences.workbuddy?.modelId } : {}),
})
},
@@ -19,6 +19,13 @@ test('Zcode prompts explicitly select permissions and only resume the requested
}
})
test('Zcode does not receive the unsupported settings flag', () => {
// Zcode 0.16.1 advertises --settings in help but rejects it at runtime.
const spec = invocation('zcode', '/bin/zcode', '/tmp/work', '', { nativeSettingsFile: '/tmp/config.json' })
assert.equal(spec.args.includes('--settings'), false)
assert.equal(spec.args.includes('/tmp/config.json'), false)
})
test('Zcode reports its explicit missing-provider credential without a write retry', () => {
assert.equal(failedAgentProcessError('ProviderBusinessError: [1113][Insufficient balance or no resource package. Please recharge.]',
{ kind: 'zcode' }).code, 'LOCAL_AGENT_PROVIDER_QUOTA_EXHAUSTED')
@@ -3,9 +3,7 @@ const assert = require('node:assert/strict')
const fs = require('node:fs')
const os = require('node:os')
const path = require('node:path')
const { nativeConfigEnvironment, nativeConfigSettingsFile, validateNativeConfigDirectory } = require('../../src/agents/native-config-directory.cjs')
const { nativeCredentialState } = require('../../src/agents/local-agent-readiness.cjs')
const { invocation } = require('../../src/agents/cli/cli-invocations.cjs')
const { nativeConfigEnvironment, validateNativeConfigDirectory } = require('../../src/agents/native-config-directory.cjs')
const { loadWorkspaceState, saveWorkspaceState } = require('../../src/workspace/local-workspace-state.cjs')
test('validates a selected native directory and scopes it to the owning Agent', t => {
@@ -46,24 +44,6 @@ test('DeepSeek Harness accepts its native profiles directory and scopes DSH_HOME
assert.deepEqual(nativeConfigEnvironment('hermes', preferences), {})
})
test('Zcode selected configuration drives native detection and the settings argument', t => {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'meldwork-zcode-config-'))
t.after(() => fs.rmSync(directory, { recursive: true, force: true }))
assert.throws(() => validateNativeConfigDirectory('zcode', directory), { message: 'LOCAL_NATIVE_CONFIG_INVALID' })
fs.writeFileSync(path.join(directory, 'config.json'), JSON.stringify({ provider: { apiKey: 'test-secret' } }))
const selected = validateNativeConfigDirectory('zcode', directory)
const preferences = { zcode: { nativeConfigDirectory: selected } }
const settingsFile = nativeConfigSettingsFile('zcode', preferences)
assert.equal(settingsFile, path.join(selected, 'config.json'))
assert.deepEqual(nativeConfigEnvironment('zcode', preferences, { PATH: '/bin' }), { PATH: '/bin' })
assert.equal(nativeCredentialState('zcode', { home: directory, env: {}, nativeSettingsFile: settingsFile }).state, 'ready')
const args = invocation('zcode', '/native/zcode', '/workspace', '', { nativeSettingsFile: settingsFile }).args
assert.equal(args[args.indexOf('--settings') + 1], settingsFile)
assert.equal(invocation('zcode', '/native/zcode', '/workspace').args.includes('--settings'), false)
assert.throws(() => nativeConfigSettingsFile('zcode', { zcode: { nativeConfigDirectory: 'relative' } }),
{ message: 'LOCAL_NATIVE_CONFIG_INVALID' })
})
for (const [kind, key, file] of [
['codex', 'CODEX_HOME', 'config.toml'],
['claude', 'CLAUDE_CONFIG_DIR', 'settings.json'],
@@ -59,15 +59,3 @@ it('explains the WorkBuddy directory requirements', async () => {
expect(wrapper.get('[role="alert"]').text()).toContain('models.json')
wrapper.unmount()
})
it('explains the Zcode directory requirements', async () => {
const api = { get: vi.fn().mockResolvedValue({ directory: '' }),
choose: vi.fn().mockRejectedValue(new Error('LOCAL_NATIVE_CONFIG_INVALID')) }
window.meldworkDesktop = { localAgentNativeConfig: api }
const wrapper = mount(AgentNativeConfig, { props: { kind: 'zcode' } })
await flushPromises()
await wrapper.findAll('button').find(button => button.text() === t('nativeConfig.choose')).trigger('click')
await flushPromises()
expect(wrapper.get('[role="alert"]').text()).toContain('config.json')
wrapper.unmount()
})
@@ -353,7 +353,7 @@ import AgentNativeConfig from './AgentNativeConfig.vue'
import { desktopApi } from '../desktop.js'
const nativeConfigAvailable = Boolean(desktopApi()?.localAgentNativeConfig)
const nativeConfigKinds = ['hermes', 'codex', 'claude', 'pi', 'deepseek', 'workbuddy', 'zcode']
const nativeConfigKinds = ['hermes', 'codex', 'claude', 'pi', 'deepseek', 'workbuddy']
const props = defineProps({
-1
View File
@@ -10,7 +10,6 @@ export default {
'nativeConfig.expected.pi': 'Expected settings.json, auth.json or models.json.',
'nativeConfig.expected.deepseek': 'Expected a profiles directory, cordis.patch.yml or .credentials.yaml.',
'nativeConfig.expected.workbuddy': 'Expected models.json, settings.json or .credentials.json.',
'nativeConfig.expected.zcode': 'Expected config.json.',
'skillTrust.title': 'Skill trust',
'skillTrust.hint': 'Review trust granted to an Agent and exact Skill content. Changed content requires approval again.',
'skillTrust.refresh': 'Refresh',
-1
View File
@@ -10,7 +10,6 @@ export default {
'nativeConfig.expected.pi': '需要 settings.json、auth.json 或 models.json。',
'nativeConfig.expected.deepseek': '需要 profiles 目录、cordis.patch.yml 或 .credentials.yaml。',
'nativeConfig.expected.workbuddy': '需要 models.json、settings.json 或 .credentials.json。',
'nativeConfig.expected.zcode': '需要 config.json。',
'skillTrust.title': 'Skill 信任',
'skillTrust.hint': '查看按 Agent 和内容绑定的信任授权。内容变化后需要重新授权。',
'skillTrust.refresh': '刷新',