← Back to PRs

#9521: fix: restrict bootstrap files for cron agentTurn sessions

by ComputClaw open 2026-02-05 09:24 View on GitHub →
agents stale size: XS
## Summary Cron jobs with `agentTurn` payload now receive only `AGENTS.md` and `TOOLS.md`, matching sub-agent behavior. Previously they received all 8 bootstrap files (SOUL.md, MEMORY.md, USER.md, IDENTITY.md, etc.) which is unnecessary for task-focused scheduled jobs. ## Changes - Add `isCronSessionKey()` helper to detect cron session keys - Add `isRestrictedBootstrapSession()` combining subagent + cron checks - Rename `SUBAGENT_BOOTSTRAP_ALLOWLIST` to `RESTRICTED_BOOTSTRAP_ALLOWLIST` - Update `filterBootstrapFilesForSession()` to use new combined check ## Impact - Reduced token usage for cron jobs - Faster cron execution - Cleaner separation: task runners vs conversational sessions ## Before/After | Session Type | Before | After | |--------------|--------|-------| | Main session | All 8 files | All 8 files | | Sub-agent | AGENTS.md + TOOLS.md | AGENTS.md + TOOLS.md | | Cron agentTurn | All 8 files ❌ | AGENTS.md + TOOLS.md ✅ | <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR introduces a shared `isRestrictedBootstrapSession()` predicate (sub-agent OR cron session) and updates workspace bootstrap filtering so restricted sessions only receive `AGENTS.md` and `TOOLS.md` instead of the full bootstrap set. The routing layer (`src/routing/session-key.ts`) now re-exports the new helpers from `src/sessions/session-key-utils.ts`, and `filterBootstrapFilesForSession()` in `src/agents/workspace.ts` uses that combined check to apply the allowlist. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - Changes are small, localized, and use the same session-key parsing pattern as existing helpers; no additional call sites were introduced beyond bootstrap filtering, and the behavior change matches the stated intent (cron agentTurn sessions now receive the restricted bootstrap set). - No files require special attention <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs