Skip to content

refactor(tools): fork typed subagent execution context#1644

Merged
Aaronontheweb merged 7 commits into
devfrom
feat/subagent-context-fork
Jul 15, 2026
Merged

refactor(tools): fork typed subagent execution context#1644
Aaronontheweb merged 7 commits into
devfrom
feat/subagent-context-fork

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

  • fork immutable parent authority and working context into a required ChildRunScope, with independent child activity state
  • model child termination as typed completion variants so failed and cancelled runs cannot carry mergeable context
  • make Git working-context inspection asynchronous, injectable, aggregate-bounded, and explicitly classified
  • correlate actor continuations by generation and preserve turn-scoped prompt state across the async boundary
  • merge only child-confirmed file changes; keep Git-observed worktree changes non-attributed
  • update SPEC-002, OpenSpec tasks, and the versioned operations/projects skills

Behavior contract

This is a behavior-preserving architecture refactor. MCP schemas and persisted actor contracts are unchanged. Public turns still never inspect Git. Git failure remains non-fatal and visibly unavailable. Successful/partial children retain confirmed-file handoff; failed/cancelled children cannot update parent context.

Validation

  • dotnet test Netclaw.slnx --no-restore — all runnable tests pass (Actors 2613, Daemon 827, CLI 1252, plus supporting projects; environment-gated integration tests skipped)
  • focused session/subagent/Git suite — 115 passed
  • dotnet slopwatch analyze — 0 issues
  • pwsh ./scripts/Add-FileHeaders.ps1 -Verify — pass
  • openspec validate simplify-tool-execution-context --strict — valid
  • git diff --check — pass

The behavioral eval harness cannot run locally because no eval provider type, endpoint, or model credentials are configured. The dotnet-skills CRAP collector workflow is unavailable because this repository does not include the XPlat coverage collector; the full actor assembly passes.

Advances #1633. The issue will be closed after merge and post-merge acceptance verification.

Comment thread src/Netclaw.Tools.Abstractions/ToolExecutionContext.cs Fixed
@Aaronontheweb

Copy link
Copy Markdown
Collaborator Author

Independent architecture review initially held this PR on three issues. Commit c20b8007 resolves all three:

  1. external cancellation/deadline now terminates and awaits the Git process tree, observes cancelled reads, and disposes the wrapper; deterministic lifecycle tests cover both paths;
  2. ChildRunScope now has one canonical working-context snapshot, eliminating divergent prompt/file-tracking state;
  3. provider exceptions become sanitized unavailable context, failed turns cancel pending continuations, and actor-level tests prove nonfatal failure plus stale-continuation rejection.

The reviewer re-reviewed the commit and returned a merge verdict with no blocking behavior drift. Local validation after the repair: Actors 2617/2617; full solution green; Slopwatch 0; headers, strict OpenSpec, and diff checks pass.

Comment thread src/Netclaw.Actors/Sessions/LlmSessionActor.cs
@Aaronontheweb
Aaronontheweb merged commit 66f7941 into dev Jul 15, 2026
21 checks passed
@Aaronontheweb
Aaronontheweb deleted the feat/subagent-context-fork branch July 15, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant