fix: stop the facet preset naming a prompt variable the harness dropped

The preset's persona row copied the deployment's suffix, "Your working directory
is {{cwd}}". The harness substitutes only registered prompt variables and throws
on an unregistered one during prompt assembly — so when a harness release stopped
registering `cwd` (only `provider` and `model` remain), every session on this
preset failed its first turn with

  unknown prompt variable "{{cwd}}" in section "deployment:persona-suffix"

and chat was dead rather than degraded. The row now carries the prefix only.

The folder is stated where it can follow the session instead: the facet binding
already names the facet, and now names the session folder as well when the two
differ — which is every conversation that started higher up and was narrowed, and
exactly the case where relative tool paths need saying out loud.

`test/presets.test.js` makes this class of failure impossible to reintroduce
silently: it scans every shipped preset for a variable reference and requires the
name to be one the harness registers, and holds this bundle's own rule and
binding text to no references at all. Restoring the old suffix fails it.
This commit is contained in:
NotExpectedYet committed 2026-10-19 09:56:26 +01:00
1 parent c49acfdb2c
commit 4bc4296494
6 files changed
+131 -12

No files matched your search

+27 -4
View File
@@ -237,6 +237,27 @@ replaces the whole plugin list rather than merging into it, so the file is a
frozen copy of `standard` that will not follow the harness when `standard`
changes.
### Prompt variables, and why the preset's persona has no suffix
Both preset files used to copy the deployment's persona line, *Your working
directory is {{cwd}}*. The harness registers prompt variables per section and an
unregistered reference **throws during prompt assembly**, which fails the entire
turn — not a warning, not a literal left in the text. That is not a hypothetical:
a harness release stopped registering `cwd` (only `provider` and `model` remain),
and every session on this bundle's preset failed with
`unknown prompt variable "{{cwd}}" in section "deployment:persona-suffix"`.
So neither preset carries that suffix now, and the folder is stated where it can
follow the session instead: `facet-guard`'s runtime binding names the facet, and
names the session folder too when the two differ — which is exactly the case
where relative tool paths need saying out loud. `test/presets.test.js` scans both
files for `{{…}}` and fails on any name outside `provider, model`, and the same
test holds this bundle's own rule and binding text to no references at all.
If a *deployment* still fails with that message on a non-facet preset, the
reference is in the deployment's own `system-prompt` config (`personaSuffix`) or
in a copy of the shipped `standard` patch, not in this bundle.
## What it does not cover
Honest boundaries, because each one is a decision rather than an oversight:
@@ -264,7 +285,7 @@ Honest boundaries, because each one is a decision rather than an oversight:
Verified:
- 93 tests (`npm test`) over the scope algebra, the policy state, the guard, and
- 95 tests (`npm test`) over the scope algebra, the policy state, the guard, and
the browser half — including that containment is decided on canonical targets
(a symlink inside the facet pointing outside it is refused), that a prefix is
not a parent (`/a/room` does not contain `/a/roommate`), that a malformed tool
@@ -275,8 +296,10 @@ Verified:
is refused when the directory it defaults to is outside the facet, that a
delegated session inherits its parent's root at any depth and is not a way back
out of a self-narrowing, that both listings normalise into one picker level and
that a file listing the Host confines still leaves a browsable one, and that
every `facet` result satisfies the tool's own declared output schema.
that a file listing the Host confines still leaves a browsable one, that no
preset or contributed prompt text references a prompt variable the harness
does not register, and that every `facet` result satisfies the tool's own
declared output schema.
- The bundle's patch layers parse, merge and land correctly against the real
profile: `dsh --profile web --patch ./cordis.patch.yml --patch
./presets/facet.patch.yml --dump-config` shows `facet-policy`, `preset-facet`,
@@ -354,7 +377,7 @@ lib/scope.js the pure half — argument extraction, text, reason
lib/guard.js preset row: rule, binding, tool, pre-execute guard
presets/facet.patch.yml the `facet` agent preset
presets/standard-compaction.patch.yml optional: the same budget for `standard`
test/ 93 tests
test/ 95 tests
```
`client/client.js` is a browser half rather than a module the host imports, and