← Back to PRs

#21542: feat(config): add injectMode for workspace bootstrap files

by anonymusk7 open 2026-02-20 02:38 View on GitHub →
agents size: S
## Summary Add a new configuration option to control how often bootstrap files are injected: - every-turn (default): Current behavior - once: Inject only on first message (~90% token savings) - minimal: Inject only AGENTS.md + TOOLS.md every turn ## Problem All workspace bootstrap files injected every message = ~2MB redundant context per 100 messages. ## Solution 1. Added workspace.injectMode to config schema 2. Added inject-mode.ts helper functions 3. Backward compatible (defaults to every-turn) ## Files - src/config/zod-schema.agent-defaults.ts - src/agents/pi-embedded-helpers/inject-mode.ts (new) Closes #21538 <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR adds a new `injectMode` configuration option to control bootstrap file injection frequency, but introduces a **breaking schema change** that will cause runtime errors. **Critical Issue:** - The schema changes `agents.defaults.workspace` from `z.string().optional()` to `z.object({ injectMode: ... }).optional()`, breaking all existing code that reads `workspace` as a string path - Multiple files access `config.agents?.defaults?.workspace` expecting a string: `src/commands/setup.ts:42`, `extensions/llm-task/src/llm-task-tool.ts:188`, `src/wizard/onboarding.ts:149`, etc. - Existing user configs with `workspace: "/path/to/dir"` will fail Zod validation - No migration strategy or backward compatibility handling provided **Additional Concerns:** - The new `inject-mode.ts` file is never imported or used anywhere in the codebase, suggesting incomplete implementation - The PR description claims "backward compatible" but the schema change is not backward compatible **Recommendation:** The `workspace` field needs to support both the legacy string format AND the new object format. Consider using `z.union([z.string(), z.object({ injectMode: ... })]).optional()` with proper type guards and migration logic. <h3>Confidence Score: 0/5</h3> - This PR contains a breaking schema change that will cause runtime failures - Score of 0 (critical issues) because the schema change from string to object for `agents.defaults.workspace` breaks backward compatibility and will cause runtime errors in at least 10+ locations throughout the codebase where the field is accessed as a string. The PR claims to be "backward compatible" but introduces a breaking change without migration logic. - src/config/zod-schema.agent-defaults.ts requires immediate attention - the workspace field change must be reverted or made truly backward compatible <sub>Last reviewed commit: 5d832cb</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