Ignore project instructions for untrusted projects (#39837)

## What changed

- Skip project-scoped `AGENTS.md` discovery when the active project is untrusted, while preserving user-level instructions.
- Include the active project trust level in the instruction cache key so runtime trust changes reload the applicable instructions.
- Preserve updated project trust metadata during runtime configuration refreshes.

## Testing

Add coverage for initially untrusted projects and for switching between trusted and untrusted states at runtime.

GitOrigin-RevId: 284bf7693943f585013fb5fe4b6aa3309bc50cf3
This commit is contained in:
Dylan Hurd authored and copyberry committed 2026-08-21 02:33:50 +00:00
1 parent d8ec270183
commit bd19459358
4 files changed
+131

No files matched your search

+4
View File
@@ -61,6 +61,10 @@ pub(crate) async fn load_project_instructions(
windows_sandbox_level: WindowsSandboxLevel,
) -> io::Result<Option<LoadedAgentsMd>> {
let mut loaded = LoadedAgentsMd::from_user_instructions(user_instructions);
if config.active_project.is_untrusted() {
return Ok((!loaded.is_empty()).then_some(loaded));
}
let mut remaining = config.project_doc_max_bytes;
for turn_environment in environments.turn_environments() {
if remaining == 0 {