refactor(tools): compose session execution pipeline#1643
Merged
Conversation
Aaronontheweb
force-pushed
the
feat/session-tool-execution-pipeline
branch
from
July 14, 2026 22:26
200fb10 to
532fc99
Compare
There was a problem hiding this comment.
Pull request overview
Refactors session tool execution by replacing the large static tool-dispatch entry point with a composed SessionToolExecutionPipeline and cohesive SessionToolBatch, making authority derivation immutable and exclusively sourced from an admitted TurnContext while keeping existing tool/background/approval/MCP behaviors stable.
Changes:
- Introduces
SessionToolExecutionPipeline(instance-based) +SessionToolBatchto encapsulate tool execution inputs, authority, and per-batch capabilities (background availability, streaming, approval state). - Makes tool audit logging a required dependency via
IToolAuditLogger+NullToolAuditLoggerand updates DI composition to always supply an audit sink. - Adds/updates characterization tests around authority derivation, malformed metadata auditing, background-manager absence and dispatch failures, and existing routing paths.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Netclaw.Daemon/Program.cs | Registers NullToolAuditLogger and makes IToolAuditLogger required for SessionToolServices composition. |
| src/Netclaw.Actors/Tools/IToolExecutor.cs | Adds NullToolAuditLogger null-object implementation for required audit dependency. |
| src/Netclaw.Actors/SubAgents/SubAgentActor.cs | Updates model-input materialization call site to supply a non-null logging adapter. |
| src/Netclaw.Actors/Sessions/SessionDependencies.cs | Makes SessionToolServices.AuditLogger non-nullable/required. |
| src/Netclaw.Actors/Sessions/Pipelines/SessionToolExecutionPipeline.cs | Major refactor: composed pipeline + batch object, explicit authority derivation, explicit background capability state, updated logging/audit plumbing. |
| src/Netclaw.Actors/Sessions/LlmSessionActor.cs | Composes the pipeline once and dispatches tool execution via SessionToolBatch. |
| src/Netclaw.Actors.Tests/Sessions/SessionToolExecutionPipelineTests.cs | Converts tests to use the new pipeline/batch API and adds authority-derivation coverage. |
| src/Netclaw.Actors.Tests/Sessions/Pipelines/SessionToolPipelineTestFixture.cs | Adds a test fixture to reduce boilerplate when exercising pipeline behavior. |
| src/Netclaw.Actors.Tests/Sessions/Pipelines/MetaValidationAndNoticeTests.cs | Adds audit characterization for malformed metadata denial. |
| src/Netclaw.Actors.Tests/Sessions/Pipelines/BackgroundRoutingTests.cs | Updates background routing tests and adds coverage for missing-manager fallback and dispatch failure behavior. |
| src/Netclaw.Actors.Tests/Sessions/LlmSessionTestExtensions.cs | Ensures tests compose a required IToolAuditLogger via NullToolAuditLogger. |
| openspec/changes/simplify-tool-execution-context/tasks.md | Marks Stage 1/2 tasks as completed and updates wording for Stage 2 validation step. |
| openspec/changes/simplify-tool-execution-context/specs/netclaw-session/spec.md | Adds/updates spec requirements describing the composed pipeline and authority derivation. |
| IMPLEMENTATION_PLAN.md | Marks Stage 1 as complete. |
| docs/spec/SPEC-002-session-lifecycle-and-protocol.md | Documents the new tool execution pipeline composition at a high level. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jul 16, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SessionToolExecutionPipelineand one cohesiveSessionToolBatchTurnContext, separating non-authority environment and explicit background capability stateBehavior compatibility
This is an internal refactor. It does not change tool or MCP schemas, persisted actor contracts, approval decisions, background routing results, or model-facing tool results. Background requests still execute synchronously when no background manager is registered; manager dispatch failures still return an error without synchronous retry.
Validation
dotnet test Netclaw.slnx --no-restore --nologodotnet slopwatch analyze: 0 issuespwsh ./scripts/Add-FileHeaders.ps1 -Verify: passedopenspec validate simplify-tool-execution-context --strict: passedgit diff --check: passedThe model-backed eval runner was invoked locally but correctly failed before execution because this machine has no
NETCLAW_EVAL_PROVIDER_*target configured; CI remains authoritative for configured eval checks.