Cap project instructions across environments (#37424)

## Why

Applying `project_doc_max_bytes` independently to every selected environment
allows the total project instruction payload to grow with the number of
environments.

## What changed

Treat `project_doc_max_bytes` as one shared byte budget. Consume it in selected
environment order, truncate the entry that reaches the remaining limit, and
skip later environments once the budget is exhausted.

Update the configuration descriptions to document the aggregate limit.

## Testing

Add unit and integration coverage for partial and exhausted budgets across
multiple environments.

GitOrigin-RevId: 4664bdf1f23b66986349d503f44cf51560b9024f
This commit is contained in:
jif authored and copyberry committed 2026-08-07 09:50:43 +00:00
1 parent 95c7265e84
commit 85e0661c3b
6 files changed
+110 -24

No files matched your search

+1 -1
View File
@@ -864,7 +864,7 @@ pub struct Config {
/// Combined provider map (defaults plus user-defined providers).
pub model_providers: HashMap<String, ModelProviderInfo>,
/// Maximum number of bytes to include from an AGENTS.md project doc file.
/// Maximum total bytes of project instruction content across all selected environments.
pub project_doc_max_bytes: usize,
/// Additional filenames to try when looking for project-level docs.