fix: override the shipped standard preset in the compaction overlay
Release / release (push) Successful in 9s
Release / release (push) Successful in 9s
`presets/standard-compaction.patch.yml` inserted a second `preset-standard` declaration. It happened to take effect because it applied last, but which of the two declarations mounted was decided by the loader's duplicate-id handling, and the composed tree carried two rows with the same id. The file now overrides the shipped row by id, so the intent is explicit and only one declaration exists. `test/presets.test.js` composes the shipped declaration and the overlay through the harness's own patch engine and asserts one row, no skipped patch, and the compaction budget applied — which the old insert form no longer satisfies.
This commit is contained in:
1 parent
40574505f2
commit
387f7c3510
2 files changed
+164
-124
No files matched your search
@@ -8,6 +8,12 @@
|
|||||||
#
|
#
|
||||||
# or add its path to `dsh.bundle.patch` in package.json.
|
# or add its path to `dsh.bundle.patch` in package.json.
|
||||||
#
|
#
|
||||||
|
# It overrides the shipped `preset-standard` row by id rather than inserting a
|
||||||
|
# second declaration. With two rows carrying the same preset id, which one mounts
|
||||||
|
# is decided by the loader's duplicate-id handling rather than by the patch — the
|
||||||
|
# insert form worked only as long as that ordering held. The override is explicit
|
||||||
|
# and must be applied after the web-app layer, which both ways above are.
|
||||||
|
#
|
||||||
# It is deliberately not applied for you, and the reason is a real hazard rather
|
# It is deliberately not applied for you, and the reason is a real hazard rather
|
||||||
# than caution: a preset declaration replaces the whole plugin list, never merges
|
# than caution: a preset declaration replaces the whole plugin list, never merges
|
||||||
# into it, so this file is a frozen copy of the shipped `standard` composition
|
# into it, so this file is a frozen copy of the shipped `standard` composition
|
||||||
@@ -21,135 +27,134 @@
|
|||||||
# The one change from the shipped file is the `compaction-basic` row's config.
|
# The one change from the shipped file is the `compaction-basic` row's config.
|
||||||
# `test/presets.test.js` compares this file against the installed `standard`
|
# `test/presets.test.js` compares this file against the installed `standard`
|
||||||
# and fails on any other difference.
|
# and fails on any other difference.
|
||||||
- insert:
|
- id: preset-standard
|
||||||
- id: preset-standard
|
name: '@deepseek-ai/dsh-agent-preset'
|
||||||
name: '@deepseek-ai/dsh-agent-preset'
|
config:
|
||||||
config:
|
id: standard
|
||||||
id: standard
|
order: 1
|
||||||
order: 1
|
plugins:
|
||||||
plugins:
|
- id: persona
|
||||||
- id: persona
|
name: '@deepseek-ai/dsh-persona'
|
||||||
name: '@deepseek-ai/dsh-persona'
|
config:
|
||||||
|
prefix: You are a coding agent powered by the {{model}} model.
|
||||||
|
- id: agent-instructions
|
||||||
|
name: '@deepseek-ai/dsh-agent-instructions'
|
||||||
|
config:
|
||||||
|
maxBytes: 65536
|
||||||
|
- id: time-context
|
||||||
|
name: '@deepseek-ai/dsh-time-context'
|
||||||
|
- id: tool-bash
|
||||||
|
name: '@deepseek-ai/dsh-tool-bash'
|
||||||
|
disabled: !!js process.platform === 'win32'
|
||||||
|
- id: tool-pwsh
|
||||||
|
name: '@deepseek-ai/dsh-tool-pwsh'
|
||||||
|
disabled: !!js process.platform !== 'win32'
|
||||||
|
- id: tool-fs
|
||||||
|
name: '@deepseek-ai/dsh-tool-fs'
|
||||||
|
config:
|
||||||
|
# Set false to drop the apply_patch tool beside edit.
|
||||||
|
applyPatch: false
|
||||||
|
- id: tool-fs-search
|
||||||
|
name: '@deepseek-ai/dsh-tool-fs-search'
|
||||||
|
config:
|
||||||
|
sampleOverCapGlobResults: false
|
||||||
|
- id: tool-jobs
|
||||||
|
name: '@deepseek-ai/dsh-tool-jobs'
|
||||||
|
- id: tool-schedule
|
||||||
|
name: '@deepseek-ai/dsh-tool-schedule'
|
||||||
|
- id: skill-filesystem
|
||||||
|
name: '@deepseek-ai/dsh-skill-filesystem'
|
||||||
|
- id: tool-skill
|
||||||
|
name: '@deepseek-ai/dsh-tool-skill'
|
||||||
|
- id: command-goal
|
||||||
|
name: '@deepseek-ai/dsh-command-goal'
|
||||||
|
- id: tool-goal
|
||||||
|
name: '@deepseek-ai/dsh-tool-goal'
|
||||||
|
- id: planning
|
||||||
|
name: cordis:group
|
||||||
|
group: true
|
||||||
|
isolate:
|
||||||
|
planMode: true
|
||||||
|
config:
|
||||||
|
- id: plan-mode
|
||||||
|
name: '@deepseek-ai/dsh-plan-mode'
|
||||||
config:
|
config:
|
||||||
prefix: You are a coding agent powered by the {{model}} model.
|
section: |
|
||||||
- id: agent-instructions
|
You are in plan mode. Stay in plan mode until the user approves your plan through exit_plan_mode or switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
|
||||||
name: '@deepseek-ai/dsh-agent-instructions'
|
|
||||||
config:
|
|
||||||
maxBytes: 65536
|
|
||||||
- id: time-context
|
|
||||||
name: '@deepseek-ai/dsh-time-context'
|
|
||||||
- id: tool-bash
|
|
||||||
name: '@deepseek-ai/dsh-tool-bash'
|
|
||||||
disabled: !!js process.platform === 'win32'
|
|
||||||
- id: tool-pwsh
|
|
||||||
name: '@deepseek-ai/dsh-tool-pwsh'
|
|
||||||
disabled: !!js process.platform !== 'win32'
|
|
||||||
- id: tool-fs
|
|
||||||
name: '@deepseek-ai/dsh-tool-fs'
|
|
||||||
config:
|
|
||||||
# Set false to drop the apply_patch tool beside edit.
|
|
||||||
applyPatch: false
|
|
||||||
- id: tool-fs-search
|
|
||||||
name: '@deepseek-ai/dsh-tool-fs-search'
|
|
||||||
config:
|
|
||||||
sampleOverCapGlobResults: false
|
|
||||||
- id: tool-jobs
|
|
||||||
name: '@deepseek-ai/dsh-tool-jobs'
|
|
||||||
- id: tool-schedule
|
|
||||||
name: '@deepseek-ai/dsh-tool-schedule'
|
|
||||||
- id: skill-filesystem
|
|
||||||
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
||||||
- id: tool-skill
|
|
||||||
name: '@deepseek-ai/dsh-tool-skill'
|
|
||||||
- id: command-goal
|
|
||||||
name: '@deepseek-ai/dsh-command-goal'
|
|
||||||
- id: tool-goal
|
|
||||||
name: '@deepseek-ai/dsh-tool-goal'
|
|
||||||
- id: planning
|
|
||||||
name: cordis:group
|
|
||||||
group: true
|
|
||||||
isolate:
|
|
||||||
planMode: true
|
|
||||||
config:
|
|
||||||
- id: plan-mode
|
|
||||||
name: '@deepseek-ai/dsh-plan-mode'
|
|
||||||
config:
|
|
||||||
section: |
|
|
||||||
You are in plan mode. Stay in plan mode until the user approves your plan through exit_plan_mode or switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
|
|
||||||
|
|
||||||
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
|
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
|
||||||
|
|
||||||
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
|
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
|
||||||
|
|
||||||
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
|
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
|
||||||
|
|
||||||
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
|
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
|
||||||
|
|
||||||
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
|
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
|
||||||
- id: compaction
|
- id: compaction
|
||||||
name: cordis:group
|
name: cordis:group
|
||||||
group: true
|
group: true
|
||||||
isolate:
|
isolate:
|
||||||
compaction: true
|
compaction: true
|
||||||
toolResultPruner: true
|
toolResultPruner: true
|
||||||
|
config:
|
||||||
|
- id: compaction-basic
|
||||||
|
name: '@deepseek-ai/dsh-compaction-basic'
|
||||||
config:
|
config:
|
||||||
- id: compaction-basic
|
# See presets/facet.patch.yml for why these three values.
|
||||||
name: '@deepseek-ai/dsh-compaction-basic'
|
thresholdRatio: 0.35
|
||||||
config:
|
retainTokens: 80000
|
||||||
# See presets/facet.patch.yml for why these three values.
|
maxTokens: 16384
|
||||||
thresholdRatio: 0.35
|
- id: command-compact
|
||||||
retainTokens: 80000
|
name: '@deepseek-ai/dsh-command-compact'
|
||||||
maxTokens: 16384
|
- id: tool-result-pruner
|
||||||
- id: command-compact
|
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
||||||
name: '@deepseek-ai/dsh-command-compact'
|
|
||||||
- id: tool-result-pruner
|
|
||||||
name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
|
|
||||||
config:
|
|
||||||
thresholdChars: 8192
|
|
||||||
headChars: 4096
|
|
||||||
tailChars: 1024
|
|
||||||
- id: delegation
|
|
||||||
name: cordis:group
|
|
||||||
group: true
|
|
||||||
isolate:
|
|
||||||
workflowEngine: true
|
|
||||||
config:
|
config:
|
||||||
- id: tool-subagent-control
|
thresholdChars: 8192
|
||||||
name: '@deepseek-ai/dsh-tool-subagent-control'
|
headChars: 4096
|
||||||
- id: tool-subagent
|
tailChars: 1024
|
||||||
name: '@deepseek-ai/dsh-tool-subagent'
|
- id: delegation
|
||||||
config:
|
name: cordis:group
|
||||||
provider: spawn
|
group: true
|
||||||
toolName: subagent
|
isolate:
|
||||||
modelSelection: true
|
workflowEngine: true
|
||||||
modelDiscovery: true
|
config:
|
||||||
- id: tool-subagent-fork
|
- id: tool-subagent-control
|
||||||
name: '@deepseek-ai/dsh-tool-subagent'
|
name: '@deepseek-ai/dsh-tool-subagent-control'
|
||||||
config:
|
- id: tool-subagent
|
||||||
provider: fork
|
name: '@deepseek-ai/dsh-tool-subagent'
|
||||||
toolName: subagent_fork
|
|
||||||
- id: workflow-ptc
|
|
||||||
name: '@deepseek-ai/dsh-workflow-ptc'
|
|
||||||
config:
|
|
||||||
provider: spawn
|
|
||||||
- id: tool-workflow
|
|
||||||
name: '@deepseek-ai/dsh-tool-workflow'
|
|
||||||
- id: tool-ask-user
|
|
||||||
name: '@deepseek-ai/dsh-tool-ask-user'
|
|
||||||
- id: tool-todo
|
|
||||||
name: '@deepseek-ai/dsh-tool-todo'
|
|
||||||
config:
|
config:
|
||||||
allowParallelInProgress: true
|
provider: spawn
|
||||||
- id: tool-web
|
toolName: subagent
|
||||||
name: '@deepseek-ai/dsh-tool-web'
|
modelSelection: true
|
||||||
|
modelDiscovery: true
|
||||||
|
- id: tool-subagent-fork
|
||||||
|
name: '@deepseek-ai/dsh-tool-subagent'
|
||||||
config:
|
config:
|
||||||
fetch: true
|
provider: fork
|
||||||
searchTimeoutMs: 60000
|
toolName: subagent_fork
|
||||||
- id: present
|
- id: workflow-ptc
|
||||||
name: '@deepseek-ai/dsh-tool-present'
|
name: '@deepseek-ai/dsh-workflow-ptc'
|
||||||
- id: tool-plugin-manager
|
config:
|
||||||
name: '@deepseek-ai/dsh-plugin-manager/tools'
|
provider: spawn
|
||||||
disabled: !!js "!ctx.get('profileContext')"
|
- id: tool-workflow
|
||||||
- id: tool-plugin-market
|
name: '@deepseek-ai/dsh-tool-workflow'
|
||||||
name: '@deepseek-ai/dsh-plugin-market/tools'
|
- id: tool-ask-user
|
||||||
disabled: true
|
name: '@deepseek-ai/dsh-tool-ask-user'
|
||||||
|
- id: tool-todo
|
||||||
|
name: '@deepseek-ai/dsh-tool-todo'
|
||||||
|
config:
|
||||||
|
allowParallelInProgress: true
|
||||||
|
- id: tool-web
|
||||||
|
name: '@deepseek-ai/dsh-tool-web'
|
||||||
|
config:
|
||||||
|
fetch: true
|
||||||
|
searchTimeoutMs: 60000
|
||||||
|
- id: present
|
||||||
|
name: '@deepseek-ai/dsh-tool-present'
|
||||||
|
- id: tool-plugin-manager
|
||||||
|
name: '@deepseek-ai/dsh-plugin-manager/tools'
|
||||||
|
disabled: !!js "!ctx.get('profileContext')"
|
||||||
|
- id: tool-plugin-market
|
||||||
|
name: '@deepseek-ai/dsh-plugin-market/tools'
|
||||||
|
disabled: true
|
||||||
+37
-2
@@ -3,7 +3,7 @@ import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
|||||||
import { createRequire } from 'node:module'
|
import { createRequire } from 'node:module'
|
||||||
import { dirname, join } from 'node:path'
|
import { dirname, join } from 'node:path'
|
||||||
import { test } from 'node:test'
|
import { test } from 'node:test'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
||||||
|
|
||||||
import yaml from 'js-yaml'
|
import yaml from 'js-yaml'
|
||||||
|
|
||||||
@@ -86,6 +86,9 @@ const HARNESS_SCOPES = harnessScopes()
|
|||||||
const STANDARD_PRESET = HARNESS_SCOPES
|
const STANDARD_PRESET = HARNESS_SCOPES
|
||||||
.map((scope) => join(scope, '@deepseek-ai', 'dsh-web-app', 'presets', 'standard.patch.yml'))
|
.map((scope) => join(scope, '@deepseek-ai', 'dsh-web-app', 'presets', 'standard.patch.yml'))
|
||||||
.find((file) => existsSync(file))
|
.find((file) => existsSync(file))
|
||||||
|
const APP_BOOT = HARNESS_SCOPES
|
||||||
|
.map((scope) => join(scope, '@deepseek-ai', 'dsh-app-boot', 'lib', 'index.js'))
|
||||||
|
.find((file) => existsSync(file))
|
||||||
|
|
||||||
const SKIP_DRIFT =
|
const SKIP_DRIFT =
|
||||||
HARNESS_SCOPES.length === 0
|
HARNESS_SCOPES.length === 0
|
||||||
@@ -102,7 +105,10 @@ const PRESET_SCHEMA = yaml.DEFAULT_SCHEMA.extend([
|
|||||||
/** The plugin rows of a single-preset patch file, as written. */
|
/** The plugin rows of a single-preset patch file, as written. */
|
||||||
function presetPlugins(file) {
|
function presetPlugins(file) {
|
||||||
const [patch] = yaml.load(readFileSync(file, 'utf8'), { schema: PRESET_SCHEMA })
|
const [patch] = yaml.load(readFileSync(file, 'utf8'), { schema: PRESET_SCHEMA })
|
||||||
return patch.insert[0].config.plugins
|
// The facet preset is an insert; the optional overlay overrides the shipped
|
||||||
|
// row by id and carries the full config instead.
|
||||||
|
const declaration = patch.insert === undefined ? patch : patch.insert[0]
|
||||||
|
return declaration.config.plugins
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Drop absent keys, so a missing field and an undefined field compare the same. */
|
/** Drop absent keys, so a missing field and an undefined field compare the same. */
|
||||||
@@ -181,6 +187,35 @@ test('the standard-compaction overlay is the shipped standard composition plus t
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test(
|
||||||
|
'the standard-compaction overlay replaces the shipped preset instead of adding a second declaration',
|
||||||
|
{ skip: SKIP_DRIFT },
|
||||||
|
async (t) => {
|
||||||
|
if (APP_BOOT === undefined) return t.skip('the harness app-boot package was not found in any scope')
|
||||||
|
|
||||||
|
// Compose the way the launcher does: the shipped declaration first, then the
|
||||||
|
// overlay. A second declaration carrying the same preset id would register
|
||||||
|
// in the wrong order and lose — which is how this overlay used to do nothing.
|
||||||
|
const { composeEntries } = await import(pathToFileURL(APP_BOOT).href)
|
||||||
|
const standardPatch = yaml.load(readFileSync(STANDARD_PRESET, 'utf8'), { schema: PRESET_SCHEMA })
|
||||||
|
const overlayPatch = yaml.load(readFileSync(COMPACTION_PRESET, 'utf8'), { schema: PRESET_SCHEMA })
|
||||||
|
const warnings = []
|
||||||
|
const entries = composeEntries([standardPatch, overlayPatch], (message) => warnings.push(message))
|
||||||
|
|
||||||
|
assert.deepEqual(warnings, [], 'the overlay applies without a skipped patch')
|
||||||
|
const declarations = entries.filter((entry) => entry.id === 'preset-standard')
|
||||||
|
assert.equal(
|
||||||
|
declarations.length,
|
||||||
|
1,
|
||||||
|
'the overlay overrides the row; a second declaration would be ignored by the registry',
|
||||||
|
)
|
||||||
|
assert.deepEqual(
|
||||||
|
rowById(declarations[0].config.plugins, 'compaction-basic')?.config,
|
||||||
|
COMPACTION_BUDGET,
|
||||||
|
'the applied overlay carries the compaction budget',
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
/** Every row's id and module specifier, groups included. */
|
/** Every row's id and module specifier, groups included. */
|
||||||
function namedRows(rows) {
|
function namedRows(rows) {
|
||||||
return rows.flatMap((row) => [
|
return rows.flatMap((row) => [
|
||||||
|
|||||||
Reference in new issue
Block a user