Skip to content

Execute Herta call plans and track adapter dispatch evidence (Go/Bend/Lean synthesis) - #16

Open
arahe-dev wants to merge 2 commits into
devin/1795110536-herta-leanfrom
devin/1795200000-herta-synthesis
Open

arahe-dev wants to merge 2 commits into
devin/1795110536-herta-leanfrom
devin/1795200000-herta-synthesis

Conversation

@arahe-dev

@arahe-dev arahe-dev commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

What does this change?

Stacked on #15. Implements the step the Go, Bend/Bend2 and Lean studies converged on, and measures it against an equally typed Go SDK baseline (herta/docs/SYNTHESIS.md).

  • SDK (evidence.go): Policy.TrackDispatch + hertasdk.Dispatch(ctx). After an attempt (or a nested call inside it) dispatches, Transient becomes Uncertain; a NonIdempotent descendant's dispatch forbids an enclosing attempt from retrying Uncertain. Opt-in; untracked behavior unchanged (contract Amendment 7).
  • Herta: call op(args) was a checker edge emitted verbatim (not valid Go). It now lowers to p.<Op>.Do(ctx, <Input>{...}) through a generated <Runtime>Plan, so the checked graph, closed Calls and executed calls are one list. New evidence dispatch clause and dispatch statement; tracking is inferred for every op that can reach a tracked one.
  • Eval (herta/eval/synthesis): 5 scenarios × 5 arms (plain Go SDK, typed Go SDK, typed Go + caller annotation, Herta without/with evidence), provider-counted commits, expectations fixed in the test before the first run; all 25 cells match.
  • Lean: T6 — with tracking, any classifier is safe if the adapter dispatches before applying; T6_witness evaluates the mislabeled-ack trace (2 → 1, and 2 when the adapter applies before dispatch).
  • CI: herta check cases now receive {args}; closed-policy failed on the base branch without it.

Why?

The boundary study showed checked Herta and plain Go both double-commit when an adapter reports a lost ack as "not sent". Results:

scenario plain Go typed Go typed Go + annotation Herta, no evidence Herta plan
lost ack, adapter says not sent 2, Success 1, Uncertain 1, Uncertain 2, Success 1, Uncertain
nested checkout → publish, mislabel 2, Success 2, Success 1, Uncertain 2, Success 1, Uncertain
adapter sends before dispatch point 2, Success 2, Success 2, Success 2, Success 2, Success

Pre-send refusals and honest lost acks behave identically on all arms. The only Herta advantage over the same Go API is inferring tracking through the plan; with the annotation, Go equals Herta. Cost: tracked uncontended call 222–279 ns / 184 B / 4 allocs vs 129–183 ns / 112 B / 2 allocs (Go 1.27.4, 3 × 200k). Not addressed: adapters that apply before Dispatch, rollback, calls on unrelated contexts, opaque helpers.

Scope check

  • Runtime changes keep docs/contract.md true (or change it explicitly) — Amendment 7
  • go test -race -count=1 . passes with 100% coverage; cd lab && go test -race -count=1 ./... passes
  • No adoption claims, benchmarks without methodology, or marketing language
  • Links valid; SVG renders in both GitHub light and dark mode (if touched)
  • Linked issue (if any): #

Also run: go test -race ./..., herta check (30/30) and codegen (5/5) goldens, herta/formal/check.sh (Lean 4.36.0, standard axioms only).


Herta opened this PR for Abdur
Implemented in session Build the Go, Bend and Lean synthesis into Herta
Review with Devin · Open in Devin Desktop


- hertasdk: Policy.TrackDispatch + Dispatch(ctx); Transient after dispatch
  becomes Uncertain, nonidempotent descendant dispatch blocks Uncertain retry
- herta: call statements lower to a generated <Runtime>Plan; evidence
  dispatch clause, dispatch statement, tracking inferred over the plan
- eval/synthesis: 5x5 matrix vs plain and typed Go SDK; Lean T6
- CI: pass case args to herta check

Co-Authored-By: Abdur Raheem Imami <araheemimami@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 18:12
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Co-Authored-By: Abdur Raheem Imami <araheemimami@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 finding. Devin automatically fixed it.

Fixed by Devin (1)
  • Inline plan calls silently discard failures — Confirmed: if c { call x(a) } dropped the error. Any call at a statement boundary ({, ;, line start/end) now returns the callee error; golden covers the inline case.

View findings in Devin Review · Follow Devin's work

Devin Review

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.

2 participants