Skip to content

feat: gate sampling tool registration behind agent.sampling config flag - #1562

Merged
avoidwork merged 5 commits into
mainfrom
feat/sampling-tool-config-gate
Oct 29, 2026
Merged

avoidwork merged 5 commits into
mainfrom
feat/sampling-tool-config-gate

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Adds an agent.sampling boolean config flag that gates registration of the sampling tool, mirroring how agent.decision.baseUrl gates the decision tool. Defaults to true, preserving existing behavior. When set to false, the tool is not registered and its system-prompt instruction is omitted.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

Added gating tests in tests/unit/tool_index.test.js (registers by default / when true / not when false) and token injection/removal tests in tests/unit/prompts.test.js. Full suite passes: 4445 tests, 0 failures. Lint clean (oxlint 0 warnings, 0 errors).

Coverage

  • Line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with maintained line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Adds an agent.sampling boolean to config.yaml that controls whether the
sampling tool is registered, mirroring how agent.decision.baseUrl gates
the decision tool. Defaults to true to preserve existing behavior.

- src/config/schemas/agent.js: add sampling boolean (default true)
- src/tools/index.js: gate sampling registration on samplingEnabled
- src/memory/prompts.js + prompts/SYSTEM_PROMPT.md: conditional sampling
  instruction via SAMPLING_TOOL_INSTRUCTION token
- config.yaml: add agent.sampling flag
- tests: gating tests in tool_index.test.js and prompts.test.js
@avoidwork avoidwork self-assigned this Oct 28, 2026
Adds the gate-sampling-tool-config OpenSpec change documenting the
agent.sampling config flag that gates sampling tool registration.
Includes proposal, design, delta spec for ephemeral-sampling, and tasks.
…pling spec

Archives the completed gate-sampling-tool-config OpenSpec change to
openspec/changes/archive/2026-10-28-gate-sampling-tool-config/ and
syncs its delta spec into openspec/specs/ephemeral-sampling/spec.md,
adding the config-gated registration and conditional instruction
requirements.
@avoidwork
avoidwork merged commit 4426a05 into main Oct 29, 2026
2 checks passed
@avoidwork
avoidwork deleted the feat/sampling-tool-config-gate branch October 29, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant