Repository navigation
Do not map advise-gate cancel onto a 401 bearer error - #347
Merged
Merged
Conversation
POST /v1/advise/gate treated drain, POST /v1/requests/:id/cancel, and tenant disable as the same 401 "missing or invalid bearer token". Orchestrate already splits those: revoke stays 401 (anti-enumeration); cancel is its own taxonomy. Return 409 "request cancelled" when the tenant is still alive. Co-authored-by: Tyler Reckart <tylerreckart@users.noreply.github.com>
Co-authored-by: Tyler Reckart <tylerreckart@users.noreply.github.com>
This was referenced Sep 16, 2026
…l-not-401 # Conflicts: # CHANGELOG.md
tylerreckart
marked this pull request as ready for review
September 21, 2026 12:58
tylerreckart
enabled auto-merge (squash)
September 21, 2026 12:58
…l-not-401 # Conflicts: # CHANGELOG.md
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.
Problem
POST /v1/advise/gateregistered withInFlightRegistryso admin disable, token rotate, server drain, andPOST /v1/requests/:id/cancelcan abort the provider call. Afterrun_advisor_gatereturned, the handler lumped sticky/hard cancel and tenant revoke into one HTTP 401{"error":"missing or invalid bearer token"}.Orchestrate already splits those (
docs/concepts/authentication.md): tenant disable/rotate stay 401 so clients cannot enumerate revoked tenants; caller cancel is thecancelledtaxonomy. On advise/gate, a drain or explicit cancel looked like a bad bearer, so an external loop could drop a still-valid token.Fix
advisor_gate_http_abortmaps post-call state:missing or invalid bearer token(revoke wins when both are true)request cancelledDocs list the new 409. Public API: callers that treated every advise-gate failure as auth should handle 409 as cancel; 401 meaning is unchanged.
Tests
unit_advisor_gate— alive/success, revoke, cancel, and revoke+cancel (401 wins). Suite 20/20 locally (+ ASan).arbitercompiles.Independently mergeable against
main(0456350). merge-tree vs #321–#346:src/api_server.cppauto-merges; only CHANGELOG[Unreleased]sibling-conflicts after the first of those merges.Note
Low Risk
Narrow HTTP semantics change on a beta endpoint; 401 auth meaning is unchanged, but clients that treated all non-200 advise-gate responses as invalid tokens should treat 409 as cancel/retry.
Overview
POST /v1/advise/gateno longer treats server drain orPOST /v1/requests/:id/cancelas auth failure. Afterrun_advisor_gatecompletes, post-call abort handling usesadvisor_gate_http_abort: disabled/revoked tenant still gets 401"missing or invalid bearer token"(revoke wins when cancel and revoke both apply); cancel while the tenant is still valid returns 409"request cancelled".Docs and changelog document the new 409. Unit tests cover success, revoke, cancel, and revoke+cancel precedence.
Reviewed by Cursor Bugbot for commit 85e1118. Bugbot is set up for automated code reviews on this repo. Configure here.