Skip to content

fix(http-bridge): reuse reservations after owner rejection - #2353

Merged
Soju06 merged 1 commit into
mainfrom
fix/bridge-recovery-reservation
Sep 11, 2026
Merged

Soju06 merged 1 commit into
mainfrom
fix/bridge-recovery-reservation

Conversation

@Komzpa

@Komzpa Komzpa commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

When an HTTP bridge owner rejects a bootstrap request before dispatch, local recovery acquires a second API-key reservation. The original hold can remain reserved, and a low request limit can reject recovery before it starts.

Transfer the original reservation into the local recovery request. Its existing lifecycle keeps settlement ownership through capacity waits, submission and cancellation.

Validation

  • The regression fails on main at the second reservation and passes with this change.
  • 76 reservation, cancellation and release tests pass.
  • Repository lint/type checks and strict OpenSpec validation pass.

OpenSpec: reuse-owner-rejection-reservation. This follows the maintainer's request to separate the reservation repair from draining-owner recovery.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-10T16:43:26.164894Z afd4391 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 136599e6-f804-44da-8854-1aebbdfe0e63

📥 Commits

Reviewing files that changed from the base of the PR and between 9559603 and afd4391.

📒 Files selected for processing (6)
  • app/modules/proxy/_service/http_bridge/streaming.py
  • openspec/changes/reuse-owner-rejection-reservation/.openspec.yaml
  • openspec/changes/reuse-owner-rejection-reservation/proposal.md
  • openspec/changes/reuse-owner-rejection-reservation/specs/sticky-session-operations/spec.md
  • openspec/changes/reuse-owner-rejection-reservation/tasks.md
  • tests/unit/test_proxy_http_bridge.py

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Improved API-key reservation handling when an owner rejects a request before dispatch.
    • Local recovery now reuses the original reservation instead of acquiring a second one.
    • Preserved fail-closed behavior for ambiguous or unsuccessful recovery scenarios.
  • Tests

    • Added regression coverage confirming reservations are acquired and settled only once.
  • Documentation

    • Documented reservation reuse and lifecycle behavior for owner-rejection recovery.

Walkthrough

The owner-forward recovery path now reuses the origin request’s API-key reservation after pre-dispatch rejection. OpenSpec requirements and unit tests cover single reservation acquisition and existing fail-closed behavior.

Changes

Owner-rejection reservation reuse

Layer / File(s) Summary
Reservation reuse contract
openspec/changes/reuse-owner-rejection-reservation/*
OpenSpec documents reuse of the original reservation, exactly-once settlement, and fail-closed handling for cancellation, acknowledged responses, and ambiguous dispatch failures.
Local recovery reservation transfer
app/modules/proxy/_service/http_bridge/streaming.py
Local recovery passes the original api_key_reservation to prepare_bridge_request and no longer creates or releases a reacquired reservation.
Pre-dispatch rejection regression test
tests/unit/test_proxy_http_bridge.py
The test simulates RECEIVER_REJECTED, reuses initial_reservation, and asserts that retry reservation acquisition is not awaited.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to afd43

Owner-rejection recovery now reuses the existing API-key reservation, avoiding duplicate holds while preserving settlement behavior. The change is ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (5 skipped: 4 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the reservation reuse change, its purpose, and validation results. It is directly related to the changeset.
Title check ✅ Passed The title clearly and concisely identifies the main change: reusing reservations after an HTTP bridge owner rejection.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (5 skipped: 4 unsupported, 1 too large.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bridge-recovery-reservation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Soju06
Soju06 merged commit 98d2256 into main Sep 11, 2026
39 checks passed
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.

2 participants