Skip to content

refactor(tools): compose session execution pipeline#1643

Merged
Aaronontheweb merged 4 commits into
devfrom
feat/session-tool-execution-pipeline
Jul 14, 2026
Merged

refactor(tools): compose session execution pipeline#1643
Aaronontheweb merged 4 commits into
devfrom
feat/session-tool-execution-pipeline

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

  • replace the 26-parameter static session tool entry point with a composed SessionToolExecutionPipeline and one cohesive SessionToolBatch
  • derive immutable tool authority exclusively from the admitted TurnContext, separating non-authority environment and explicit background capability state
  • require audit, time, executor, approval, and logging infrastructure by construction while preserving disabled audit through an explicit null object
  • preserve approval, background fallback, cancellation, timeout, streaming, MCP, persistence, and model-visible behavior
  • add characterization coverage for authority derivation, malformed metadata audit, background manager absence, dispatch failure, and existing routing paths
  • update the active OpenSpec change and engineering documentation

Behavior 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

  • independent architecture/behavior review: merge-ready after two blocking findings were corrected
  • dotnet test Netclaw.slnx --no-restore --nologo
    • Actors: 2,602 passed
    • Daemon: 827 passed
    • CLI: 1,252 passed
    • remaining unit suites passed; environment-backed integration tests skipped by their existing guards
  • focused pipeline/background/metadata suite: 40 passed
  • dotnet slopwatch analyze: 0 issues
  • pwsh ./scripts/Add-FileHeaders.ps1 -Verify: passed
  • openspec validate simplify-tool-execution-context --strict: passed
  • git diff --check: passed

The 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.

@Aaronontheweb
Aaronontheweb force-pushed the feat/session-tool-execution-pipeline branch from 200fb10 to 532fc99 Compare July 14, 2026 22:26
@Aaronontheweb Aaronontheweb added tools Issues related to agent tools: file_read, web_search, shell_execute, image processing, etc. context-pipeline LLM context assembly: prompt layers, dynamic injection, memory recall, temporal grounding cleanup Code quality improvements and tech debt reduction labels Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) + SessionToolBatch to encapsulate tool execution inputs, authority, and per-batch capabilities (background availability, streaming, approval state).
  • Makes tool audit logging a required dependency via IToolAuditLogger + NullToolAuditLogger and 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.

Comment thread src/Netclaw.Actors/Sessions/LlmSessionActor.cs
@Aaronontheweb
Aaronontheweb merged commit 7e68222 into dev Jul 14, 2026
22 checks passed
@Aaronontheweb
Aaronontheweb deleted the feat/session-tool-execution-pipeline branch July 14, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code quality improvements and tech debt reduction context-pipeline LLM context assembly: prompt layers, dynamic injection, memory recall, temporal grounding tools Issues related to agent tools: file_read, web_search, shell_execute, image processing, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants