Skip to content

v0.8.3

Latest

Choose a tag to compare

@wangxingjun778 wangxingjun778 released this 20 Nov 03:35

Feature

  • Progress-gated turn-cap extension: TurnCapGuard now enforces a soft cap (guardrail.max_calls_per_turn, default 50) and an absolute hard cap (max_calls_per_turn_hard, default 150). A productive window — mostly successful and mostly distinct calls — extends the cap by calls_extension_step (default 25), so long multi-step work is not cut off mid-task while spinning turns still stop. Extension is also gated by real resource budgets and is invisible to the model, leaving the cached prompt prefix unchanged.
  • Actionable guardrail halts: when a turn stops on the tool-call cap, the forced-finalize path tells the model the stop reason and requires it to separate completed from unexecuted steps, state that replying continue resumes the remaining work, avoid unverified completion claims, and verify completed or uncertain side effects before repeating actions. The fallback notice carries the same reason instead of the generic "reasoning step limit" text.
  • New settings surface: guardrail.max_calls_per_turn (soft), guardrail.max_calls_per_turn_hard, guardrail.calls_extension_step, with LEAPFLOW_GUARDRAIL_MAX_CALLS_PER_TURN_HARD / LEAPFLOW_GUARDRAIL_CALLS_EXTENSION_STEP env overrides and config-service field descriptions.

Enhance

  • Text-mode tool calls are now counted toward the turn cap alongside native calls, so the ceiling can no longer be bypassed by emitting calls as text.
  • Turn-cap accounting uses a closed-window model: extended calls become their own window, so one productive stretch cannot carry a later unproductive one.

Fix

  • Cross-session guardrail leakage: session engines now receive an independent guardrail copy (CompositeGuardrail.fresh()), restoring the soft cap and clearing per-turn baselines. Previously a turn starting in one session could reset the call-count baseline another concurrent session was being measured against.
  • A text-mode tool request that trips the guardrail is no longer surfaced as if it were a final answer.

Refactor

  • GuardrailViolation gains an extendable flag; cap-extension policy stays in engine/tools/, while engine.py only passes the halt context to its existing tool-free finalization helpers.

Tests

  • Added coverage for window productivity and reset, absolute-ceiling overshoot in batches, canonical argument dedup with configurable ratios, resource-vs-stall gating, non-extendable repetition halts, actionable finalize prompts, the extension path through the unified streaming/non-streaming loop, the full config chain, and independent guardrail baselines across concurrent sessions.

Upgrade notes

  • Defaults change behavior: a busy turn may now run past 50 calls up to 150 when progress is sustained. Set guardrail.max_calls_per_turn_hard equal to guardrail.max_calls_per_turn to restore the previous flat cap.
  • A running leapd holds the old guardrail wiring; restart it to pick up the new cap semantics.

What's Changed

Full Changelog: v0.8.2...v0.8.3