Skip to content

feat(bin): check PR intents and descriptions for internal voice before publication - #4822

Open
mremond wants to merge 9 commits into
kunchenguid:mainfrom
mremond:fm/fm-prepublish-voice-classifier
Open

mremond wants to merge 9 commits into
kunchenguid:mainfrom
mremond:fm/fm-prepublish-voice-classifier

Conversation

@mremond

@mremond mremond commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Before a pull request or issue description is published, check its text for internal voice that must never reach a public artifact: direct address to the operator (for example 'captain'), relayed supervisor orders to the worker (for example 'do not merge', 'in the new PR description, explain'), quoted operator answers, and prose in a language other than the one the artifact is written in.
When the check finds any of these, publication stops and the finding is reported instead of the text being published.
The check uses the optional typed resolution service already used for dispatch (TYPESAFE_API_KEY) as a closed classification question over the text; when that key is absent the check is off and publication behaves exactly as today.
The service only answers the question; the stop decision and every safety rule stay in code, and an unavailable or uncertain answer must not silently publish a flagged text.
Two real leaks motivate it: a PR Intent that published an operator's one-word answer and the supervisor's relay orders verbatim, and an earlier PR description written partly in French with direct address.
When the key is set and the check gets no verdict (service unreachable, timeout, an error response, or an answer too uncertain that leans clean), it retries once within a bound, then stops publication and reports the text as unverified; publishing that text anyway requires an explicit override for that one publication, with its reason printed, used only on the supervising firstmate's instruction. A flagged answer always stops publication.
The delivery states the enforcement limits plainly: the check is enforced in code at spawn on the brief's intent text, and only by brief instruction on the worker's final --intent string and on the direct-PR body, because the no-mistakes pipeline creates the PR itself and cannot be gated from this repository.
When the check flags a text, the text is corrected by whoever wrote it, guided by the category the check reported (direct address, relayed supervisor orders, quoted operator answer, wrong language), then checked again.
After at most two correction attempts that are still flagged, publication stops and the case is escalated to the supervisor instead of looping.
For a supervisor-authored brief intent, the refused spawn is the escalation to the supervisor, who rewrites and retries; for the worker's final intent string and a direct-PR body, the worker performs the bounded correction itself and reports the escalation through its status.
A text is never published without a clean verdict or the explicit per-publication override already decided.
The check reports only a category, never a rewrite, so the correction stays with the author.

What Changed

  • Added bin/fm-voice-check.sh, an opt-in check that runs only when TYPESAFE_API_KEY is set. It sends a PR, issue, or --intent text to the typed resolution service as four closed yes/no questions: direct address to the operator, relayed supervisor orders, a quoted operator answer, and prose not in English. Code makes every decision. Any "yes" is flagged (exit 1) and no flag can override that. A clean result needs a confident "no" on all four (exit 0). A service failure, timeout, bad response, or low-confidence "no" gets one retry and then counts as unverified (exit 3). --accept-unverified <reason> lets one unverified text through and prints the reason. The output names only the flagged categories and never suggests a rewrite. Without the key, the check prints voice-check: off and exits 0 without making a network call. The service client and key handling moved from bin/fm-dispatch-resolve.sh into a new shared bin/fm-typesafe-lib.sh, which both scripts now use.
  • The check is enforced in code on the ## Captain's intent text when fm-spawn.sh spawns a no-mistakes ship (relaunches skip it) and when fm-promote.sh promotes to no-mistakes. Both refuse a flagged or unverified intent and add a --voice-accept-unverified <reason> override. For the worker's final --intent string and the direct-PR title and description, enforcement is only by instruction: the rendered briefs tell the worker to run the check, fix only the flagged passages, and after at most two corrections that are still flagged, or on exit 3 or 2, stop and report needs-decision [key=voice-check] instead of publishing. This limit exists because the no-mistakes pipeline creates the PR itself and can't be gated from this repo.
  • Documented the contract in docs/configuration.md ("Pre-publication voice check"), in AGENTS.md, and in a new docs/verification/voice-check.md. Added tests/fm-voice-check.test.sh and extended the task-delivery and control-relaunch tests. tests/lib.sh now keeps the suite from picking up an ambient TYPESAFE_API_KEY, and fm-test-run.sh routes the new files to their tests.

Risk Assessment

✅ Low: The check only runs when the key is set. When it cannot get a verdict it stops publication rather than publishing: a flagged text is never published, and an unverified one needs the explicit override. It runs before spawn or promotion writes anything, relaunch skips it, the earlier review decisions are all in place, and the tests stub the network.

Testing

I ran bin/fm-voice-check.sh against the real typesafe.ai service using the operator's existing key, passed only through the environment and confirmed absent from all evidence. Cases covered: key absent, four-category leak, orders-only leak, clean text, override on a flagged text, HTTP 401 and transport failure with the retry call count observed through a logging curl pass-through, the override on an unverified result, a corrected text re-checked, and a usage error. I then drove a real bin/fm-spawn.sh no-mistakes ship spawn in a throwaway FM_HOME against the live service (fake tmux, and the test-harness gate bypass FM_GATE_REFUSE_BYPASS=1 that tests/lib.sh uses, because this runs inside a gate worktree). I scaffolded no-mistakes and direct-PR briefs with bin/fm-brief.sh to capture the rendered worker correction loop. Finally I ran the three targeted test files for the voice check, spawn/promotion, and relaunch; all passed. Those tests stub the network boundary, so the uncertain-answer retry, promotion refusal, and relaunch skip scenarios are recorded as untested live. No Herdr lab was needed, since no agent was launched. Temp sandboxes were removed and the worktree is clean. There is no UI surface; the evidence is CLI transcripts.

  • Live validation: ✅ go - 10 of 14 scenarios driven live against the product
Scenario Result Live Evidence
Key absent: the voice check is off, exits 0 with one 'off' line and makes no network call, so publication proceeds as today ✅ pass live 01-key-absent.txt; tests/fm-voice-check.test.sh case 1 proves zero curl calls
A PR text in French, with 'Captain,' address, relayed 'do not merge' orders and a quoted 'oui', is flagged by category with exit 1 and no rewrite offered ✅ pass live 02-live-leak-fr.txt (all four categories flagged, exit 1)
A text whose only leak is supervisor relay orders is flagged as relayed_orders ✅ pass live 02-live-leak-orders.txt
A clean English PR description is judged clear and exits 0 ✅ pass live 02-live-clean.txt
Adversarial: --accept-unverified cannot publish a flagged text ✅ pass live 03-override-cannot-clear-flag.txt (exit 1); 05-live-spawn.txt (spawn with --voice-accept-unverified still refused)
Service error or unreachable: one retry, then status unverified with exit 3 ✅ pass live 04-unverified-and-override.txt (HTTP 401 and transport 000, each with exactly 2 real curl calls)
An uncertain answer that leans clean is retried once, then reported unverified ⏸️ untested no The prior payload did not establish a live result. The live service returned confident answers for every text tried and cannot be made to return an uncertain answer on demand, so this was covered only…
The explicit per-publication override publishes an unverified text and prints its reason ✅ pass live 04-unverified-and-override.txt (accepted-unverified line, exit 0)
fm-spawn no-mistakes ship refuses a leaking Captain's intent before publishing launch-brief.md or recording the task, and publishes a clean intent ✅ pass live 05-live-spawn.txt (sandbox FM_HOME, real typesafe.ai, fake tmux)
fm-promote to no-mistakes refuses a flagged scout intent and leaves the task record unchanged ⏸️ untested no The prior payload did not establish a live result. fm-promote was checked only through tests/fm-task-delivery.test.sh with a stubbed curl, never against the live service. A live check needs a sandbox…
A no-mistakes relaunch skips the voice check and succeeds even when the service is unreachable ⏸️ untested no The prior payload did not establish a live result. A live relaunch needs a running Herdr or tmux agent to replace, which means provisioning a bin/fm-herdr-lab.sh lab session. Only the test fixture tes…
Generated worker briefs (no-mistakes --intent and direct-PR body) carry the bounded correction loop: correct flagged passages up to two times, then escalate via needs-decision [key=voice-check] on any… ✅ pass live 06-worker-step-rendered.txt (real fm-brief.sh scaffold output)
A text corrected by its author after a flag passes a re-check ✅ pass live 07-correction-recheck.txt (clear, exit 0)
A worker agent actually follows the rendered correction loop and escalates after two failed corrections ⏸️ untested no The loop is enforced only by brief instruction, which the intent itself accepts. Proving a model obeys it needs a live worker agent in a Herdr lab (bin/fm-herdr-lab.sh) and is model-behaviour evaluati…
Evidence: Key absent: check off, no call

Source: Key absent: check off, no call

\### Scenario: key absent -> check is off, no network call
$ env -u TYPESAFE_API_KEY FM_HOME=<empty-home> bin/fm-voice-check.sh --kind pr leak-fr.md
voice-check: off (TYPESAFE_API_KEY absent from the environment and /var/folders/_v/ydbf105x0n9bnb74b0985xt40000gn/T/tmp.rIpOXYflMb/home/.env)
exit=0
Evidence: Live flagged: French + address + orders + quoted answer

Source: Live flagged: French + address + orders + quoted answer

\### Scenario: live typesafe.ai check of leak-fr.md (--kind pr)
--- text ---
Captain, voici la correction : le pager renvoie maintenant une seule page par appel.
Do not merge this PR; in the new PR description, explain why the cache was dropped.
The captain answered: "oui".
--- output ---
voice-check:
  status: flagged
  kind: pr
  finding: operator_address yes=0.99 confidence=0.97
  finding: relayed_orders yes=1.0 confidence=1.0
  finding: quoted_answer yes=1.0 confidence=1.0
  finding: other_language yes=1.0 confidence=1.0
  reason: internal voice found; do not publish this text, rewrite it for its public reader
voice-check: flagged; do not publish this text
exit=1 elapsed=0s
Evidence: Live flagged: relayed orders only

Source: Live flagged: relayed orders only

\### Scenario: live typesafe.ai check of leak-orders.md (--kind pr)
--- text ---
## Intent
Fix the pager so each call returns exactly one page.
In the new PR description, explain the cache removal. Do not merge; wait for the captain to rule.
--- output ---
voice-check:
  status: flagged
  kind: pr
  finding: relayed_orders yes=1.0 confidence=1.0
  uncertain: operator_address yes=0.48 confidence=0.04
  reason: internal voice found; do not publish this text, rewrite it for its public reader
voice-check: flagged; do not publish this text
exit=1 elapsed=1s
Evidence: Live clear: clean PR description

Source: Live clear: clean PR description

\### Scenario: live typesafe.ai check of clean.md (--kind pr)
--- text ---
## Summary
The pager now returns exactly one page per call. Previously a call could return the next page too when the cursor landed on a page boundary.

## Testing
Added a regression test that pages through 250 records in pages of 100 and checks each page's size.
--- output ---
voice-check:
  status: clear
  kind: pr
exit=0 elapsed=1s
Evidence: Override cannot clear a flagged text

Source: Override cannot clear a flagged text

\### Adversarial: --accept-unverified must NOT publish a flagged text (live service)
voice-check:
  status: flagged
  kind: pr
  finding: operator_address yes=0.99 confidence=0.97
  finding: relayed_orders yes=1.0 confidence=1.0
  finding: quoted_answer yes=1.0 confidence=1.0
  finding: other_language yes=1.0 confidence=1.0
  reason: internal voice found; do not publish this text, rewrite it for its public reader
voice-check: flagged; do not publish this text
exit=1
Evidence: Unverified after one retry; explicit override prints reason

Source: Unverified after one retry; explicit override prints reason

\### Scenario: service rejects the request (invalid key -> HTTP error) -> one retry, then unverified, exit 3
(curl is a logging pass-through to the real /usr/bin/curl hitting https://api.typesafe.ai)
voice-check:
  status: unverified
  kind: pr
  reason: service unavailable: http 401 after 548 ms
voice-check: unverified (service unavailable: http 401 after 548 ms); do not publish this text without an explicit instruction
exit=3
service calls made:
real curl call 10:30:17
real curl call 10:30:18

\### Same text with the explicit per-publication override
voice-check:
  status: unverified
  kind: pr
  reason: service unavailable: http 401 after 519 ms
  accepted-unverified: typesafe outage; firstmate instructed publish for PR 42
exit=0
service calls made:
real curl call 10:30:19
real curl call 10:30:19

\### Transport failure (no route: curl to unreachable network via bogus proxy) -> unverified
voice-check:
  status: unverified
  kind: intent
  reason: service unavailable: http 000 after 15 ms
voice-check: unverified (service unavailable: http 000 after 15 ms); do not publish this text without an explicit instruction
exit=3
service calls made:
real curl call 10:30:20
real curl call 10:30:20
Evidence: Live fm-spawn refuses leaking intent, publishes clean one

Source: Live fm-spawn refuses leaking intent, publishes clean one

\### Live: fm-spawn no-mistakes ship with a leaking Captain's intent (real typesafe.ai; sandbox home, fake tmux)
## Captain's intent
Make the pager return exactly one page per call.
His answer: "oui". Do not merge; in the new PR description, explain why the cache was dropped.

## Firstmate spec
$ fm-spawn.sh leak1 <proj> claude --mode no-mistakes --yolo off
error: <tmp>~/leak1/brief.md ## Captain's intent did not pass the pre-publication voice check; the pipeline publishes it verbatim as the PR intent, so keep only publishable words there (move relayed orders and context to ## Firstmate spec, and ask for the captain's words in the artifact's language) before spawn
voice-check:
  status: flagged
  kind: intent
  finding: relayed_orders yes=1.0 confidence=1.0
  finding: quoted_answer yes=1.0 confidence=1.0
  finding: other_language yes=0.99 confidence=0.98
  reason: internal voice found; do not publish this text, rewrite it for its public reader
voice-check: flagged; do not publish this text
exit=1
launch-brief.md published? no
task meta recorded? no

$ same spawn with --voice-accept-unverified "firstmate instructed" (must still refuse a flagged intent)
error: <tmp>~/leak1/brief.md ## Captain's intent did not pass the pre-publication voice check; the pipeline publishes it verbatim as the PR intent, so keep only publishable words there (move relayed orders and context to ## Firstmate spec, and ask for the captain's words in the artifact's language) before spawn
voice-check:
  status: flagged
  kind: intent
  finding: relayed_orders yes=1.0 confidence=1.0
  finding: quoted_answer yes=1.0 confidence=1.0
  finding: other_language yes=0.99 confidence=0.98
  reason: internal voice found; do not publish this text, rewrite it for its public reader
voice-check: flagged; do not publish this text
exit=1
launch-brief.md published? no

\### Live: fm-spawn with a clean intent (fake tmux refuses the launch afterward)
launch-brief.md published? YES

--- worker voice-check step rendered into clean1/launch-brief.md ---
Evidence: Worker bounded correction loop rendered in generated briefs

Source: Worker bounded correction loop rendered in generated briefs

\### Worker-side bounded correction loop as rendered by fm-brief.sh (generated brief = worker's instructions)
--- no-mistakes brief ---
95:Before every `no-mistakes axi run` that starts a run, the pipeline will publish the `--intent` string in the PR, so check it first:
96-Write that exact string to a file, run `FM_HOME=<tmp>/home ~/.no-mistakes/worktrees/acf4a767348a/01M31H7QSE2KX1BH0KGAK53FDC/bin/fm-voice-check.sh --kind intent <file>`, and start the run with exactly that string only on exit 0.
97-On exit 1, correct only the flagged passages, guided by the categories it printed, and check again; after at most two corrections that are still flagged, or on any other non-zero exit (3 unverified, 2 usage error), do not publish: append `needs-decision [at=<epoch>] [key=voice-check]: intent voice check <status>: <printed categories>` and stop.
98-Pass `--accept-unverified <reason>` only when firstmate explicitly instructs it for this one publication; nothing publishes a flagged text.
--- direct-PR brief ---
81:Before opening the PR, check its text:
82-Write the PR title and description to a file, run `FM_HOME=<tmp>/home ~/.no-mistakes/worktrees/acf4a767348a/01M31H7QSE2KX1BH0KGAK53FDC/bin/fm-voice-check.sh --kind pr <file>`, and open the PR with exactly that title and description only on exit 0.
83-On exit 1, correct only the flagged passages, guided by the categories it printed, and check again; after at most two corrections that are still flagged, or on any other non-zero exit (3 unverified, 2 usage error), do not publish: append `needs-decision [at=<epoch>] [key=voice-check]: pr voice check <status>: <printed categories>` and stop.
84-Pass `--accept-unverified <reason>` only when firstmate explicitly instructs it for this one publication; nothing publishes a flagged text.
Evidence: Corrected text re-checked clear; usage error exit 2

Source: Corrected text re-checked clear; usage error exit 2

\### Correction loop: author rewrites the flagged leak-fr.md for its public reader, then checks again (live)
The pager now returns exactly one page per call. The page cache was removed because it returned stale pages after a cursor reset.
voice-check:
  status: clear
  kind: pr
exit=0

\### Usage error: unreadable file -> exit 2 (no publish)
error: text file not readable: /var/folders/_v/ydbf105x0n9bnb74b0985xt40000gn/T/tmp.rIpOXYflMb/missing.md
exit=2
Evidence: tests/fm-voice-check.test.sh

Source: tests/fm-voice-check.test.sh

ok - fm-voice-check: key absent means off, exit 0, no network call
ok - fm-voice-check: a clean text is clear, exit 0, and the key stays off argv and child env
ok - fm-voice-check: a flagged text stops with exit 1 and no override clears it
ok - fm-voice-check: unreachable, error, and malformed answers are unverified after one retry
ok - fm-voice-check: an uncertain answer leaning clean is retried once, then unverified, exit 3
ok - fm-voice-check: an explicit override publishes an unverified text and prints its reason
ok - fm-voice-check: usage errors exit 2
# all fm-voice-check tests passed
Evidence: tests/fm-task-delivery.test.sh

Source: tests/fm-task-delivery.test.sh

ok - fm-spawn/fm-promote: authorized intent preserves exact words and refuses operator-address lines
ok - fm-spawn: every legacy worker receives scoped role instructions without changing project or primary instructions
ok - fm-spawn/fm-promote: the intent voice check stops flagged and unverified intents and is off without a key
ok - fm-spawn: a ship spawn requires a valid explicit mode and yolo before anything is created
ok - fm-spawn: scout and secondmate spawns refuse ship delivery flags
ok - fm-spawn: the brief's recorded mode and the spawn's explicit mode must agree
ok - fm-spawn: a rigor downgrade against the registered posture is announced, never blocked
ok - fm-spawn: a scout spawn resolves no delivery posture from the registry
ok - fm-promote: promotion requires the delivery contract and records it exactly once
ok - fm-promote: a symlinked task record is refused and its target is left untouched
ok - fm-promote: a promoted worker receives the same mode-specific delivery contract a briefed one does
ok - fm-project-mode: the conditional policy is accepted, mapped for mechanical callers, and readable raw
ok - fm-spawn/fm-promote: leftover Task placeholders are refused until both subsections are filled
# all fm-task-delivery tests passed
Evidence: tests/fm-control-relaunch.test.sh (voice relaunch case)

Source: tests/fm-control-relaunch.test.sh (voice relaunch case)

ok - fm-control relaunch: an unreadable composer fails safe before the exit command is typed
ok - fm-control relaunch: a no-mistakes ship relaunch skips the intent voice check
ok - fm-control relaunch: wiring cleanup failure refuses replacement arming
ok - fm-control relaunch: checkpoint inspection failures refuse before stopping
ok - fm-control relaunch: a launch failure after the stop keeps the prior record and reports the real state
ok - fm-control relaunch: post-publication failure keeps the new durable record
ok - fm-control relaunch: failed journal replacement preserves durable phase
ok - fm-control relaunch: unreadable and untraversable child state fails checkpoint

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 10 of 14 scenarios driven live against the product
Scenario Result Live Evidence
Key absent: the voice check is off, exits 0 with one 'off' line and makes no network call, so publication proceeds as today ✅ pass live 01-key-absent.txt; tests/fm-voice-check.test.sh case 1 proves zero curl calls
A PR text in French, with 'Captain,' address, relayed 'do not merge' orders and a quoted 'oui', is flagged by category with exit 1 and no rewrite offered ✅ pass live 02-live-leak-fr.txt (all four categories flagged, exit 1)
A text whose only leak is supervisor relay orders is flagged as relayed_orders ✅ pass live 02-live-leak-orders.txt
A clean English PR description is judged clear and exits 0 ✅ pass live 02-live-clean.txt
Adversarial: --accept-unverified cannot publish a flagged text ✅ pass live 03-override-cannot-clear-flag.txt (exit 1); 05-live-spawn.txt (spawn with --voice-accept-unverified still refused)
Service error or unreachable: one retry, then status unverified with exit 3 ✅ pass live 04-unverified-and-override.txt (HTTP 401 and transport 000, each with exactly 2 real curl calls)
An uncertain answer that leans clean is retried once, then reported unverified ⏸️ untested no The prior payload did not establish a live result. The live service returned confident answers for every text tried and cannot be made to return an uncertain answer on demand, so this was covered only…
The explicit per-publication override publishes an unverified text and prints its reason ✅ pass live 04-unverified-and-override.txt (accepted-unverified line, exit 0)
fm-spawn no-mistakes ship refuses a leaking Captain's intent before publishing launch-brief.md or recording the task, and publishes a clean intent ✅ pass live 05-live-spawn.txt (sandbox FM_HOME, real typesafe.ai, fake tmux)
fm-promote to no-mistakes refuses a flagged scout intent and leaves the task record unchanged ⏸️ untested no The prior payload did not establish a live result. fm-promote was checked only through tests/fm-task-delivery.test.sh with a stubbed curl, never against the live service. A live check needs a sandbox…
A no-mistakes relaunch skips the voice check and succeeds even when the service is unreachable ⏸️ untested no The prior payload did not establish a live result. A live relaunch needs a running Herdr or tmux agent to replace, which means provisioning a bin/fm-herdr-lab.sh lab session. Only the test fixture tes…
Generated worker briefs (no-mistakes --intent and direct-PR body) carry the bounded correction loop: correct flagged passages up to two times, then escalate via needs-decision [key=voice-check] on any… ✅ pass live 06-worker-step-rendered.txt (real fm-brief.sh scaffold output)
A text corrected by its author after a flag passes a re-check ✅ pass live 07-correction-recheck.txt (clear, exit 0)
A worker agent actually follows the rendered correction loop and escalates after two failed corrections ⏸️ untested no The loop is enforced only by brief instruction, which the intent itself accepts. Proving a model obeys it needs a live worker agent in a Herdr lab (bin/fm-herdr-lab.sh) and is model-behaviour evaluati…
  • env -u TYPESAFE_API_KEY FM_HOME=&lt;empty&gt; bin/fm-voice-check.sh --kind pr leak-fr.md (off, exit 0)
  • TYPESAFE_API_KEY=&lt;real&gt; bin/fm-voice-check.sh --kind pr {leak-fr,leak-orders,clean}.md against live api.typesafe.ai
  • bin/fm-voice-check.sh --accept-unverified ... leak-fr.md live (flagged stays exit 1)
  • TYPESAFE_API_KEY=invalid bin/fm-voice-check.sh via logging curl pass-through (2 real calls, HTTP 401, exit 3), same with --accept-unverified (exit 0, reason printed)
  • HTTPS_PROXY=http://127.0.0.1:9 bin/fm-voice-check.sh --kind intent (transport failure, 2 calls, exit 3)
  • Live re-check of a corrected text (clear, exit 0) and an unreadable-file usage error (exit 2)
  • Sandbox bin/fm-spawn.sh leak1 &lt;proj&gt; claude --mode no-mistakes --yolo off with real key (refused, no launch-brief.md, no meta), with --voice-accept-unverified (still refused), and a clean intent (launch-brief.md published)
  • bin/fm-brief.sh &lt;id&gt; proj --mode no-mistakes|direct-PR in sandbox to capture the rendered worker voice-check step
  • bash tests/fm-voice-check.test.sh
  • bash tests/fm-task-delivery.test.sh
  • bash tests/fm-control-relaunch.test.sh
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Add bin/fm-voice-check.sh, an opt-in pre-publication check that asks the
typed resolution service four closed yes/no questions over a PR or issue
description or a no-mistakes intent: direct address to the operator,
relayed supervisor orders, quoted operator answers, and prose in another
language. Code decides: any yes flags and stops publication, a clear
verdict needs every no at confidence 0.6, and no verdict (unreachable,
timeout, error, malformed, or uncertain) retries once and then stops as
unverified unless an explicit per-publication override with a reason is
passed. With TYPESAFE_API_KEY absent the check is off and makes no call.

Extract the shared typesafe.ai client and key handling into
bin/fm-typesafe-lib.sh and reuse it from bin/fm-dispatch-resolve.sh with
no behavior change.

Enforce the check in code at spawn and promotion on a no-mistakes ship's
intent, which the pipeline publishes verbatim, with
--voice-accept-unverified as the override. Render the bounded correction
step into the worker definition of done for the final --intent string and
a direct-PR description, since the pipeline creates its PR itself. Record
the live evaluation against past fleet descriptions.
… so I left that test alone. **Lint 1 (fixed).** ShellCheck reported SC2034 ("appears unused") three times in the new `bin/fm-typesafe-lib.sh`: once for `FM_TYPESAFE_MODEL`, and for `FM_TYPESAFE_HTTP` and `FM_TYPESAFE_LATENCY_MS`, which `fm_typesafe_post` sets. The file is only ever sourced, and `bin/fm-voice-check.sh` and `bin/fm-dispatch-resolve.sh` read these values. I added two scoped `# shellcheck disable=SC2034` comments with a reason, the same way `bin/fm-landed-lib.sh` and `bin/fm-parent-channel-lib.sh` handle output globals. There's no change in behavior. ShellCheck 0.11.0, the same version CI pins, now passes on every changed script. `tests/fm-voice-check.test.sh` and `tests/fm-dispatch-resolve.test.sh` both still pass. **Behavior tests (Herdr) (no code change).** The only failure was `tests/fm-backend-herdr-focus-flash-e2e.test.sh`, part C: "reached the fallback on a defective release but observed no wrong-focus sample at all". That test samples focus changes in a real Herdr session while a close runs, and here the sampler caught no brief focus change. The test only uses the Herdr backend and lab helpers. This PR changes none of that code: it touches the voice check, the shared typesafe client, spawn and promote hooks, the dod library, docs, and tests. The other 15 Herdr scripts passed. Making this real-Herdr timing sampler deterministic would be a separate job outside this PR's scope. A re-run is expected to pass
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: triage of this PR.

Outcome: waiting-ci (attestation MATCH; CI/NM in progress on HEAD)

contract-class: opt-in — fm-voice-check.sh gated on TYPESAFE_API_KEY; without the key the check prints off and publication is unchanged. When set, spawn/promote enforce on captain intent; worker final intent / direct-PR body by DoD instruction. Relaunch skips the check (265879f). Not a new always-on observer.

VISION.md

  • One captain one interface: pass — keeps internal voice off public artifacts.
  • Authority explicit never inferred: pass — key gate; unverified needs explicit --voice-accept-unverified; flagged never overridden by that flag.
  • Scripts own mechanics: pass — closed questions to service; stop decision in code.
  • Restart non-event: pass — relaunch does not re-depend on the external service.
  • Delegation with spine: pass — correction stays with author; bounded then escalate.
  • Fleet outlives vendor: pass — typesafe is optional typed-resolution; off without key.
  • Scope: pass — publication gate at command layer.

Security FYI (cron): when key set, PR/issue/intent prose is sent to the typed resolution service for classification. Fail-closed on outage/uncertain. Diff reviewed; no withhold. Not Firstmate-flagged (CI still pending).
Attestation: MATCH 265879f6ef176a751ea4f0fbed536ef0f6581ce4 · CI: in progress · NM: SUCCESS (require check) · Draft: no · Mergeable: MERGEABLE/UNSTABLE · workflow-approved: n/a this pass · Firstmate-flag: no

@mremond

mremond commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Checks are green on this PR now; the last triage stamp reads waiting-ci from before they finished. Flagging it for a re-check when the queue allows - nothing else is owed from our side.

…e-classifier

# Conflicts:
#	bin/fm-dod-lib.sh
An operator shell may export TYPESAFE_API_KEY, which turns the
pre-publication voice check on in every no-mistakes spawn and promotion,
so a fixture would post its brief text to the live service and depend on
its verdict. Clear it in tests/lib.sh beside the other operator
overrides; a case that exercises the check sets it itself against a
stubbed curl.

Also escalate every non-zero voice check exit in the worker step, not
only flagged and unverified, so a usage error stops publication too.
@mremond mremond changed the title feat(bin): check PR and issue text for internal voice before publication feat(bin): check PR intents and descriptions for internal voice before publication Sep 21, 2026
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