Skip to content

Fix Guardrails.record() dropping tool args for prerequisite tracking#72

Open
hobostay wants to merge 1 commit into
antoinezambelli:mainfrom
hobostay:fix/guardrails-record-args
Open

Fix Guardrails.record() dropping tool args for prerequisite tracking#72
hobostay wants to merge 1 commit into
antoinezambelli:mainfrom
hobostay:fix/guardrails-record-args

Conversation

@hobostay
Copy link
Copy Markdown

Summary

  • Guardrails.record() only passed tool names to StepEnforcer.record(), but StepEnforcer also accepts an optional args parameter for argument-based prerequisite checks
  • Without args, prerequisite checks that depend on argument values (e.g., "tool B requires tool A to have been called with mode='full'") always see missing data and produce false negatives
  • Update the signature to accept both plain tool names (backward compatible) and (name, args) tuples

Impact

  • The runner already passes args correctly (step_enforcer.record(tc.tool, tc.args)) — this fix brings the Guardrails convenience wrapper to parity
  • Any caller using Guardrails.record() will now properly support argument-based prerequisites

Test plan

  • Verify passing plain tool names still works (backward compatible)
  • Verify passing (name, args) tuples properly forwards args
  • Run existing test suite

🤖 Generated with Claude Code

Guardrails.record() only passed tool names to StepEnforcer.record(),
but StepEnforcer also accepts an optional args parameter used for
argument-based prerequisite checks (e.g., "tool B requires tool A to
have been called with mode='full'"). Without args, prerequisite checks
that depend on argument values always see missing data and produce
false negatives.

Update the signature to accept both plain tool names (backward
compatible) and (name, args) tuples, forwarding args to the enforcer
when provided. The runner already passes args correctly — this fix
brings the convenience wrapper to parity.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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