Repository navigation
feat: add gate decision helper A/B experiment - #19
Merged
Merged
Conversation
… portable logging
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.
Evidence: Live assignment, logging, and report CLI outputs
Source: Live assignment, logging, and report CLI outputs
Evidence: Report delivery attribution and timestamp edge cases
Source: Report delivery attribution and timestamp edge cases
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
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).TMPDIR="$PWD/.test-gate-ab/tmp" bash tests/fm-gate-ab.test.shDirectbin/fm-gate-ab.sh assignandlogcalls against a disposable FM_HOMEDirectbin/fm-gate-ab.sh report --since 100000 --baseline-days 1 --transcripts <disposable-directory>callsFocusedtest_report_individual_deliveriesandtest_report_unknown_timestampsexecution with report output capturedRemoved disposable drivers and data; verifiedgit status --shortwas empty✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.