Route hx limit stops to on_budget, accept _hx/ methods, send catches
A blocked step result with reason "limit" and no catch now takes the same path as an orchestrator budget stop. Other blocked reasons keep the normal catch path. hx/step context now lists the state's catch names so hx can pick a valid one. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bf609c2e0e
commit
1f2486a599
3 files changed
+107
-10
No files matched your search
@@ -8,7 +8,10 @@ Behaviour per `hx/step`, chosen with FAKE_MODE (orch passes FAKE_* through the p
|
||||
permission asks session/request_permission first and records the answer in permission.txt
|
||||
slow works until hx/interrupt (records hx/message and hx/compact in messages.txt / compact.txt), then
|
||||
answers done; a retried step with context.hint finishes at once
|
||||
limit step_result blocked, no catch, reason "limit" (hx hit a limit from hx/step)
|
||||
error step_result blocked, no catch, reason "error"
|
||||
crash exits without a step_result
|
||||
FAKE_UNDERSCORE=1 sends every custom method as `_hx/...`.
|
||||
FAKE_USAGE="ctx_used,ctx_limit,cost" makes every step report that usage first.
|
||||
Every received message is appended to FAKE_LOG when set. Each step also appends its prompt kind to steps.txt.
|
||||
"""
|
||||
@@ -29,6 +32,8 @@ def send(o):
|
||||
|
||||
|
||||
def note(method, params):
|
||||
if os.environ.get("FAKE_UNDERSCORE") and method.startswith("hx/"):
|
||||
method = "_" + method
|
||||
send({"method": method, "params": params})
|
||||
|
||||
|
||||
@@ -85,6 +90,9 @@ def step(params):
|
||||
if mode == "needs_input" and not params.get("context", {}).get("hint"):
|
||||
note("hx/step_result", {"status": "needs_input", "question": "Which provider?"})
|
||||
return
|
||||
if mode in ("limit", "error"): # blocked without a catch, only the reason differs
|
||||
note("hx/step_result", {"status": "blocked", "reason": mode, "summary": f"hit the {mode}"})
|
||||
return
|
||||
blocked = mode == "blocked"
|
||||
if mode == "block_once" and not os.path.exists(os.path.join(cwd, ".fake_blocked")):
|
||||
open(os.path.join(cwd, ".fake_blocked"), "w").close()
|
||||
|
||||
Reference in new issue
Block a user