Skip to content

fix: close audit-gap findings from roadmap/code reasoning audit - #60

Merged
ajwharton merged 3 commits into
mainfrom
fix/audit-gaps-dpo-shared-client
Aug 4, 2026
Merged

ajwharton merged 3 commits into
mainfrom
fix/audit-gaps-dpo-shared-client

Conversation

@ajwharton

@ajwharton ajwharton commented Aug 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes the four findings from the full reasoning audit of the roadmap, architecture, and code (plus two small cleanups). All changes are behavior-preserving except where a bug was being fixed.

Changes

1. run_dpo shared-client gap (correctness bug)

run_sft, run_vlm_sft, and run_grpo all accept service_client=/training_client=/close_clients= so a meta-recipe can run SFT → DPO → export on the same LoRA adapter. run_dpo did not — it always created and closed its own client, so a meta-recipe with an SFT stage followed by a DPO stage silently trained DPO on a fresh adapter, discarding the SFT result.

  • Added service_client/training_client/close_clients params to run_dpo (mirroring run_sft).
  • Wired meta_runners._run_dpo to reuse the shared SFT client.
  • New test test_default_runners_sft_then_dpo_shares_adapter asserts one adapter id across both stages.

2. Audit log now persists across restarts

anvil/control/audit.py kept the audit trail in-memory only, so a process restart lost the entire history — undermining the "audited force" promise.

  • Default JSONL sink at ~/.anvil/audit.jsonl (override ANVIL_AUDIT_LOG).
  • Replays prior events on startup (AuditEvent.from_public + _load).
  • Lazy default_log() + reset_default_log() so tests isolate the sink.
  • Tests: restart-survival + default-sink persistence.

3. export_hint is now honored

run_sft/run_dpo had a no-op format=plan.export_hint if ... == "peft" else "peft" that always exported PEFT, ignoring the recipe's edge intent (e.g. onnx for edge students). Added resolve_export_format() and used it in both runners.

  • Tests: test_run_sft_honors_export_hint / test_run_dpo_honors_export_hint assert an onnx hint produces an edge bundle (edge_manifest.json).

4. Version single-sourcing

anvil/web/app.py had a stale hardcoded version="0.0.1"; now reads anvil.__version__ (0.0.2).

  • Test: test_app_version_matches_package guards against a hardcoded-string regression.

5. Cleanups

  • Fixed broken docs/cluster.md reference in serve/app.py docstring → docs/org-self-host.md.
  • Removed dead elif t == "step" branch in agent/decide.py step_rows.

6. Agent identity naming

  • Added the "You are Vulcan" agent identity line to Agents.md and start.md (set by the AIOps LLM, 2026-08-01).

Verification

  • 269 passed, 3 skipped (was 263 baseline — 6 new tests).
  • ruff check anvil/ tests/ clean.

Four fixes from the full reasoning audit of roadmap, architecture, and code:

- run_dpo now accepts service_client/training_client/close_clients so a
  meta-recipe can run SFT -> DPO -> export on the SAME LoRA adapter instead
  of silently training DPO on a fresh one. meta_runners._run_dpo wires the
  shared client through; new test asserts one adapter id across stages.
- Audit log now persists to a JSONL sink by default (~/.anvil/audit.jsonl,
  override ANVIL_AUDIT_LOG) and replays prior events on startup, so the
  "audited force" trail survives process restarts. Tests isolate the sink
  via a temp path + reset_default_log().
- run_sft/run_dpo export now honors the recipe's export_hint (e.g. onnx for
  edge students) via resolve_export_format() instead of always exporting PEFT.
- Web app version is single-sourced from anvil.__version__ (was stale 0.0.1).
- Fix broken docs/cluster.md reference in serve docstring (-> org-self-host.md).
- Remove dead branch in agent/decide.py step_rows.

266 passed, 3 skipped; ruff clean.
Adds the agent identity line to the session-entry files, as set by the
AIOps LLM (2026-08-01).
- run_sft / run_dpo now tested to export the recipe's export_hint (onnx
  produces an edge bundle with edge_manifest.json) instead of always PEFT.
- Web app version asserted to equal anvil.__version__ (guards against a
  regression to a hardcoded string).

269 passed, 3 skipped; ruff clean.
@ajwharton
ajwharton merged commit 378874b into main Aug 4, 2026
1 check passed
@ajwharton
ajwharton deleted the fix/audit-gaps-dpo-shared-client branch August 4, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant