feat(loop): per-edit type-check feedback — immediate ailang check on every .ail write/edit#73
Draft
sunholo-voight-kampff wants to merge 1 commit into
Conversation
…ail write/edit The finalize-only dp7 gate is never reached on max_steps runs, so the model wrote broken AILANG (=> drift) for the whole budget with no feedback. Now every WriteFile/EditFile of a .ail runs 'ailang check <file>' and returns OK or the errors in the tool result -> the model fixes errors the very next turn. Validated: probe showed FAILED+error -> model fixed -> OK.
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.
Idea
Today the type-check gate (DP7) runs at session finalize. A local model often churns many edits before it ever reaches finalize — so it can spend most of a run compounding one syntax mistake (e.g.
->vs=>in a match arm) with no signal that it's wrong.This wires DP7 per edit: after every
WriteFile/EditFileon a.ailfile, the harness runsailang check <file>and returns the result in the tool output the model sees on the next turn:ailang check: OK — file type-checks.ailang check: FAILED — fix these errors before continuing:+ the first ~1200 chars of the errorSo the model gets compiler feedback immediately instead of at the end.
Change (+42 / −12)
tool_runtime.ail—ail_typecheck_after_edit(resolved, workdir)helper (no-op for non-.ailfiles), wired intorun_write_file+run_edit_file.types.ail—typecheck: stringfield onWriteFileResult/EditFileResult.tool_dispatch_adapter.ail— serialize it into the tool result.Validated
list_statseval (implement a recursiveavg) PASSes with the feedback firing (OKlogged after the correct edit), local ollama qwen3.6.Open question (why this is draft)
It currently runs on every
.ailedit — oneailang checksubprocess per edit. That's the behavior I'd like your call on before finalizing:MOTOKO_PEREDIT_CHECK=1, default-on), orailang checkthat turn.Given the edit-tool / harness-problem discussion on #66, figured you'd want to shape this rather than have it land fixed. Happy to gate it whichever way you prefer.
🤖 Generated with Claude Code