agent-zero/extensions/python/tool_execute_before/AGENTS.md
Alessandro e9e6b3faec Fix include placeholder expansion in tool arguments
Expand §§include(path) recursively at the tool execution boundary so
Chat, native Responses, and parallel calls receive file contents even
without streaming. Mutate the original argument dictionary so both
execution kwargs and tool.args receive the expanded values.

Run expansion before tool-policy checks and secret unmasking. Preserve
unreadable-file placeholders, add regression coverage, and document
hook ordering.

Validation: 133 focused tests passed in the a0 conda environment; seven
targeted tests passed in the live localhost:32081 container's framework
runtime. Full-suite and LLM-driven UI testing were not run.
2026-11-01 06:54:57 +01:00

1.4 KiB

Tool Execute Before Extensions DOX

Purpose

  • Own backend processing immediately before tool execution.

Ownership

  • Ordered Python files own file-include expansion, prior tool-output replacement, parallel recursion guards, and secret unmasking before execution.

Local Contracts

  • Unmask only values required by the target tool.
  • Preserve safety checks and do not expose secrets to logs or unrelated tools.
  • Keep ordering stable where replacement must occur before unmasking or execution.
  • _05_replace_include_alias.py expands §§include(path) recursively in argument values before tool-policy checks and secret unmasking. Mutate the original argument dictionary so both tool.args and execution kwargs receive file contents; unreadable files keep their placeholders through helpers.strings.replace_file_includes.
  • Execution expansion must work without response streaming for Chat, native Responses calls, and parallel workers; the response-stream hook remains display-only.

Work Guidance

  • Coordinate with secret handling, tool argument preparation, and plugin tool gates.

Verification

  • Smoke-test tool execution with masked secret arguments and prior-output references after changes.
  • Run pytest tests/test_tool_file_includes.py tests/test_parallel_tool_args.py -q for include expansion, hook ordering, and shared argument mutation.

Child DOX Index

No child DOX files.