Skip to content

refactor(tools): close execution context cleanup#1646

Merged
Aaronontheweb merged 8 commits into
devfrom
chore/tool-context-closeout
Jul 15, 2026
Merged

refactor(tools): close execution context cleanup#1646
Aaronontheweb merged 8 commits into
devfrom
chore/tool-context-closeout

Conversation

@Aaronontheweb

@Aaronontheweb Aaronontheweb commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remove the production no-op tool audit sink and keep the existing session transcript as the single observability owner
  • represent interactive approval as one required capability union instead of a nullable support flag plus nullable bridge
  • return deterministic typed Git-executable absence while preserving other process-start failures as unavailable
  • balance subagent lifecycle notifications and activity-stream completion across initial snapshot failure and cancellation races
  • reconcile the active OpenSpec change and engineering documentation with the shipped behavior

Behavior and compatibility

This removes an internal sink whose production implementation discarded every entry. Existing ToolCallOutput and ToolResultOutput publication, session.log behavior, tool results, approval outcomes, MCP schemas, and persisted actor contracts remain unchanged. The approval union closes a previously representable invalid state; all production composition paths already constructed a definite interactive or non-interactive state.

Validation

  • independent deep architecture review: MERGE after an initial HOLD and repair pass
  • focused lifecycle/security/pipeline tests: 152 passed
  • full solution: 5,884 passed; 14 existing credential/container-gated integration tests skipped
  • strict OpenSpec validation passed
  • Slopwatch: 0 findings
  • file headers passed
  • git diff check passed
  • behavioral eval invocation explicitly blocked by missing NETCLAW_EVAL_PROVIDER_TYPE, NETCLAW_EVAL_PROVIDER_ENDPOINT, and NETCLAW_EVAL_MODEL_ID

Closes #1633

Comment thread src/Netclaw.Actors/SubAgents/SubAgentSpawner.cs Fixed

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

This PR closes out the “tool execution context cleanup” refactor by removing the unused tool audit sink, making interactive approval an explicit required capability value, hardening Git working-context inspection failure classification, and tightening subagent lifecycle signaling while updating OpenSpec + engineering documentation to match shipped behavior.

Changes:

  • Replace SupportsInteractiveApproval + nullable ApprovalBridge with a required InteractiveApprovalCapability union (Unavailable / Available(bridge)), closing previously representable invalid states.
  • Remove IToolAuditLogger / ToolAuditEntry plumbing from the session tool pipeline and composition, relying on the canonical ToolCallOutput/ToolResultOutput transcript path.
  • Introduce deterministic “git executable not found” typing in working-context inspection and balance subagent activity-stream completion across snapshot/cancellation races, with updated tests.

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Netclaw.Tools.Abstractions/ToolExecutionContext.cs Makes interactive approval a required run-scope capability and removes legacy interactive-approval flag/bridge accessors.
src/Netclaw.Tools.Abstractions/IParentApprovalBridge.cs Adds InteractiveApprovalCapability union type to represent interactive approval availability with a required bridge.
src/Netclaw.Daemon/Reminders/ReminderEndpointRouteBuilderExtensions.cs Updates reminder tool execution to pass InteractiveApprovalCapability.Unavailable.
src/Netclaw.Daemon/Program.cs Removes registration/wiring of the now-deleted IToolAuditLogger from daemon DI composition.
src/Netclaw.Daemon.Tests/Tools/TestToolExecutionContext.cs Updates daemon test helper to construct contexts with explicit interactive approval capability.
src/Netclaw.Actors/Tools/ToolAccessPolicy.cs Switches non-interactive enforcement checks to the new capability union.
src/Netclaw.Actors/Tools/ScopedFileAccessPolicy.cs Applies autonomous-zone clamp based on InteractiveApprovalCapability.Unavailable.
src/Netclaw.Actors/Tools/IToolExecutor.cs Removes ToolAuditEntry/IToolAuditLogger/NullToolAuditLogger types.
src/Netclaw.Actors/SubAgents/SubAgentSpawner.cs Balances subagent notifications and stream completion across initial snapshot failure/cancellation and spawn/ask races; forwards interactive approval as a capability.
src/Netclaw.Actors/SubAgents/SubAgentActor.cs Derives _approvalBridge from InteractiveApprovalCapability.Available instead of a nullable scope property.
src/Netclaw.Actors/Sessions/WorkingContextSnapshot.cs Adds typed ExecutableNotFound result for Git inspection; implements deterministic classification in runner/inspector and rendering.
src/Netclaw.Actors/Sessions/SessionDependencies.cs Removes audit logger dependency from SessionToolServices.
src/Netclaw.Actors/Sessions/Pipelines/SessionToolExecutionPipeline.cs Removes audit sink usage and uses InteractiveApprovalCapability for per-call scope construction.
src/Netclaw.Actors/Sessions/LlmSessionActor.cs Updates pipeline construction and internal tool contexts to match removed audit logger + new interactive approval capability.
src/Netclaw.Actors.Tests/Tools/ToolExecutionValueObjectTests.cs Adds null-guard test coverage for required interactive approval capability.
src/Netclaw.Actors.Tests/Tools/ToolApprovalGateTests.cs Updates test contexts to use capability union for interactive/non-interactive cases.
src/Netclaw.Actors.Tests/Tools/TestToolExecutionContext.cs Updates shared test context factory and introduces a test IParentApprovalBridge implementation for Available capability.
src/Netclaw.Actors.Tests/Tools/MessyCommandOneTimeApprovalTests.cs Migrates test context setup to capability union.
src/Netclaw.Actors.Tests/Tools/DispatchingToolExecutorTests.cs Migrates multiple approval-gate test contexts to capability union.
src/Netclaw.Actors.Tests/Tools/AutonomousZoneClampTests.cs Updates autonomous clamp behavior test to reflect explicit “unavailable” capability (no nullable legacy state).
src/Netclaw.Actors.Tests/SubAgents/SubAgentTestScope.cs Updates subagent scope creation to carry InteractiveApprovalCapability instead of bridge/flag fields.
src/Netclaw.Actors.Tests/SubAgents/SubAgentSpawnerTests.cs Adds deterministic coverage for initial snapshot failure/cancellation and stream completion; migrates approval bridging assertions to capability union.
src/Netclaw.Actors.Tests/Sessions/WorkingContextSnapshotTests.cs Adds stable typed missing-git coverage and updates existing Git inspection tests for the new failure kind.
src/Netclaw.Actors.Tests/Sessions/ToolLoopCompactionTests.cs Removes unused audit logger fixture wiring.
src/Netclaw.Actors.Tests/Sessions/ToolExecutionIntegrationTests.cs Removes audit logger assertions and deletes the fake audit logger implementation.
src/Netclaw.Actors.Tests/Sessions/SessionToolExecutionPipelineTests.cs Updates assertions to validate InteractiveApprovalCapability on derived run scope/context.
src/Netclaw.Actors.Tests/Sessions/Pipelines/SessionToolPipelineTestFixture.cs Removes audit logger injection path for pipeline fixture.
src/Netclaw.Actors.Tests/Sessions/Pipelines/MetaValidationAndNoticeTests.cs Updates malformed-meta test to validate denial semantics via tool result content (no audit sink).
src/Netclaw.Actors.Tests/Sessions/MaxToolIterationTests.cs Removes unused audit logger fixture wiring.
src/Netclaw.Actors.Tests/Sessions/LlmSessionTestExtensions.cs Removes default IToolAuditLogger DI registration in test composite setup.
src/Netclaw.Actors.Tests/Sessions/EmptyResponseEscalationTests.cs Removes unused audit logger fixture wiring.
src/Netclaw.Actors.Tests/Sessions/ApprovalRehydrationTests.cs Updates test recording to infer interactive approval support from capability union.
openspec/changes/simplify-tool-execution-context/tasks.md Marks Stage 3/closeout tasks as completed and records validation/eval environment block evidence.
openspec/changes/simplify-tool-execution-context/specs/tool-call-metadata/spec.md Documents removal of the unused audit-entry enrichment requirement.
openspec/changes/simplify-tool-execution-context/specs/session-cwd/spec.md Updates spec to include executable-not-found as an explicit Git inspection outcome.
openspec/changes/simplify-tool-execution-context/specs/netclaw-tools/spec.md Updates tool pipeline requirements to reflect single transcript ownership and required interactive-approval capability union.
openspec/changes/simplify-tool-execution-context/proposal.md Updates proposal to reflect audit-sink removal and capability changes.
openspec/changes/simplify-tool-execution-context/design.md Updates design to document interactive approval union and rationale for removing the no-op audit sink.
IMPLEMENTATION_PLAN.md Marks Stage 3 and quality gates complete and records eval environment block rationale.
docs/spec/value-object-audit.md Updates audit doc references after removing ToolAuditEntry.
docs/spec/SPEC-002-session-lifecycle-and-protocol.md Updates session lifecycle spec to reflect removal of audit dependency and new interactive approval capability union.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) July 15, 2026 01:11
@Aaronontheweb Aaronontheweb added the cleanup Code quality improvements and tech debt reduction label Jul 15, 2026
@Aaronontheweb
Aaronontheweb merged commit ebdfc4f into dev Jul 15, 2026
21 checks passed
@Aaronontheweb
Aaronontheweb deleted the chore/tool-context-closeout branch July 15, 2026 01:39
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: make Git working-context inspection injectable and aggregate-bounded

2 participants