You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cfe409a
Browse filesBrowse the repository at this point in the historyBrowse files
fix(gate): forward real model + tools to /gate pre-flight (T4)
Pre-0.7.7 every SDK /gate call for any workflow with a budget was
hard-blocked because the runtime hard-coded the literal string
"budget-precheck" as the model. The backend's PolicyEvaluationGraph
treated any synthetic cost_limit rule with score > 0.8 as Block,
so the pricing lookup never landed on a real model and the rule
fired with the wrong score.
This commit:
* Adds nullrun.set_call_context(model=..., tools=[...]) plus
get_call_model / get_call_tools helpers (and the underlying
_call_model_var / _call_tools_var contextvars in
nullrun.context).
* Wires the call context into check_workflow_budget: the /gate
payload now carries the real model name (or None when unset)
and the user-supplied tool list. tools=[] vs missing-None are
distinguished on the wire per gate/internal.rs::check_tool_block.
* Transport.check forwards the tools key when set (it was
silently dropped pre-fix).
* tests/conftest.py reset_runtime clears the new contextvars so
a test's set_call_context(...) doesn't leak into the next
test's wire payload.
* New tests/test_gate_real_path.py pins down the regression:
default request allows a clean workflow, real block still
honored, no policy-N residue on the wire, set_call_context
flows into the body, no-context means no tools key, and the
helpers are reachable from nullrun.*.
Bumps version to 0.7.7. No breaking changes - new helpers
default to None / empty so existing call sites keep working.
0 commit comments