fix: bind no-mistakes run by plan metadata, not intent-log body - #90
Merged
Conversation
The run-binding path in fm-receipt-check.sh proved a no-mistakes run belonged to the current plan by grepping the run's intent log for an inline `Firstmate-Validation-Generation: <gen>` record. Real AXI never echoes the agent-supplied --intent body back through `axi logs --step intent`; it reports only "using intent supplied by the agent". So bind-run always refused, and terminal --complete refused even for CI-green, correctly-validated runs. Bind from what AXI reports authoritatively instead: the run id and head from `axi status --run`, the created-after-plan boundary, and the generation recorded in this task's plan metadata (validation_generation). The exact run/generation/head identity checks are unchanged, so a wrong head, a mismatched generation, or a superseded plan (which mints a new generation and clears validation_run_*) still fails closed. The intent log is no longer consulted, and the now-unused fm_nm_intent_has_generation helper is removed from the one-owner lib. Colocated regression tests reproduce the real agent-supplied intent-log shape and assert bind+complete succeed while wrong runs are rejected. Claude-Session: https://claude.ai/code/session_016U99CBNwSkGnuHNoqLJZQj
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.
Outcome
fm-receipt-check.sh --bind-run/--completerefused every no-mistakes run because the binder proved a run belonged to the current plan by grepping the run's intent log for an inlineFirstmate-Validation-Generation: <gen>record. Real AXI never echoes the agent-supplied--intentbody back throughaxi logs --step intent- it reports only "using intent supplied by the agent" - so no run could bind and terminal--completerefused even for CI-green, correctly-validated runs (observed this session on fork PR #88's receipt completion and the port-3369-check-unregister task).The fix binds from what AXI reports authoritatively instead: the run id and head from
axi status --run, the created-after-plan boundary, and the generation recorded in the task's own plan metadata (validation_generation). The exact run/generation/head identity checks are unchanged, so a wrong head, a mismatched generation, or a superseded plan (which mints a new generation and clearsvalidation_run_*) still fails closed.Files changed
bin/fm-receipt-check.sh- bind-run no longer readsaxi logs --step intent; the generation is anchored to plan metadata cross-checked against the run-authoritative id/head. Added a rationale comment at the check.bin/fm-nm-run-lib.sh- removed the now-unusedfm_nm_intent_has_generationhelper (its only caller was the bind path).tests/fm-receipt-check.test.sh- new regression test reproduces the real agent-supplied intent-log shape and asserts bind+complete succeed while a mismatched generation and a wrong head still fail closed; the intent-echo-specific assertions were retargeted to the retained id/head/generation checks.Verification
bash tests/fm-receipt-check.test.sh- all pass, including the newagent-supplied intent-logregression.bash tests/fm-omp-harness.test.sh- 12/12 pass; no OMP adapter/spawn/arm files were modified (harness-agnostic change).bash bin/fm-lint.sh- exit 0 (ShellCheck 0.11.0 pinned).Risks / follow-ups
Firstmate-Validation-Generation:line in the brief's--intentis now provenance only, no longer machine-verified;fm-brief.shis left unchanged.https://claude.ai/code/session_016U99CBNwSkGnuHNoqLJZQj