Skip to content

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
arniwesth:mainfrom
sunholo-voight-kampff:feat/per-edit-typecheck
Draft

feat(loop): per-edit type-check feedback — immediate ailang check on every .ail write/edit#73
sunholo-voight-kampff wants to merge 1 commit into
arniwesth:mainfrom
sunholo-voight-kampff:feat/per-edit-typecheck

Conversation

@sunholo-voight-kampff

Copy link
Copy Markdown
Contributor

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/EditFile on a .ail file, the harness runs ailang 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 error

So the model gets compiler feedback immediately instead of at the end.

Change (+42 / −12)

  • tool_runtime.ailail_typecheck_after_edit(resolved, workdir) helper (no-op for non-.ail files), wired into run_write_file + run_edit_file.
  • types.ailtypecheck: string field on WriteFileResult / EditFileResult.
  • tool_dispatch_adapter.ail — serialize it into the tool result.

Validated

list_stats eval (implement a recursive avg) PASSes with the feedback firing (OK logged after the correct edit), local ollama qwen3.6.

Open question (why this is draft)

It currently runs on every .ail edit — one ailang check subprocess per edit. That's the behavior I'd like your call on before finalizing:

  1. always-on (current),
  2. env-gated (MOTOKO_PEREDIT_CHECK=1, default-on), or
  3. only when the model didn't itself just run ailang check that 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

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants