style: revert unrelated Black-style formatting churn (#3220)

The earlier commits picked up a large amount of Black-style reformatting
(multi-line frozenset / keyword-arg wrapping / docstring blanks / removed
parens) on top of the actual guard fix. @chengyongru flagged it; the
first pass reverted some but not all.

This restores nanobot/providers/base.py, runner.py, heartbeat/service.py,
and utils/evaluator.py to origin/main and reapplies only the guard logic:

  - base.py: add should_execute_tools property
  - runner.py / heartbeat/service.py / utils/evaluator.py: route through it
    + log a warning when has_tool_calls but finish_reason is anomalous

Net diff vs main is now +87/-4 (was +211/-102) — roughly 30 lines of real
logic, which is what the PR is actually about.

Behavior unchanged from previous HEAD; full suite still 2014 passed.

Made-with: Cursor
This commit is contained in:
Xubin Ren authored and Xubin Ren committed 2026-04-17 20:39:46 +08:00
1 parent 9a569fdc6a
commit 14ee7cb121
4 files changed
+104 -178

No files matched your search

+7 -11
View File
@@ -39,7 +39,6 @@ _EVALUATE_TOOL = [
}
]
async def evaluate_response(
response: str,
task_context: str,
@@ -56,15 +55,12 @@ async def evaluate_response(
llm_response = await provider.chat_with_retry(
messages=[
{"role": "system", "content": render_template("agent/evaluator.md", part="system")},
{
"role": "user",
"content": render_template(
"agent/evaluator.md",
part="user",
task_context=task_context,
response=response,
),
},
{"role": "user", "content": render_template(
"agent/evaluator.md",
part="user",
task_context=task_context,
response=response,
)},
],
tools=_EVALUATE_TOOL,
model=model,
@@ -75,7 +71,7 @@ async def evaluate_response(
if not llm_response.should_execute_tools:
if llm_response.has_tool_calls:
logger.warning(
"evaluate_response: ignoring tool calls under finish_reason='%s', defaulting to notify",
"evaluate_response: ignoring tool calls under finish_reason='{}', defaulting to notify",
llm_response.finish_reason,
)
else: