Release: relay mirrored gateway approvals after stream loss (#5041, fixes #5000) - #5044
Merged
Merged
Conversation
Contributor
|
| Filename | Overview |
|---|---|
| api/route_approvals.py | Adds a helper that reconciles mirrored gateway approvals and returns a matching mirrored run_id for the same session and approval id. |
| api/routes.py | Extends approval responses to relay through a mirrored gateway origin when the active stream lookup is unavailable. |
| tests/test_gateway_approval_legacy_path.py | Adds tests for gateway approval relay after stream loss and for gateway-mode clicks with no pending approval. |
| CHANGELOG.md | Adds the release note for the gateway approval recovery behavior. |
Reviews (1): Last reviewed commit: "Release: relay mirrored gateway approval..." | Re-trigger Greptile
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.
Ships @rodboev's #5041 — relay mirrored gateway approvals after stream loss (fixes #5000).
What this does
When you approve/deny a gateway-routed tool-use request,
/api/approval/respondwalked back through the session'sactive_stream_idto find the run. If that pointer was gone (reconnect, background tab, ended stream), responding failed withgateway_run_unavailableeven though the mirrored approval card still carried the originating gateway run info. The handler now relays a mirrored gateway approval using the approval's own carried origin (scoped to the same session + approval id), keeping the card actionable across stream loss.Gate results
ast.parse(route_approvals.py + routes.py) ✓ · ruff forward-gate CLEAN (0 new violations)active_stream_id→_STREAM_RUN_IDS(unchanged), stream-lost relay only uses the mirrored approval for the samesid+approval_id(no cross-session misroute), missing-origin approvals still returngateway_run_unavailable, auth/CSRF gates intact in the shared POST path.test_gateway_approval_legacy_path.py14/14 + adjacent approval checks 11/11.Backend-only (api/), no served-page change → no browser smoke needed. Pre-merge head re-check: live PR head code byte-identical to the gated branch.
Attribution: credit @rodboev in CHANGELOG. Closes #5041 + #5000 on merge.