diff --git a/CHANGELOG.md b/CHANGELOG.md index 74fc4574..5ea59846 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,12 @@ and this project uses [Calendar Versioning](https://calver.org/) in the format the hook engine, not tied to Claude Code permission rules), conservative (unparseable targets are blocked, not allowed), and skips `drone rm` itself. This makes the safe-delete path discoverable at the moment of friction. (#630) +- **Hook engine logs `agent_type` / `agent_id` per fire** — the engine now + records which agent triggered each hook (e.g. `agent=main` vs `agent=Explore`) + in both `engine.jsonl` and the prax monitor stream. Previously the payload + flowed into handlers but was never logged, leaving no way to tell an internal + main-turn fire from a real sub-agent fire. Pure visibility; no behavior change. + Groundwork for #606. (#606) ### Changed diff --git a/src/aipass/hooks/apps/modules/engine.py b/src/aipass/hooks/apps/modules/engine.py index fa615f90..7f656ae9 100644 --- a/src/aipass/hooks/apps/modules/engine.py +++ b/src/aipass/hooks/apps/modules/engine.py @@ -139,9 +139,10 @@ def dispatch(event_type: str, stdin_data: str, config: dict) -> str: result = _run_hook(command, stdin_data, timeout_s=hook_timeout) logger.info( - "[HOOKS] %s.%s exit=%d out=%db %dms", + "[HOOKS] %s.%s agent=%s exit=%d out=%db %dms", event_type, hook_name, + parsed.get("agent_type", "") or "main", result["exit_code"], len(result["stdout"]), result["elapsed_ms"], @@ -151,6 +152,8 @@ def dispatch(event_type: str, stdin_data: str, config: dict) -> str: "ts": time.time(), "event": event_type, "hook": hook_name, + "agent_type": parsed.get("agent_type", ""), + "agent_id": parsed.get("agent_id", ""), "exit_code": result["exit_code"], "elapsed_ms": result["elapsed_ms"], "stdout_len": len(result["stdout"]),