Skip to content

Conversation

@thelinuxkid
Copy link

Summary

  • Updates PermissionResult response format to match latest control protocol specification
  • Changes response format from "allow" boolean to "behavior" string field
  • Adds support for additional fields like updatedPermissions and interrupt flag

Changes

  • Response format: Changed from {"allow": true/false} to {"behavior": "allow"/"deny"}
  • Input modification: Updated field name from "input" to "updatedInput"
  • New features: Added support for updatedPermissions in allow responses
  • Deny responses: Changed "reason" to "message" and added interrupt flag support
  • Tests: Updated all test assertions to match new response format

Technical Details

This PR updates the permission callback response handling in src/claude_code_sdk/_internal/query.py to align with the latest control protocol specification. The changes ensure compatibility with newer versions of the control protocol while maintaining backward compatibility through proper type handling.

Test plan

  • All existing tests pass with updated assertions
  • Permission callbacks continue to work with new response format
  • Input modification functionality preserved
  • Deny responses properly formatted

🤖 Generated with Claude Code

@dicksontsai
Copy link
Collaborator

Thanks for your change! Are you able to:

  1. Merge/rebase to the latest main branch
  2. Re-push your changes (force push) with verified signatures?

Alternatively, if it's too much work for you, I can merge in the changes you have here in a separate PR.

I tested this code on an example, and it works well.

thelinuxkid and others added 2 commits October 5, 2025 17:56
- Change response format from "allow" to "behavior" field
- Update input modification field from "input" to "updatedInput"
- Add support for updatedPermissions in allow responses
- Update deny response to use "message" instead of "reason"
- Add support for interrupt flag in deny responses
- Update tests to reflect new response format

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Fix syntax errors in query.py permission serialization
- Add to_dict() method to PermissionUpdate class to properly handle all type variants
- Replace complex inline serialization with clean method call
- Ensure compatibility with TypeScript control protocol interface

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@thelinuxkid thelinuxkid force-pushed the fix/permissionresult branch from 4aa5c5d to 1a23f48 Compare October 5, 2025 22:58
ashwin-ant added a commit that referenced this pull request Oct 6, 2025
@humanize-platform
Copy link

humanize-platform commented Oct 7, 2025

Can you expedite merging this PR? We are facing the same issue with our project as well.

@SatyendraGollaFacets
Copy link

Can you expedite merging this PR please? We have been waiting on this for a while

@ashwin-ant
Copy link
Collaborator

We merged #209, which was the equivalent PR but with code signing. If you update to 0.1.1 it should work.

@ashwin-ant ashwin-ant closed this Oct 9, 2025
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.

5 participants