Merge pull request #320 from hardness1020/fix/s04-hooks-problem-block-idiom

fix(s04): align problem code block with early-continue idiom
This commit is contained in:
gui-yue
2026-05-29 11:48:07 +08:00
committed by GitHub
3 changed files with 24 additions and 21 deletions

View File

@@ -21,7 +21,8 @@ def agent_loop(messages):
while True: while True:
# ... LLM call ... # ... LLM call ...
for block in response.content: for block in response.content:
if block.type == "tool_use": if block.type != "tool_use":
continue
log_to_file(block) # added a line log_to_file(block) # added a line
check_permission(block) # added a line check_permission(block) # added a line
notify_slack(block) # added another line notify_slack(block) # added another line

View File

@@ -21,7 +21,8 @@ def agent_loop(messages):
while True: while True:
# ... LLM call ... # ... LLM call ...
for block in response.content: for block in response.content:
if block.type == "tool_use": if block.type != "tool_use":
continue
log_to_file(block) # 一行追加 log_to_file(block) # 一行追加
check_permission(block) # 一行追加 check_permission(block) # 一行追加
notify_slack(block) # さらに一行追加 notify_slack(block) # さらに一行追加

View File

@@ -21,7 +21,8 @@ def agent_loop(messages):
while True: while True:
# ... LLM call ... # ... LLM call ...
for block in response.content: for block in response.content:
if block.type == "tool_use": if block.type != "tool_use":
continue
log_to_file(block) # 加一行 log_to_file(block) # 加一行
check_permission(block) # 加一行 check_permission(block) # 加一行
notify_slack(block) # 又加一行 notify_slack(block) # 又加一行