← Back to PRs

#15115: fix: pre-load skill docs in cron sessions to prevent hallucinated syn…

by joaolcorreia open 2026-02-13 01:58 View on GitHub →
app: web-ui gateway agents stale size: M
Fix for Issue: #15091 Summary - In single-turn isolated cron sessions, the model skips reading SKILL.md files and hallucinates command syntax (e.g., gog gmail messages get instead of gog gmail get) - Adds a skills?: string[] field to the cron agentTurn payload that inlines SKILL.md content directly into extraSystemPrompt, eliminating the need for a tool call - Adds normalization (trim, deduplicate, filter invalid values) and schema validation for the new field Test plan - All 132 existing cron tests pass - Protocol conformance tests pass with new field - New normalization tests: valid array, all-invalid, non-array, empty array - New readSkillContentsByName tests: case-insensitive matching, non-matching names, empty inputs, unreadable files, empty content - Manual: create a cron job with skills: ["gog"] and verify the agent receives inlined SKILL.md content in transcript - Verify backward compat: existing cron jobs without skills field work unchanged <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a `skills?: string[]` field to cron `agentTurn` payloads and uses it in isolated cron runs to inline matching `SKILL.md` contents into `extraSystemPrompt`, so isolated single-turn runs don’t have to call a tool to read skill docs. Changes span cron payload types + gateway schema, cron job normalization, a new `readSkillContentsByName()` helper to map requested skill names to resolved workspace skills and load their docs, and wiring in `runCronIsolatedAgentTurn()` to pass the resulting `extraSystemPrompt` into both CLI-provider and embedded runs. <h3>Confidence Score: 3/5</h3> - This PR is close to mergeable, but has a couple of correctness/consistency issues around skill name normalization and duplicate prompt injection that should be fixed first. - Core wiring (new schema/type + isolated cron run integration) is straightforward, but current normalization stores non-canonical skill names while tests/consumers expect lowercase/case-insensitive behavior, and `readSkillContentsByName()` can duplicate content and repeated file reads when duplicates slip through. These are likely to cause surprising persisted payloads and inflated prompts. - src/cron/normalize.ts, src/agents/skills/workspace.ts <sub>Last reviewed commit: c516a38</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs