Skip to content

Fix subagent project scope corrections - #1920

Merged
Aaronontheweb merged 1 commit into
devfrom
fix/subagent-project-scope-correction
Aug 13, 2026
Merged

Fix subagent project scope corrections#1920
Aaronontheweb merged 1 commit into
devfrom
fix/subagent-project-scope-correction

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

  • return the existing project-scope declaration correction to subagents before opening the parent approval bridge
  • apply a successful set_working_directory declaration only to the child run, reload its project instructions, and keep the parent project unchanged
  • prevent headless correction loops without granting headless execution authority
  • reject NUL, CR, and LF at the shared working-directory declaration boundary

Why

A subagent could issue reviewed-safe work beneath an undeclared project cwd, receive a user approval prompt, and never get the same model-facing correction available to a parent session. Merely returning the correction was insufficient: the child did not apply the declaration to later tool contexts or reload project guidance.

This keeps the original shell call and history intact. It teaches the child to declare the project through the existing tool and filesystem policy, then reevaluates the unchanged retry under the resulting child scope.

Validation

  • adversarial production review: PASS, no warnings
  • focused actor/policy/tool tests: 85/85
  • full actor suite before final rebase: 3,181 passed, 1 expected Windows-only skip
  • Release build: 0 warnings/errors
  • strict OpenSpec validation
  • copyright headers
  • changed-file format verification
  • changed-file Slopwatch: 0 findings
  • PII review: no findings

The full solution run also surfaced one unrelated existing MCP diagnostic assertion mismatch in McpSdkCatalogNotificationIntegrationTests; this PR does not touch that test or MCP production code.

@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) August 13, 2026 10:31
{
const string projectGuidance = "Project instructions that must not load.";
var worktree = Path.GetFullPath(AppContext.BaseDirectory);
var controlledDirectory = Path.Combine(worktree, $"project-{controlCharacter}-candidate");
{
var allowedRoot = scopeToolAccepts
? worktree
: Path.Combine(worktree, "different-workspace-root");
@Aaronontheweb
Aaronontheweb merged commit 2a03d08 into dev Aug 13, 2026
23 checks passed
@Aaronontheweb
Aaronontheweb deleted the fix/subagent-project-scope-correction branch August 13, 2026 11:00
@Aaronontheweb Aaronontheweb added subagents spawn_agent, SubAgentActor, definition loader, discovery context layer, and related features shell Issues related to the shell tool, since it has the largest security perimeter. labels Aug 13, 2026
@Aaronontheweb Aaronontheweb mentioned this pull request Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shell Issues related to the shell tool, since it has the largest security perimeter. subagents spawn_agent, SubAgentActor, definition loader, discovery context layer, and related features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant