Repository navigation
feat(agents): embedders pick each agent's tools and sub-agent finish tools - #1787
Conversation
dc43f93 to
c86da3a
Compare
[Medium impact] The PR appears safe to merge, with a non-blocking fix needed for custom finish-tool instructions after resume. Findings
Fix with agent prompt### Issue 1
strix/core/hooks.py:155-156
**Resumed children forget finish tools.** A child's custom `FINISH_TOOL_KEY` survives a fresh spawn because its context copies `parent_ctx`, but it is never saved with the child. On resume, `respawn_subagents` rebuilds every child from the fresh root context, which lacks this key. This lookup then returns `agent_finish`, so warnings and recovery messages direct the child to a tool that `select_tools` may have removed in favor of `validator_finish` or another custom finish tool.
Save the name with each child's metadata and restore it into the child's context before restarting it.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThis PR lets embedders choose each agent's tools and give child agents their own finish tools.
One non-blocking issue remains: resumed children lose their custom finish-tool name. Reviews (2) · Last reviewed commit: "refactor(agents): one helper names the t..." · Reviewed by Greptile |
| def subagent_finish_tool(context: dict[str, Any]) -> str: | ||
| return str(context.get(FINISH_TOOL_KEY) or "agent_finish") |
There was a problem hiding this comment.
Resumed children forget finish tools. A child's custom
FINISH_TOOL_KEY survives a fresh spawn because its context copies parent_ctx, but it is never saved with the child. On resume, respawn_subagents rebuilds every child from the fresh root context, which lacks this key. This lookup then returns agent_finish, so warnings and recovery messages direct the child to a tool that select_tools may have removed in favor of validator_finish or another custom finish tool.
Save the name with each child's metadata and restore it into the child's context before restarting it.
Prompt To Fix With AI
This is a comment left during a code review.
Path: strix/core/hooks.py
Line: 155-156
Comment:
**Resumed children forget finish tools.** A child's custom `FINISH_TOOL_KEY` survives a fresh spawn because its context copies `parent_ctx`, but it is never saved with the child. On resume, `respawn_subagents` rebuilds every child from the fresh root context, which lacks this key. This lookup then returns `agent_finish`, so warnings and recovery messages direct the child to a tool that `select_tools` may have removed in favor of `validator_finish` or another custom finish tool.
Save the name with each child's metadata and restore it into the child's context before restarting it.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Lets strix-pro give each PR-review agent type only its own tools, ending with its own finish tool (
investigator_finish,validator_finish,reporter_finish). No behavior change when unused.select_toolsonrun_strix_scanis_root, the agent'sskillsand its defaulttools; returns the tools to build that agent withFINISH_TOOL_KEYon a sub-agent's spawn contextagent_finish_LIFECYCLE_TOOLSfinish_tool_name(context)(refactor)