Skip to content

feat(bin): trim dispatch briefs and add per-rule confidence floors - #198

Merged
dnth merged 10 commits into
mainfrom
fm/fm-port-upstream-5478-dispatch-sections
Oct 4, 2026
Merged

dnth merged 10 commits into
mainfrom
fm/fm-port-upstream-5478-dispatch-sections

Conversation

@dnth

@dnth dnth commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Intent

Port upstream kunchenguid/firstmate PR kunchenguid#5478 ('feat(bin): send dispatch router only the brief's task sections and add per-rule confidence floors', merged 2026-09-24) into this fork, captain-approved 2026-10-03. Requirements: (1) fm-dispatch-resolve.sh sends the typed-dispatch router (Jev) only the brief's task-describing sections, adapted to this fork's scaffold which uses top-level '# Task' and '# Acceptance criteria' - upstream's '## Captain's intent'/'## Firstmate spec' headings do not exist here; scout briefs get 'Brief kind: scout (report only)'; ship delivery mode is deliberately not sent; a brief with neither heading is sent whole as the fail-safe. (2) Rules may declare optional min_confidence (number 0 through 1), a confidence floor on that rule's own probability checked whether the rule is the pick or a runner-up; a picked rule below its own floor falls to the most probable other option clearing its own floor with a fallback: line; ties or no qualifying runner-up yield ambiguous; rules without the field keep the existing global 0.6 check on answer confidence; malformed values are a config error exiting 2 before any network call; the model never sees confidence floors. (3) min_confidence is a confidence floor intentionally named distinct from the existing per-rule quota 'floor' fields (scope/min_percent/provider); quota floor, quota-axi ranking, approval, prewalk_into, and the clear/ambiguous/escalate/error/off contract are unchanged, and a rule may carry both fields independently. (4) docs/configuration.md and the script header document the new behavior and field. Adaptation decisions: bin/fm-brief-heading-lib.sh owns the dispatch router's task-section extraction (bin/fm-receipt-check.sh keeps its own acceptance parser with the same trailing-whitespace heading tolerance); upstream's nested fm_brief_task_heading_* helpers, the parser stdin input mode, and fm-dod-lib.sh were intentionally not ported; bin/fm-test-run.sh maps the new lib to the dispatch-resolve test lane. Firstmate-Validation-Generation: 9ef8c77ff62039f3a5d1cdc917b0754c

What Changed

  • Send Jev only # Task and # Acceptance criteria sections, adding a scout tag and omitting ship delivery mode; send the whole brief when neither heading exists.
  • Add optional per-rule min_confidence floors checked against rule probabilities, with a reported fallback to the highest qualifying runner-up and ambiguous results for ties or no qualifying option. Validate malformed floors before network requests.
  • Document the dispatch behavior, expand extraction and confidence-floor fixtures, and map the new heading library to the dispatch test lane.

Risk Assessment

✅ Low: The change is bounded, conforms to the accepted intent and prior decisions, and introduces no substantiated material defects.

Testing

Dispatch and bootstrap tests passed; live opt-out, no-rule, malformed-floor, and test-selection checks passed with CLI evidence captured. Jev-backed scenarios remain untested live because authentication is unavailable. Disposable files were removed; this change has no rendered UI requiring screenshots.

  • Live validation: ⚠️ inconclusive - 4 of 10 scenarios driven live against the product
Scenario Result Live Evidence
Run without a Typesafe key; the resolver stays off, prints no stdout, and makes no network attempt. ✅ pass live live-cli-transcript.txt
Opt in without configured rules; the resolver returns escalate without calling the network. ✅ pass live live-cli-transcript.txt
Configure negative, excessive, string, null, boolean, object, or array confidence floors; the resolver exits 2 before any network attempt. ✅ pass live live-cli-transcript.txt
Select tests for the changed files; the real test runner includes the dispatch-resolve and bootstrap test scripts. ✅ pass live changed-lane-selection.txt
Submit a ship brief with trailing-whitespace and fenced headings; Jev receives only task sections, excluding boilerplate and delivery mode. ⏸️ untested no Disposable briefs and configuration were exercised through the executable tests, which passed using fake curl. TYPESAFE_API_KEY is unavailable; the real resolver fixes its endpoint to api.typesafe.ai…
Submit a scout brief; Jev receives task sections and the report-only scout tag. ⏸️ untested no The isolated executable test passed with fake curl. Live transmission requires the unavailable TYPESAFE_API_KEY; the fixed HTTPS endpoint cannot be redirected through a supported disposable local conf…
Submit a brief without recognized headings; Jev receives the whole brief as the fail-safe. ⏸️ untested no The executable whole-brief test passed with fake curl. An isolated home and brief cannot supply authentication for the fixed Typesafe endpoint, and substituting a local service would be a stub. Provid…
Resolve picked and runner-up confidence floors; qualifying runners win, ties or absent qualifiers remain ambiguous, and undeclared floors retain existing behavior. ⏸️ untested no Executable cases passed with canned Jev answers, including omission of confidence floors from the emitted request. No Typesafe credential is available to obtain real answers in the disposable setup. T…
Resolve exponent-valued probabilities and floors; all four fallback diagnostic fields preserve exponents and normalize mantissa zeros. ⏸️ untested no The executable regression cases passed, including 1.2e-10 and 1.20e-10, using canned responses. Real Jev answers cannot be obtained without the unavailable Typesafe credential; replacing the response…
Combine confidence floors with quota floors, ranking, approval, and prewalk settings; the existing dispatch contracts remain intact. ⏸️ untested no Focused executable tests passed with fake Jev and quota inputs, and bootstrap configuration tests passed. The isolated configuration cannot drive the network-backed resolver without TYPESAFE_API_KEY;…
Evidence: Live CLI behavior and zero network attempts
Opt out with no key in environment or disposable home
exit: 0

dispatch-resolve: off (TYPESAFE_API_KEY absent from the environment and ~/.no-mistakes/worktrees/dd71c22cc6d7/01M41GPCNVYB9REDYTAF8N75Q4/.test-dispatch-phase/home/.env)
Opt in with no rules in disposable home
exit: 0
dispatch-resolve:
  status: escalate
  reason: no rules to match

Reject malformed min_confidence=-0.01
exit: 2

error: malformed rules file: ~/.no-mistakes/worktrees/dd71c22cc6d7/01M41GPCNVYB9REDYTAF8N75Q4/.test-dispatch-phase/home/config/crew-dispatch.json - min_confidence must be a number from 0 through 1 when present
Reject malformed min_confidence=1.01
exit: 2

error: malformed rules file: ~/.no-mistakes/worktrees/dd71c22cc6d7/01M41GPCNVYB9REDYTAF8N75Q4/.test-dispatch-phase/home/config/crew-dispatch.json - min_confidence must be a number from 0 through 1 when present
Reject malformed min_confidence="0.9"
exit: 2

error: malformed rules file: ~/.no-mistakes/worktrees/dd71c22cc6d7/01M41GPCNVYB9REDYTAF8N75Q4/.test-dispatch-phase/home/config/crew-dispatch.json - min_confidence must be a number from 0 through 1 when present
Reject malformed min_confidence=null
exit: 2

error: malformed rules file: ~/.no-mistakes/worktrees/dd71c22cc6d7/01M41GPCNVYB9REDYTAF8N75Q4/.test-dispatch-phase/home/config/crew-dispatch.json - min_confidence must be a number from 0 through 1 when present
Reject malformed min_confidence=true
exit: 2

error: malformed rules file: ~/.no-mistakes/worktrees/dd71c22cc6d7/01M41GPCNVYB9REDYTAF8N75Q4/.test-dispatch-phase/home/config/crew-dispatch.json - min_confidence must be a number from 0 through 1 when present
Reject malformed min_confidence={}
exit: 2

error: malformed rules file: ~/.no-mistakes/worktrees/dd71c22cc6d7/01M41GPCNVYB9REDYTAF8N75Q4/.test-dispatch-phase/home/config/crew-dispatch.json - min_confidence must be a number from 0 through 1 when present
Reject malformed min_confidence=[]
exit: 2

error: malformed rules file: ~/.no-mistakes/worktrees/dd71c22cc6d7/01M41GPCNVYB9REDYTAF8N75Q4/.test-dispatch-phase/home/config/crew-dispatch.json - min_confidence must be a number from 0 through 1 when present
HTTPS proxy connection attempts across all cases: 0
Evidence: Changed-file test selection
tests/fm-bootstrap.test.sh
tests/fm-fleet-sync.test.sh
tests/fm-gate-refuse.test.sh
tests/fm-gotmp.test.sh
tests/fm-omp-update.test.sh
tests/fm-session-start.test.sh
tests/fm-sessionstart-nudge.test.sh
tests/fm-tangle-guard.test.sh
tests/fm-update.test.sh
tests/fm-backlog-handoff.test.sh
tests/fm-boat-lifecycle.test.sh
tests/fm-boat-omp-auth.test.sh
tests/fm-boat-routing.test.sh
tests/fm-omp-secondmate.test.sh
tests/fm-on.test.sh
tests/fm-pending-reply-sleep-reconcile.test.sh
tests/fm-remote-backlog-handoff.test.sh
tests/fm-remote-doctor.test.sh
tests/fm-remote-job.test.sh
tests/fm-remote-reply.test.sh
tests/fm-remote-secondmate-lifecycle-e2e.test.sh
tests/fm-remote-secondmate-trace-context.test.sh
tests/fm-runpod-lifecycle.test.sh
tests/fm-runpod-omp-auth.test.sh
tests/fm-runpod-pod-boot.test.sh
tests/fm-runpod-routing.test.sh
tests/fm-secondmate-harness.test.sh
tests/fm-secondmate-lifecycle-e2e.test.sh
tests/fm-secondmate-liveness.test.sh
tests/fm-secondmate-safety.test.sh
tests/fm-secondmate-sync.test.sh
tests/fm-send-secondmate-marker.test.sh
tests/fm-shared-captain-inheritance.test.sh
tests/fm-startup-memory-budget.test.sh
tests/fm-backend-herdr.test.sh
tests/fm-backend-tmux-smoke.test.sh
tests/fm-backend.test.sh
tests/fm-busy-adapter-wiring.test.sh
tests/fm-dispatch-resolve.test.sh
tests/fm-herdr-session-cleanup.test.sh
tests/fm-prepush-guard.test.sh
tests/fm-send-inbox.test.sh
tests/fm-send-resolve-key.test.sh
tests/fm-send-strict.test.sh
tests/fm-send-turn-start.test.sh
tests/fm-spawn-batch.test.sh
tests/fm-spawn-dispatch-profile.test.sh
tests/fm-spawn-worktree-settle.test.sh
tests/fm-teardown-endpoint-safety.test.sh
tests/fm-trace-context-spawn.test.sh
tests/fm-treehouse-orphan-recovery.test.sh
tests/fm-arm-pretool-check.test.sh
tests/fm-ask-user-authority.test.sh
tests/fm-brief.test.sh
tests/fm-calm-pi-extension.test.sh
tests/fm-captain-hold-lifecycle.test.sh
tests/fm-cd-pretool-check.test.sh
tests/fm-classify-decision-key.test.sh
tests/fm-cleanup-skill.test.sh
tests/fm-composer-ghost.test.sh
tests/fm-composer-lib.test.sh
tests/fm-crew-state.test.sh
tests/fm-documentation-audiences.test.sh
tests/fm-ensure-agents-md.test.sh
tests/fm-grok-harness.test.sh
tests/fm-herdr-lab.test.sh
tests/fm-hermes-harness.test.sh
tests/fm-kimi-harness.test.sh
tests/fm-lint.test.sh
tests/fm-omp-branch-types.test.sh
tests/fm-omp-fleet-hooks.test.sh
tests/fm-omp-harness.test.sh
tests/fm-operational-input.test.sh
tests/fm-pi-compatible-family.test.sh
tests/fm-pi-primary-types.test.sh
tests/fm-receipt-check.test.sh
tests/fm-receipt.test.sh
tests/fm-reflect-skill.test.sh
tests/fm-send-popup-settle.test.sh
tests/fm-send-settle.test.sh
tests/fm-subagent-pretool-check.test.sh
tests/fm-supervision-instructions.test.sh
tests/fm-task-delivery.test.sh
tests/fm-test-isolation-proof.test.sh
tests/fm-test-run.test.sh
tests/fm-tmux-submit-busy.test.sh
tests/fm-todo-project.test.sh
tests/fm-trace-context-lib.test.sh
tests/fm-transition-lib.test.sh
tests/fm-vendor-auth-probe.test.sh
- Outcome: ⚠️ 1 warning across 1 run (9m53s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (4 of 10 scenarios were driven live against the product); untested: Submit a ship brief with trailing-whitespace and fenced headings; Jev receives only task sections, excluding boilerplate and delivery mode., Submit a scout brief; Jev receives task sections and the report-only scout tag., Submit a brief without recognized headings; Jev receives the whole brief as the fail-safe., Resolve picked and runner-up confidence floors; qualifying runners win, ties or absent qualifiers remain ambiguous, and undeclared floors retain existing behavior., Resolve exponent-valued probabilities and floors; all four fallback diagnostic fields preserve exponents and normalize mantissa zeros., Combine confidence floors with quota floors, ranking, approval, and prewalk settings; the existing dispatch contracts remain intact.
  • Live validation: ⚠️ inconclusive - 4 of 10 scenarios driven live against the product
Scenario Result Live Evidence
Run without a Typesafe key; the resolver stays off, prints no stdout, and makes no network attempt. ✅ pass live live-cli-transcript.txt
Opt in without configured rules; the resolver returns escalate without calling the network. ✅ pass live live-cli-transcript.txt
Configure negative, excessive, string, null, boolean, object, or array confidence floors; the resolver exits 2 before any network attempt. ✅ pass live live-cli-transcript.txt
Select tests for the changed files; the real test runner includes the dispatch-resolve and bootstrap test scripts. ✅ pass live changed-lane-selection.txt
Submit a ship brief with trailing-whitespace and fenced headings; Jev receives only task sections, excluding boilerplate and delivery mode. ⏸️ untested no Disposable briefs and configuration were exercised through the executable tests, which passed using fake curl. TYPESAFE_API_KEY is unavailable; the real resolver fixes its endpoint to api.typesafe.ai…
Submit a scout brief; Jev receives task sections and the report-only scout tag. ⏸️ untested no The isolated executable test passed with fake curl. Live transmission requires the unavailable TYPESAFE_API_KEY; the fixed HTTPS endpoint cannot be redirected through a supported disposable local conf…
Submit a brief without recognized headings; Jev receives the whole brief as the fail-safe. ⏸️ untested no The executable whole-brief test passed with fake curl. An isolated home and brief cannot supply authentication for the fixed Typesafe endpoint, and substituting a local service would be a stub. Provid…
Resolve picked and runner-up confidence floors; qualifying runners win, ties or absent qualifiers remain ambiguous, and undeclared floors retain existing behavior. ⏸️ untested no Executable cases passed with canned Jev answers, including omission of confidence floors from the emitted request. No Typesafe credential is available to obtain real answers in the disposable setup. T…
Resolve exponent-valued probabilities and floors; all four fallback diagnostic fields preserve exponents and normalize mantissa zeros. ⏸️ untested no The executable regression cases passed, including 1.2e-10 and 1.20e-10, using canned responses. Real Jev answers cannot be obtained without the unavailable Typesafe credential; replacing the response…
Combine confidence floors with quota floors, ranking, approval, and prewalk settings; the existing dispatch contracts remain intact. ⏸️ untested no Focused executable tests passed with fake Jev and quota inputs, and bootstrap configuration tests passed. The isolated configuration cannot drive the network-backed resolver without TYPESAFE_API_KEY;…
  • TMPDIR="$PWD/.test-dispatch-phase/tmp" bash tests/fm-dispatch-resolve.test.sh
  • TMPDIR="$PWD/.test-dispatch-phase/tmp" bash tests/fm-bootstrap.test.sh
  • python3 .test-dispatch-phase/live-check.py — isolated real CLI checks with a local HTTPS proxy monitoring network attempts; driver preserved in the evidence directory.
  • bash bin/fm-test-run.sh --list --changed --base fcaaf143fa70e4d00079e7d4e789fcb1a3513917 — initial attempt rejected transient test files; passed after cleanup.
  • git status --short — confirmed disposable worktree files were removed.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

dnth added 8 commits October 4, 2026 00:48
…d per-rule confidence floors

Port of upstream kunchenguid#5478, adapted to this fork's
brief scaffold, which has no "## Captain's intent" / "## Firstmate spec"
subsections: the resolver now sends Jev the top-level "# Task" and
"# Acceptance criteria" sections instead, prefixed with
"Brief kind: scout (report only)" on scout briefs, and still sends the
whole brief when neither section exists. Ship delivery mode is not sent,
matching upstream's measured over-routing finding.

Rules may declare min_confidence (0 through 1), a confidence floor on
that rule's own probability, distinct from the existing quota "floor"
fields: a picked rule below its floor falls to the most probable other
option that clears its own floor (global 0.6 when undeclared) with a
fallback: line, else ambiguous. Files with no declared floors keep the
global 0.6 check on the answer confidence exactly, and bootstrap plus
the resolver reject malformed values before any network call.

The heading parser lives in new bin/fm-brief-heading-lib.sh as the
single owner of brief-section reading, sourced by the resolver;
fm-test-run.sh maps it to the dispatch-resolve test lane.
…allback probability/floor formatting, resolving the portable serial 1 failure (`0.30` vs `0.3`). Verified with bash syntax checks and the targeted dispatch test (fallback case passes). Portable serial 4’s `fm-send --key` mismatch reproduces in an unchanged backend conformance test and is unrelated to this PR; no out-of-scope changes were made
…back probability/floor diagnostics deterministically (e.g. `0.30` → `0.3`) across all emitted fields. Portable serial 1’s failure is addressed; portable serial 4’s `fm-send --key` failure is unrelated to this PR’s changed code, so no out-of-scope change was made
@dnth
dnth force-pushed the fm/fm-port-upstream-5478-dispatch-sections branch from 582860d to 7bc718e Compare October 3, 2026 17:41
@dnth dnth changed the title feat(bin): trim dispatch briefs and add confidence floors feat(bin): trim dispatch briefs and add per-rule confidence floors Oct 3, 2026
dnth added 2 commits October 4, 2026 02:05
…t markers to lowercase in the shared formatter for all four fallback diagnostic fields. Expanded executable regression coverage for e/E notation and trailing mantissa zeros. Dispatch tests, bash syntax checks, and git diff --check passed
@dnth
dnth merged commit c7ff50c into main Oct 4, 2026
15 checks passed
@dnth
dnth deleted the fm/fm-port-upstream-5478-dispatch-sections branch October 4, 2026 00:05
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.

1 participant