#15115: fix: pre-load skill docs in cron sessions to prevent hallucinated syn…
app: web-ui
gateway
agents
stale
size: M
Cluster:
Skill Enhancements and Fixes
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
#8873: fix: document skill loading locations in system prompt
by ytfh44 · 2026-02-04
79.9%
#22525: [Bug]: Session snapshot not reloading skills after gateway restart ...
by zwffff · 2026-02-21
79.5%
#5273: fix: skill frontmatter fixes + description improvements (35 skills)
by Terwox · 2026-01-31
79.4%
#10016: fix: prevent FD exhaustion from skill watcher scanning artifact trees
by oldeucryptoboi · 2026-02-06
78.8%
#19664: fix(skills): log skill YAML parsing diagnostics with skill name
by orchidsun · 2026-02-18
78.8%
#23749: fix some issues
by tronpis · 2026-02-22
78.6%
#11250: fix: expand skills watcher ignore list and improve session repair l...
by zhangzhefang-github · 2026-02-07
78.5%
#13694: feat(cron): structured output via responseSchema for isolated agent...
by JordanCoin · 2026-02-10
78.1%
#9221: fix(skills): use skillKey for env config lookup in snapshots
by gavinbmoore · 2026-02-05
77.5%
#18743: Cron Tool Hardening: Normalize Gateway Params and Enforce Valid Sch...
by cccat6 · 2026-02-17
77.5%