fix: honor is_active field in token POST/PUT requests#2584
Merged
crivetimihai merged 1 commit intomainfrom Jan 31, 2026
Merged
Conversation
Add is_active field support through the complete request pipeline: - Schemas: Added is_active to TokenCreateRequest (bool, default=True) and TokenUpdateRequest (Optional[bool], default=None) - Service: Modified create_token() and update_token() methods to accept and use is_active parameter instead of hardcoding - Router: Updated all 3 token endpoints (create, update, create_team) to pass is_active=request.is_active - Tests: Added explicit coverage for is_active=False on create and update, including toggle and reactivation scenarios Backward compatible: default values maintain existing behavior for clients not sending the field. Closes #2573 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
5fbc707 to
f19e477
Compare
Member
Review ChangesRebased onto main and made the following improvements: Commit cleanup
Added test coverage for
|
crivetimihai
approved these changes
Jan 31, 2026
hughhennelly
pushed a commit
to hughhennelly/mcp-context-forge
that referenced
this pull request
Feb 8, 2026
Add is_active field support through the complete request pipeline: - Schemas: Added is_active to TokenCreateRequest (bool, default=True) and TokenUpdateRequest (Optional[bool], default=None) - Service: Modified create_token() and update_token() methods to accept and use is_active parameter instead of hardcoding - Router: Updated all 3 token endpoints (create, update, create_team) to pass is_active=request.is_active - Tests: Added explicit coverage for is_active=False on create and update, including toggle and reactivation scenarios Backward compatible: default values maintain existing behavior for clients not sending the field. Closes IBM#2573 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Signed-off-by: hughhennnelly <hughhennelly06@gmail.com>
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
Add is_active field support through the complete request pipeline: - Schemas: Added is_active to TokenCreateRequest (bool, default=True) and TokenUpdateRequest (Optional[bool], default=None) - Service: Modified create_token() and update_token() methods to accept and use is_active parameter instead of hardcoding - Router: Updated all 3 token endpoints (create, update, create_team) to pass is_active=request.is_active - Tests: Added explicit coverage for is_active=False on create and update, including toggle and reactivation scenarios Backward compatible: default values maintain existing behavior for clients not sending the field. Closes IBM#2573 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐛 Bug-fix PR
📌 Summary
API tokens could not be created or updated with
is_active=false. Theis_activefield in POST/PUT request bodies was completely ignored, forcing all tokens to be active regardless of the intended state. This prevented programmatic management of inactive tokens and broke API contract expectations.🔗Related Issue
Closes #2573
🐞 Root Cause
Three layers were missing the
is_activefield:TokenCreateRequestandTokenUpdateRequestschemas didn't includeis_activefieldcreate_token()andupdate_token()methods hardcodedis_active=Trueinstead of accepting parameteris_activefrom request to service💡 Fix Description
Added
is_activefield through the complete request pipeline:is_active: bool = Field(default=True)toTokenCreateRequestandis_active: Optional[bool] = Field(None)toTokenUpdateRequestis_activeparameter; changed DB INSERT from hardcoded to parameterized; added conditional update logic with None-checkis_active=request.is_active🧪 Verification
make lintmake testmake coverage📐 MCP Compliance (if relevant)
✅ Checklist
make black isort pre-commit)