Skip to content

Correct the dor specs; surface tool-config warnings on first run; drop dead CLI surface - #713

Draft
nedtwigg wants to merge 3 commits into
specs-remote-auditfrom
specs-dor-audit
Draft

nedtwigg wants to merge 3 commits into
specs-remote-auditfrom
specs-dor-audit

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Sep 20, 2026

Copy link
Copy Markdown
Member

Spec audit, group 5 (dor-cli / dor-browser / dor-tool). Stacked on #712 (the spec-audit PRs merge in order #708#715); independent of the alert series.

Commit 1 — docs and generated help. Corrections: dor list --workspaces also takes --window (spec, help prose, regenerated snapshot); browser leaves persist far more than url; open-window intercepts every non-_self target; a Future item cited a phase that does not exist; msysToWindowsCwd backs five commands; the edit chords go through the host channel on every platform; the memory trust store when DORMOUSE_STATE_DIR is unset; two unstated parse rejections; the helper-less condition on in-place replacement; and more. Condensed ≈800 words: the Agent Workflows table (already in dor/skill.md → Recipes), the QC log in the tool rationale, two-stage-paint / pop-out / dev-server-chip / spawn mechanics → the modules that already carry them, the control-socket rules already audited in security-local.md, the routing rules now owned by standalone.md alone.

Commit 2 — code.

  • Bug: tool config warnings (unknown fields, keys missing $PROJECT_ROOT/$TARGET, ignored open rules) were generated and thrown away on the normal first-run path (untrusted → approve) and on the built-in viewer path. ToolLookup now carries warnings on every outcome; tests added.
  • dor tool reported the caller's cwd for a reused match; it now reports the match's own.
  • contextPortKey declared in BrowserPanelParams (it was persisted but undeclared).
  • The iframe-move refusal names the Workspace-stable surface:N.
  • parseToolAnnounce refuses a present v ≠ 1 (an omitted v still reads as 1 so shipped emitters keep working).
  • Deleted: the undocumented --id-format uuids alias, agentBrowserBringToFront (declared, called, implemented by no host). parseWorkspaceRef.positionnumber, with the VS Code positional fallback behind a named helper.

Budgets: dor-cli 6250→5550, dor-browser 4700→4550.

Deferred: the two meanings of --surface (a breaking CLI change).

🤖 Generated with Claude Code

nedtwigg and others added 2 commits September 20, 2026 00:45
Fifteen inaccuracies found auditing `dor-cli.md`, `dor-browser.md`, and
`dor-tool.md` against what ships, plus a condensation pass that moves mechanism
to the code comments that already carry it.

Corrections: `dor list --workspaces` takes `--window` as well as `--json` (the
generated help said otherwise too); a browser leaf persists every param, only
its document is lost on restart; the iframe shim intercepts every anchor target
but `_self`, not just `_blank`; `msysToWindowsCwd` backs five commands and
`--workspace` reaches `tool` and `open`; the select-all/copy/cut chords go
through the host edit channel on every platform, not only macOS; a host with no
state directory keeps Tool grants in memory; two `prespawn_dedupe` rejections
were unstated; replace-in-place also requires a helper-less caller; the Display
modal is not the sole render-mode GUI and the tab strip needs two tabs; the
`abDebugLogs` flag is read lazily, not at module load; `dor-browser.md` cited a
`## Future` phase that does not exist and `dor-tool.md`'s D2 bullet was garbled;
`--has terminal`/`--has browser` is a missing filter, not a missing field.

Condensation keeps every invariant and drops duplication: the Agent Workflows
table is `dor/skill.md`'s Recipes, the control-socket rules are
`security-local.md`'s, the standalone routing rules are `standalone.md`'s, and
the spawn, dev-server, screenshot-loop, pop-out, and iframe mechanisms are
stated where they are implemented. `dor-cli.md` 6205 -> 5532 words,
`dor-browser.md` 4651 -> 4518, `dor-tool.md` 4026 -> 4013; budgets ratcheted.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e dead handles

Tool configuration warnings were generated and thrown away on the path users
hit first. `lookupTool`'s `untrusted` answer carried no `warnings` at all and
`resolveOpenTool` hardcoded an empty list for the built-in viewer, so a lint
about an unknown field or a `$PROJECT_ROOT`-less key reached the caller only on
a later already-trusted invocation. Every lookup outcome that parsed a
configuration file now carries that file's warnings, and the renderer reports
them with the `pending` answer — the only answer the first run of an
unapproved Tool ever receives.

Also:

- `dor tool` reported the caller's directory for a reused match, while the
  restart it had just performed ran in the match's own directory.
- The Workspace-move refusal named its iframe Surfaces by internal pane id;
  `iframeSurfaceIds` becomes `iframeSurfaceRefs` so the message quotes the
  `surface:N` a caller can act on, like every other message.
- `parseToolAnnounce` ignored `v`, leaving a future `serve` v2 no rejection
  path. An omitted `v` is still v1 — the shipped shape — but any other value
  is refused whole.
- `contextPortKey` is persisted on browser surfaces and was declared nowhere;
  it joins `BrowserPanelParams` and the spec's canonical list.
- `parseWorkspaceRef`'s `position` is renamed `number`: on a registry host it
  is not a position at all, and the positional reading moves behind
  `workspaceByNumber`, which names the VS Code condition it exists for.
- Deleted: the `--id-format uuids` alias (undocumented, used nowhere, pinned
  only by its own test) and `agentBrowserBringToFront` (two call sites, a
  gated button, and no host implementing it).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 20, 2026

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: f49f520
Status: ✅  Deploy successful!
Preview URL: https://a11d8721.mouseterm.pages.dev
Branch Preview URL: https://specs-dor-audit.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback on work in progress — not a merge verdict. Mark ready for review when you want the full pass.

I checked the corrected spec claims against the code they describe (--workspaces flag set, the five callerWorkingDirectory callers, the a.target && a.target !== '_self' interception, the location-not-relayed split, parseToolState's v === 1, the two new prespawn_dedupe rejections, and that the compressed control-socket and routing rules do land in security-local.md -> "The dor control socket" and standalone.md -> Routing). Those hold. Three things:

The new ToolLookupResult doc comment claims more than the type delivers. "Every outcome that parsed a configuration file carries that file's warnings" — but unknown-tool also parsed the file (it reports that file's path and its names) and has no warnings field. A reader adding a fourth outcome takes the comment as the rule and either adds a field nothing reads or concludes one is missing. Inline suggestion narrows it to the two arms that do carry it.

The delivery invariant the fix establishes isn't in the spec. docs/specs/dor-tool.md's only warning rule is "unknown ordinary fields produce warnings" under Declaring tools — it says nothing about which lookup outcome delivers them, which is exactly what the bug was and what tool-trust.test.ts and tool-open.test.ts now pin. Per AGENTS.md -> Specs, "When code covered by a spec changes, change the spec", and the rule is the load-bearing kind: delete it and the next refactor can drop warnings from the untrusted arm again with the tests reading as incidental. Something like, appended to that bullet: Must carry the file's warnings on the untrusted answer and on a built-in open, the paths a tool's first run actually takes. Worth noting the budget is tight — dor-tool.md counts 4048 against a 4050 budget, so a sentence needs node scripts/spec-lint.mjs --ratchet docs/specs/dor-tool.md in the same commit.

One stale comment outside the diff. With agentBrowserBringToFront gone, the section header in agent-browser-surface-controller.ts reading // --- relaunch: pop-out / pop-in / bring-to-front + auto-revert --- is the only remaining mention of the capability in the repo. Happy to push that one-word fix if you'd rather not touch the branch.

Comment on lines +23 to +26
* Every outcome that parsed a configuration file carries that file's
* `warnings`, so a config lint reaches the caller on the path it hits first —
* an untrusted repo's `pending` answer — and not only on a later already-
* trusted run (`docs/specs/dor-tool.md` -> Declaring tools). */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unknown-tool parses the same file — it reports that file's path and names — and carries no warnings, so "every outcome that parsed a configuration file" overstates the type. Naming the two arms keeps the comment true as outcomes are added.

Suggested change
* Every outcome that parsed a configuration file carries that file's
* `warnings`, so a config lint reaches the caller on the path it hits first
* an untrusted repo's `pending` answer — and not only on a later already-
* trusted run (`docs/specs/dor-tool.md` -> Declaring tools). */
* The `ok` and `untrusted` arms carry the parsed file's `warnings`, so a
* config lint reaches the caller on the path it hits first an untrusted
* repo's `pending` answer — and not only on a later already-trusted run
* (`docs/specs/dor-tool.md` -> Declaring tools). */

# Conflicts:
#	docs/specs/layout.md
@nedtwigg
nedtwigg changed the base branch from main to specs-remote-audit September 20, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants