Skip to content

Fix confirmation token retry loop#35

Merged
sylvesterdamgaard merged 1 commit into
mainfrom
sd/fix-delete-confirm-loop
Jun 30, 2026
Merged

Fix confirmation token retry loop#35
sylvesterdamgaard merged 1 commit into
mainfrom
sd/fix-delete-confirm-loop

Conversation

@sylvesterdamgaard

Copy link
Copy Markdown
Contributor

Summary

  • Add confirmation_token as an optional top-level parameter on router schemas so MCP clients can resubmit gated actions.
  • Preserve and restore the originally confirmed argument payload when a valid confirmation token is supplied.
  • Make confirmation token validation tolerate associative key reordering while still rejecting changed payloads and reordered lists.

Root Cause

Gated actions read confirmation_token from the top-level tool arguments, but the parameter was not present in the advertised schema. Some MCP clients dropped or misplaced the token on retry, causing the confirmation flow to issue a fresh token repeatedly.

Validation

  • ./vendor/bin/pest tests/Feature/ConfirmationActionsConfigTest.php tests/Unit/Auth/ConfirmationTokenManagerTest.php tests/Feature/McpJsonSchemaValidationTest.php
  • ./vendor/bin/pint --test src/Mcp/Tools/BaseRouter.php src/Mcp/Tools/Concerns/RequiresConfirmation.php src/Auth/ConfirmationTokenManager.php tests/Unit/Auth/ConfirmationTokenManagerTest.php tests/Feature/McpJsonSchemaValidationTest.php tests/Feature/ConfirmationActionsConfigTest.php
  • ./vendor/bin/phpstan analyse src/Auth/ConfirmationTokenManager.php src/Mcp/Tools/BaseRouter.php src/Mcp/Tools/Concerns/RequiresConfirmation.php

Fixes #34.

@sylvesterdamgaard sylvesterdamgaard merged commit 390d2e4 into main Jun 30, 2026
8 checks passed
@sylvesterdamgaard sylvesterdamgaard deleted the sd/fix-delete-confirm-loop branch June 30, 2026 11:15
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.

Delete confirmation loops forever (looks like confirmation_token never makes it into the tool schema?)

1 participant