Skip to content

feat: add gate decision helper A/B experiment - #19

Merged
ryannmicua merged 5 commits into
mainfrom
fm/fm-gate-decide-ab
Oct 11, 2026
Merged

ryannmicua merged 5 commits into
mainfrom
fm/fm-gate-decide-ab

Conversation

@ryannmicua

@ryannmicua ryannmicua commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Intent

i want you to be able a/b test decision helper and no decision helper. So we know it's actually an improvement

Context: the decision helper bin/fm-gate-decide.sh (merged in ryannmicua/firstmate PR 17) turns firstmate's decision on a parked no-mistakes ask-user gate into one checked steer: it verifies the current round's findings, annotates carried-over findings, re-checks the gate before sending, and records the decision. The alternative arm is firstmate hand-writing the steer as before. The approved design: assign each gate decision to an arm by a deterministic coin flip on its decision key; log every decision the same way in both arms; measure from existing records rather than firstmate's judgment; report after about a week, plus a historical baseline from the hand-written decisions before the helper. Measures: firstmate tokens per decision (from firstmate's Claude session transcripts), extra fix rounds after a decision and carried-over findings re-selected (from ~/.no-mistakes/state.sqlite step_rounds: selected_finding_ids, user_findings_json, selection_source, reviewed_head_sha), malformed or rejected respond commands (worker status lines), and time from gate park to resolution.

What Changed

  • Add an opt-in gate decision A/B experiment with deterministic helper/manual assignment and a shared decision log; refuse helper use for manual-arm keys and automatically log delivered helper decisions.
  • Report token usage, extra fix rounds, reselected findings, respond problem lines, and gate resolution time per arm alongside a historical manual baseline, with sample sizes for available measures.
  • Document experiment configuration and supervision procedures, and add fixture tests for assignment, logging, helper integration, and reporting.

Risk Assessment

🚨 High: The experiment can silently misreport its core measures and omit helper decisions on a supported platform, while required baseline and reporting behavior remain incomplete.

Testing

Targeted tests and real CLI assignment, logging, and reporting checks passed using isolated disposable records. CLI evidence was captured and temporary files removed. Helper delivery used simulated dependencies, leaving the overall live integration inconclusive.

  • Live validation: ⚠️ inconclusive - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Enable the experiment and repeatedly assign decision keys; both arms appear and each key stays stable ✅ pass live live-cli.log; tests/fm-gate-ab.test.sh
Log a manual decision and attempt duplicate finding IDs; the valid record persists and duplicates are refused ✅ pass live live-cli.log
Generate a comparison from disposable records; the report calculates arm metrics and an attributable historical baseline ✅ pass live live-cli.log
Report successive decision rounds, failed retries, and explicit delivery-before-closure errors; tokens attach to the appropriate delivered turns ✅ pass live report-edge-cases.log
Report retired tasks and malformed timestamps; unavailable timing and rejection measures remain unknown ✅ pass live live-cli.log; report-edge-cases.log
Attempt reporting against an incomplete database schema; the CLI refuses and identifies the missing column ✅ pass live live-cli.log
Use the helper on manual and helper arms; enforce manual assignment and automatically log delivered helper decisions, including closure failures ⏸️ untested no Inspected the helper's required parked-run interface and ran its focused integration tests. Those tests simulate no-mistakes and tmux, so they are not live evidence. The actual no-mistakes CLI is avai…
Evidence: Live assignment, logging, and report CLI outputs

Source: Live assignment, logging, and report CLI outputs

=== CLI default and opt-in assignment ===
helper
nm-RUN1-review: helper
nm-RUN1-review repeated: helper
nm-RUN2-review: helper
nm-RUN2-review repeated: helper
nm-RUN3-review: manual
nm-RUN3-review repeated: manual
=== Manual log and duplicate finding refusal ===
logged: manual decision for nm-RUNM-review round 1 in ~/.no-mistakes/worktrees/ff5e17b6f5de/01M4KRKY652H95K5NQCDHSFY8Q/.test-gate-ab/tmp/fm-gate-ab.fElRFX/live-report/home/data/gate-ab.jsonl
{"arm": "manual", "at": 200000, "findings": [{"action": "fix", "id": "B-1"}, {"action": "no-change", "id": "B-2"}], "key": "nm-RUNM-review", "round": 1, "run": "RUNM", "schema": "fm-gate-ab.v1", "step": "review", "task": "t2"}
error: empty or repeated finding id in 'B-1,B-1'
duplicate exit: 2
=== Report from disposable SQLite, transcript, and status inputs ===
gate decision A/B - experiment since epoch 100000, baseline 1 days before it
mean per decision; park>done is a median; (n=) is the decisions with that measure available
arm       decisions  tok out    tok total  extra rounds  re-selected  respond lines  park>done s
helper    1          130 (n=1)  195 (n=1)  0.00 (n=1)    0.00 (n=1)   0.00 (n=1)     390 (n=1)
manual    1          40 (n=1)   47 (n=1)   1.00 (n=1)    1.00 (n=1)   1.00 (n=1)     590 (n=1)
baseline  1          -          -          0.00 (n=1)    0.00 (n=1)   0.00 (n=1)     890 (n=1)
decisions with no matching no-mistakes round: 0
Descriptive only: samples are small and unpaired, and no significance is claimed.
Baseline holds fix decisions only (selection rows); tokens cover the whole turn that sent the decision.
=== Retired task history is unavailable, retained attribution survives ===
gate decision A/B - experiment since epoch 100000, baseline 1 days before it
mean per decision; park>done is a median; (n=) is the decisions with that measure available
arm       decisions  tok out    tok total  extra rounds  re-selected  respond lines  park>done s
helper    1          130 (n=1)  195 (n=1)  0.00 (n=1)    0.00 (n=1)   -              -
manual    1          40 (n=1)   47 (n=1)   1.00 (n=1)    1.00 (n=1)   -              -
baseline  1          -          -          0.00 (n=1)    0.00 (n=1)   -              -
decisions with no matching no-mistakes round: 0
Descriptive only: samples are small and unpaired, and no significance is claimed.
Baseline holds fix decisions only (selection rows); tokens cover the whole turn that sent the decision.
=== Missing required schema is refused ===
error: no-mistakes state schema drift: step_rounds lacks selection_source
schema drift exit: 1
Evidence: Report delivery attribution and timestamp edge cases

Source: Report delivery attribution and timestamp edge cases

gate decision A/B - experiment since epoch 100000, baseline 1 days before it
mean per decision; park>done is a median; (n=) is the decisions with that measure available
arm       decisions  tok out    tok total  extra rounds  re-selected  respond lines  park>done s
helper    1          130 (n=1)  195 (n=1)  0.00 (n=1)    0.00 (n=1)   0.00 (n=1)     390 (n=1)
manual    2          220 (n=2)  224 (n=2)  0.50 (n=2)    0.50 (n=2)   0.50 (n=2)     490 (n=2)
baseline  2          250 (n=2)  250 (n=2)  0.50 (n=2)    0.50 (n=2)   0.00 (n=2)     640 (n=2)
decisions with no matching no-mistakes round: 0
Descriptive only: samples are small and unpaired, and no significance is claimed.
Baseline holds fix decisions only (selection rows); tokens cover the whole turn that sent the decision.
gate decision A/B - experiment since epoch 100000, baseline 1 days before it
mean per decision; park>done is a median; (n=) is the decisions with that measure available
arm       decisions  tok out    tok total  extra rounds  re-selected  respond lines  park>done s
helper    1          130 (n=1)  195 (n=1)  0.00 (n=1)    0.00 (n=1)   0.00 (n=1)     -
manual    1          40 (n=1)   47 (n=1)   1.00 (n=1)    1.00 (n=1)   -              590 (n=1)
baseline  1          -          -          0.00 (n=1)    0.00 (n=1)   0.00 (n=1)     890 (n=1)
decisions with no matching no-mistakes round: 0
Descriptive only: samples are small and unpaired, and no significance is claimed.
Baseline holds fix decisions only (selection rows); tokens cover the whole turn that sent the decision.
- Outcome: ⚠️ 2 warnings across 1 run (1m40s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 error
  • 🚨 bin/fm-gate-decide.sh:620 - Stock macOS Bash 3.2 lacks mapfile. After successfully sending a helper decision, this call fails and args remains empty; expanding it under set -u can terminate the helper before its A/B record is appended. Replace mapfile with a portable read loop. Both delivery paths depend on this: bin/fm-gate-decide.sh:635 (delivered-unconfirmed) and :646 (delivered).
  • 🚨 bin/fm-gate-ab.sh:361 - Manual decisions in successive rounds share one decision key. With round 1 sent in a 100-token turn and round 2 in a 400-token turn, next() chooses the first sending call and assigns 100 tokens to both decisions. Baseline rounds have the same defect, and repeated helper attempts can select an unsuccessful earlier call. Associate transcript calls with the individual decision's round, timestamp, and delivery evidence rather than the first key match. Related sites: bin/fm-gate-ab.sh:299-303 (needles), :313-323 (call matching), :364-366 (assignment).
  • 🚨 bin/fm-gate-ab.sh:267 - The required baseline is 'the hand-written decisions before the helper', but the added header explicitly says 'a user selection made by anyone is counted', and this condition includes every qualifying step in the shared no-mistakes database. A user-selected fix from an unrelated repository or another firstmate home therefore changes this home's baseline even without any matching task or transcript. Restrict the baseline to attributable firstmate hand-written decisions. Related sites: bin/fm-gate-ab.sh:48-52 (broadened definition), :223-235 (unfiltered database loading), :291-295 (unmatched task does not exclude a baseline decision).
  • 🚨 bin/fm-gate-ab.sh:278 - After a task reports a rejected respond command and is normally torn down, fm-teardown.sh:3818 calls status_retire_presentation_task, which deletes its status file at fm-classify-lib.sh:1778. This report then returns an empty history and reports zero respond problems with an available sample, concealing the rejection. Historical baseline task attribution also disappears. Read retained event evidence and distinguish unavailable history from zero; where no retained source exists, preserving evidence requires authorization for additional persistence. Related changed sites: bin/fm-gate-ab.sh:272-295 (live-only history and attribution), :383-388 (zero-valued measurement).
  • 🚨 bin/fm-gate-ab.sh:282 - The repository's status grammar permits key, corr, and at tags in any order. A valid 'blocked [key=nm-RUN-review] [at=100200]: respond rejected: unknown flag' line is silently skipped, producing zero respond problems. Parse the canonical timestamp grammar rather than requiring at immediately after the verb. The affected consumer is bin/fm-gate-ab.sh:386-388.
  • 🚨 bin/fm-gate-ab.sh:379 - Intent requires 'time from gate park to resolution', whereas the new header defines park->done as 'from the decided round's creation to the step's completion'. The calculation uses created_at without locating the gate-park event. For a round created at 100, parked at 160, and completed at 200, it reports 100 seconds instead of 40. Use recorded park and resolution events, leaving unavailable durations unknown. Related sites: bin/fm-gate-ab.sh:42-44 (substituted definition), :375 (start), :380 (duration), :405 (park label); tests/fm-gate-ab.test.sh:219 and :253 explicitly expect 900 despite a park timestamp implying 890.
  • 🚨 .agents/skills/validation-supervision/SKILL.md:27 - The required design says 'report after about a week'. The added workflow only assigns an arm and logs decisions; the change supplies an on-demand report command but no instruction or mechanism establishing the week-later report. Complete that acceptance requirement through the existing scheduling or work-tracking mechanism; introducing new scheduling machinery would require authorization. Related changed sites: bin/fm-gate-ab.sh:9 and :164 (on-demand report), docs/configuration.md:594-599 (configuration contract).
  • ⚠️ bin/fm-gate-ab.sh:405 - Simplification: the additional park>decision metric is not required by the approved measures, which request park-to-resolution time. Remove this extra metric and its calculation rather than maintaining another timing definition. Related sites: bin/fm-gate-ab.sh:44 (definition), :381-382 (calculation), :405 (column), tests/fm-gate-ab.test.sh:249-253 (expected extra column).

🔧 Fix applied.
8 issues (6 errors, 2 warnings) still open:

  • 🚨 bin/fm-gate-ab.sh:361 - Manual decisions in successive rounds share one decision key. With round 1 sent in a 100-token turn and round 2 in a 400-token turn, next() chooses the first sending call and assigns 100 tokens to both decisions. Baseline rounds have the same defect, and repeated helper attempts can select an unsuccessful earlier call. Associate transcript calls with the individual decision's round, timestamp, and delivery evidence rather than the first key match. Related sites: bin/fm-gate-ab.sh:299-303 (needles), :313-323 (call matching), :364-366 (assignment).
  • 🚨 bin/fm-gate-ab.sh:267 - The required baseline is 'the hand-written decisions before the helper', but the added header explicitly says 'a user selection made by anyone is counted', and this condition includes every qualifying step in the shared no-mistakes database. A user-selected fix from an unrelated repository or another firstmate home therefore changes this home's baseline even without any matching task or transcript. Restrict the baseline to attributable firstmate hand-written decisions. Related sites: bin/fm-gate-ab.sh:48-52 (broadened definition), :223-235 (unfiltered database loading), :291-295 (unmatched task does not exclude a baseline decision).
  • 🚨 bin/fm-gate-ab.sh:278 - After a task reports a rejected respond command and is normally torn down, fm-teardown.sh:3818 calls status_retire_presentation_task, which deletes its status file at fm-classify-lib.sh:1778. This report then returns an empty history and reports zero respond problems with an available sample, concealing the rejection. Historical baseline task attribution also disappears. Read retained event evidence and distinguish unavailable history from zero; where no retained source exists, preserving evidence requires authorization for additional persistence. Related changed sites: bin/fm-gate-ab.sh:272-295 (live-only history and attribution), :383-388 (zero-valued measurement).
  • 🚨 bin/fm-gate-ab.sh:282 - The repository's status grammar permits key, corr, and at tags in any order. A valid 'blocked [key=nm-RUN-review] [at=100200]: respond rejected: unknown flag' line is silently skipped, producing zero respond problems. Parse the canonical timestamp grammar rather than requiring at immediately after the verb. The affected consumer is bin/fm-gate-ab.sh:386-388.
  • 🚨 bin/fm-gate-ab.sh:379 - Intent requires 'time from gate park to resolution', whereas the new header defines park->done as 'from the decided round's creation to the step's completion'. The calculation uses created_at without locating the gate-park event. For a round created at 100, parked at 160, and completed at 200, it reports 100 seconds instead of 40. Use recorded park and resolution events, leaving unavailable durations unknown. Related sites: bin/fm-gate-ab.sh:42-44 (substituted definition), :375 (start), :380 (duration), :405 (park label); tests/fm-gate-ab.test.sh:219 and :253 explicitly expect 900 despite a park timestamp implying 890.
  • 🚨 .agents/skills/validation-supervision/SKILL.md:27 - The required design says 'report after about a week'. The added workflow only assigns an arm and logs decisions; the change supplies an on-demand report command but no instruction or mechanism establishing the week-later report. Complete that acceptance requirement through the existing scheduling or work-tracking mechanism; introducing new scheduling machinery would require authorization. Related changed sites: bin/fm-gate-ab.sh:9 and :164 (on-demand report), docs/configuration.md:594-599 (configuration contract).
  • ⚠️ bin/fm-gate-ab.sh:405 - Simplification: the additional park>decision metric is not required by the approved measures, which request park-to-resolution time. Remove this extra metric and its calculation rather than maintaining another timing definition. Related sites: bin/fm-gate-ab.sh:44 (definition), :381-382 (calculation), :405 (column), tests/fm-gate-ab.test.sh:249-253 (expected extra column).
  • ⚠️ bin/fm-gate-ab.sh:363 - Round 1's R2 fix introduced unequal treatment of confirmed delivery followed by decision-closure failure. fm-send.sh:713 and :722 explicitly report that the answer was delivered before returning nonzero. Firstmate can correctly log that manual decision without resending, but this classifier rejects its transcript result, excluding its tokens; the helper's equivalent delivered-unconfirmed result is accepted at bin/fm-gate-ab.sh:361. Recognize fm-send's explicit delivery-before-closure-failure notices in this shared classifier. Related changed site: bin/fm-gate-ab.sh:416 filters token candidates for both arms and the baseline.

🔧 Fix applied.
1 error still open:

  • 🚨 .agents/skills/validation-supervision/SKILL.md:27 - The required design says 'report after about a week'. The added workflow only assigns an arm and logs decisions; the change supplies an on-demand report command but no instruction or mechanism establishing the week-later report. Complete that acceptance requirement through the existing scheduling or work-tracking mechanism; introducing new scheduling machinery would require authorization. Related changed sites: bin/fm-gate-ab.sh:9 and :164 (on-demand report), docs/configuration.md:594-599 (configuration contract).
⚠️ **Test** - 2 warnings
  • ⚠️ The step cannot demonstrate the complete experiment live: helper delivery and automatic logging were exercised only with simulated no-mistakes and tmux dependencies. A disposable parked run provisioned by the outer executor is needed to validate that integration without violating this phase's prohibition on starting another pipeline.
  • ⚠️ live validation verdict: inconclusive (6 of 7 scenarios were driven live against the product); untested: Use the helper on manual and helper arms; enforce manual assignment and automatically log delivered helper decisions, including closure failures
  • Live validation: ⚠️ inconclusive - 6 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Enable the experiment and repeatedly assign decision keys; both arms appear and each key stays stable ✅ pass live live-cli.log; tests/fm-gate-ab.test.sh
Log a manual decision and attempt duplicate finding IDs; the valid record persists and duplicates are refused ✅ pass live live-cli.log
Generate a comparison from disposable records; the report calculates arm metrics and an attributable historical baseline ✅ pass live live-cli.log
Report successive decision rounds, failed retries, and explicit delivery-before-closure errors; tokens attach to the appropriate delivered turns ✅ pass live report-edge-cases.log
Report retired tasks and malformed timestamps; unavailable timing and rejection measures remain unknown ✅ pass live live-cli.log; report-edge-cases.log
Attempt reporting against an incomplete database schema; the CLI refuses and identifies the missing column ✅ pass live live-cli.log
Use the helper on manual and helper arms; enforce manual assignment and automatically log delivered helper decisions, including closure failures ⏸️ untested no Inspected the helper's required parked-run interface and ran its focused integration tests. Those tests simulate no-mistakes and tmux, so they are not live evidence. The actual no-mistakes CLI is avai…
  • TMPDIR="$PWD/.test-gate-ab/tmp" bash tests/fm-gate-ab.test.sh
  • Direct bin/fm-gate-ab.sh assign and log calls against a disposable FM_HOME
  • Direct bin/fm-gate-ab.sh report --since 100000 --baseline-days 1 --transcripts <disposable-directory> calls
  • Focused test_report_individual_deliveries and test_report_unknown_timestamps execution with report output captured
  • Removed disposable drivers and data; verified git status --short was empty
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…capture in the A/B assignment test. A/B behavior tests and source-aware lint pass. The unchanged remote-reply suite also passes, including the NUL scenario that timed out in CI; no code fix is warranted for that unrelated failure
@ryannmicua
ryannmicua merged commit 1023e61 into main Oct 11, 2026
36 of 37 checks passed
@ryannmicua
ryannmicua deleted the fm/fm-gate-decide-ab branch October 11, 2026 02:56
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