Commit 663b28b
committed
fix(skills): prevent empty responses after load_skill
The skill system instruction does not tell the model what to do after a
load_skill call returns. Some models (notably Gemini) treat the load_skill
tool call as the entire turn and stop with no visible output, producing
empty responses. This is most acute for tool-heavy skills, whose next
correct action after load_skill is to call more tools rather than reply.
Add rule 7 to _build_skill_system_instruction: load_skill only retrieves
instructions and does NOT complete the turn; the model must continue in the
same turn (calling whatever tools the skill requires) and never end with an
empty response right after loading a skill. The rule uses the {prefix}
substitution like the other rules, so both the default and prefixed system
instructions carry it.
Verified in a production environment: appending this guidance dropped the
empty-response rate for Gemini after skill loading substantially.
Adds tests asserting rule 7 is present in both the default and prefixed
system instruction.1 parent 9e3b43f commit 663b28b
2 files changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
100 | 105 | | |
101 | 106 | | |
102 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1758 | 1758 | | |
1759 | 1759 | | |
1760 | 1760 | | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
1761 | 1779 | | |
1762 | 1780 | | |
1763 | 1781 | | |
| |||
0 commit comments