feat(agent,cli): implement plan 007's autonomous flow repair loop - #550
Merged
Merged
Conversation
record now diagnoses a live-recording failure, asks the configured authoring model for a minimal .flow.yaml edit, applies it, and reruns in a bounded loop (default 3 attempts) instead of just reporting the first failure. Stops early as an engine gap when the same category recurs on the same step with no progress, or when the model itself says the failure isn't fixable by a flow edit. The loop never writes anything but the target .flow.yaml and its trace/repair.json sidecar report; --no-repair restores the original single-attempt behavior. Verified live against a real Fiori tenant (config'd via `flowproof config fiori`) with --headed and a real Anthropic key: a deliberately malformed step failed record, the model correctly diagnosed and rewrote it, and the rerun passed with zero manual edits to the flow file. That run also caught a real bug fixed here: apply_patch now unwraps an accidental leading `- ` list marker in a model's answer, which previously nested a list inside steps: instead of replacing the entry.
4 tasks
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.
Summary
Stacked on #549 (plan 007's doc) — this is PR 2/4.
flowproof-agent::repair: diagnoses aRecordErrorinto plan 007's taxonomy, asks the configured authoring model for a minimal.flow.yamlpatch, and applies it via a whole-documentserde_yaml::Valueround-trip.flowproof-cli'scmd_record: on failure, if an authoring model is configured (and not--reuse), run the bounded repair loop (default 3 attempts) instead of failing immediately. Stops early if the same diagnosis category recurs on the same step with no progress.--no-repairrestores today's single-attempt behavior exactly..flow.yamland its<flow>.repair.jsonsidecar report — no source-code edits, ever, by construction.-YAML list marker despite being told not to, which previously nested a list insidesteps:instead of replacing the entry;apply_patchnow unwraps that case (regression test included).Verified live
Ran against a real Fiori tenant (
--headed, real Anthropic key): a deliberately malformed step failedrecord, the model correctly diagnosed and rewrote it, and the rerun passed with zero manual edits to the flow file. Also verified: no key configured → original plain-failure behavior, zero repair attempts, file untouched.Test plan
cargo fmt --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace— green except the pre-existing, environment-specificdoctor_ai_e2efailure (a real API key configured on the dev machine; reproduces identically on unmodifiedmain, confirmed viagit stash)record --headedagainst a real Fiori tenant, described above