Replies: 1 comment
|
Verified against rc.7 ( 1. Confirmed at source:
2. Precision correction — settings.yaml is partially self-healing, cordis.patch.yml is not. The settings-file provider hot-publishes external edits with graceful degradation (
So the highest-value target is cordis.patch.yml pre-write validation, then settings.yaml syntax (not schema) checking. 3. Fix placement — where it belongs architecturally. Your Option A (intercept config writes) is the right shape but the intercept shouldn't be a new middleware — the existing seam is the fs write policy (
4. Option B ( 5. Family note. This is the config-file twin of the settings-seam security family I've been tracking (#1688 settings prototype pollution, #2445 redact-fail-open, #1559 .env credential redirection): the settings layer has validation and redaction, but the filesystem path around it is ungoverned. The agent having Good writeup — the three options are all viable; Option A in the policy slot + Option B as complement is the cleanest pairing, and both are small, testable, framework-layer changes. |
Uh oh!
There was an error while loading. Please reload this page.
Problem
Agent (the in-harness AI) can modify DSH configuration files (
settings.yaml,cordis.patch.yml, etc.) through thewrite/editfilesystem tools. However, these writes bypass the schema validation that the Settings Web UI enforces.The result: Agent writes a malformed config (wrong YAML structure, invalid provider nesting, duplicate loader entry ids, etc.), then restarts
dsh web, and DSH fails to start — with no clear error guidance in the browser. The user has to manually fix the file and restart.Root Cause
The settings layer (
dsh-settings+dsh-settings-file) has a complete schema + validate pipeline:z.objectschema (viaschemastery)validatecallback (e.g.,assertServiceableforllm-pi-ai) rejects invalid configs at write timepublish()gracefully degrades: if a stored section is invalid, it keeps the last good value and logs a warningBut this validation only runs on the
settings.mutate/settings.replacewrite path (i.e., when the user edits through the Web UI Settings page). Agent'swrite/edittools go throughfs.writeFiledirectly, completely bypassing the settings layer.Similarly,
cordis.patch.yml(the loader patch layer) has no schema validation at all — it's a raw YAML file parsed by the loader at boot time. Agent writes to it are blind.Reproduction Steps
settings.yaml(e.g., a newllm-pi-ai.providers.xxxentry)writetool has no such checkdsh --profile web(or similar restart command)settings.yaml, fix the structure, and restartEvidence
Config diff that triggered this issue
Old (working)
settings.yaml:After Agent edit — the
llm-deepseeksection was removed, provider reference changed tomy-provider, but the YAML structure was wrong (indentation/nesting issue in the provider config). DSH failed to start on next restart.Source code evidence
In
dsh-settings/lib/index.js:register()(line 311): stores schema + validate callbackwrite()(line 439): callsresolve()with validate, catches errors before persistpublish()(line 476): on external file change, gracefully degrades — keeps last good value if section is invalid (line 489-491)In
dsh-llm-pi-ai/lib/index.js:Configschema (line 1394):z.object({ providers: z.dict(profile).default({}) })assertServiceable()(line 1407): callsresolveProfiles()which checks provider names, baseURL, model ids, etc.installSettingsSection()(line 1846): registers the schema + validate callback with the settings serviceThe gap: all this validation is bypassed when Agent uses
write/editfilesystem tools instead of the settings API.Proposed Solutions
Option A: Intercept config file writes
Add a file-write hook or a
dsh-fsmiddleware that intercepts writes to known config files (settings.yaml,cordis.patch.yml) and runs a pre-write validation:Option B: Pre-restart config check
Add a
dsh --check-configcommand that validates all config files against their registered schemas, and make it a required step before anydsh webrestart:dsh --check-configbefore restartdsh-cordis-host-runnerordsh-app-bootpluginOption C: Tool-level protected paths
Add a
dsh-tool-fsconfiguration option that lists "protected file paths" — files whose writes are validated against a registered schema or a YAML syntax check, and rejected if invalid.Related
dsh-settings-fileREADME: validates at settings API level, not filesystem leveldsh-plugin-guard(community): protects against bad plugin installs, but not config file writesdsh-doctor(community): post-hoc diagnostics, not pre-write validationDiscussion
This is a structural gap: DSH's "everything is a plugin" philosophy means Agent is a first-class citizen with filesystem access, but the validation layer that protects config files from human editors is not extended to Agent's own write tools. The fix should be in the framework layer, not pushed to individual AGENTS.md rules.
All reactions