fix(dispatch): background report signs with --from; coord-send refuses a worktree-derived sender

In a linked worktree basename(git toplevel) is the worktree's name, so the
background child's report was signed `from: dispatch-bg-form` (measured by
the PM on 741ada8) - a mailbox no session holds.

- skills/dispatch: the starter reports by full path with
  `coord-send.sh --from <repo> --to <sender>`; board-selftest §19b gains the
  check (red on 741ada8) plus a known-negative control that runs the same
  predicate against the old "via coord-send" wording.
- coord-send.sh: a DERIVED sender inside a linked worktree exits 2, naming
  --from and the repo the worktree belongs to. Chose refusal over a warning
  because stderr is where a session least looks and the mail would already be
  delivered, and over a silent redirect for the reason the retired
  ktg-plugin-marketplace address is rejected rather than redirected.
  Linked-ness is git's own test (git-dir != git-common-dir), not ".git is a
  file", because a submodule has that too. coord-selftest section 39: 9
  checks, 3 red before the fix; controls for submodule, main checkout,
  explicit --from and a worktree named like its repo.
- Six other scripts derive identity the same way; named as a bounded gap in
  CLAUDE.md, not changed (not ordered).

Suites under /bin/bash 3.2: coord 266, board 497, route 73, orders 116,
guard 54 = 1006 (was 995). npm test 12/12.

Order 20260923T082933Z-466405184-from-.claude.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-23 11:20:39 +02:00
commit 7b09114cd6
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
7 changed files with 136 additions and 8 deletions

View file

@ -16,7 +16,7 @@ marketplace plugin. Three components, one boundary:
`coord-done.sh` archives, `coord-count.sh` counts without delivering,
`coord-sweep.sh` closes the aged FYI backlog machine-wide.
Everything is pinned by `coord-selftest.sh`
(257 checks, throwaway mailbox via `CLAUDE_COORD_DIR`).
(266 checks, throwaway mailbox via `CLAUDE_COORD_DIR`).
**`ktg-plugin-marketplace` is a RETIRED `--to` address (operator decision
2026-08-15), rejected rather than redirected.** It is a polyrepo directory,
@ -80,6 +80,33 @@ marketplace plugin. Three components, one boundary:
`coord-send.sh`'s own guard comment protects dot names as real repos
(`basename` of a git toplevel under a hidden directory).
**A sender derived inside a LINKED WORKTREE is refused, not signed (order
20260923T082933Z-466405184, 2026-09-23).** A background session runs in
`<repo>/.claude/worktrees/<name>`, and `basename(git toplevel)` there is
`<name>`: measured by the PM on 741ada8, the child's report arrived signed
`from: dispatch-bg-form`, a mailbox no session holds, so a reply to it goes
nowhere. That is section 22's "invented identity" in a new place, and it gets
section 22's answer: exit 2, naming `--from` and the repo the worktree belongs
to. Refusal was chosen over a warning because stderr is where a session least
looks and the message would already be delivered, and over a silent redirect
to the main repo's name for the reason the retired `ktg-plugin-marketplace`
address is rejected rather than redirected. Linked-ness is git's own test
(`--git-dir` differs from `--git-common-dir`), never a path pattern and never
".git is a file", because a SUBMODULE also has `.git` as a file and its
basename IS its name. Selftest section 39 pins that control, the main
checkout, an explicit `--from` inside the worktree, and a worktree directory
that carries the repo's own name. It fails OPEN when git cannot answer. The
dispatch skill's background starter now signs its report with `--from`
(board-selftest §19b), so the refusal is the net, not the path.
**Bounded gap, stated rather than closed:** six more scripts derive identity
the same way (`coord-done`, `coord-inbox`, `coord-order-send`,
`coord-order-claim`, `coord-order-done`, `coord-order-inbox` - measured with
`grep -n 'rev-parse --show-toplevel' scripts/*.sh`). The order named
`coord-send` only. `coord-order-done` already fails loudly (exit 1, "no
claimed order"); `coord-done` does not - measured inside a worktree, it prints
`no inbox for <worktree-name>` on stderr and exits 0, having archived nothing.
Reported to `.claude` for its own order.
**`coord-sweep.sh` is the only path that closes a message with no human in
the loop, and every constraint on it follows from that.** It may close exactly
one mechanically decidable class - `reply-expected: no`, older than the grace
@ -467,7 +494,7 @@ marketplace plugin. Three components, one boundary:
- **Board (`scripts/board.sh`):** cross-repo attention board. Reads STATE.md
next-step blocks + board lines, `git status`, and mailbox pending counts, and
prints one line per repo. Read-only by construction: it writes to no repo, no
STATE.md and no mailbox. Pinned by `board-selftest.sh` (495 checks).
STATE.md and no mailbox. Pinned by `board-selftest.sh` (497 checks).
**It lives here because the mailbox is one of its three inputs, and it carries
the same axis distinction the mailbox does.** A pending count means *others
@ -1572,8 +1599,8 @@ obligations in another repo.
- Zero dependencies everywhere: bash + coreutils in the engine, `node:`
builtins only in hook and tests.
- TDD: no behavior change without a failing selftest check first.
`bash scripts/coord-selftest.sh` must exit 0 (257/257),
`bash scripts/board-selftest.sh` must exit 0 (495/495),
`bash scripts/coord-selftest.sh` must exit 0 (266/266),
`bash scripts/board-selftest.sh` must exit 0 (497/497),
`bash scripts/route-selftest.sh` must exit 0 (73/73),
`bash scripts/orders-selftest.sh` must exit 0 (116/116) and
`bash scripts/state-line-guard-selftest.sh` must exit 0 (54/54).