Skip to content

Interrupt Bridge HTTP backoff when the context is cancelled - #88

Open
Hanabi9248 wants to merge 1 commit into
IvorySQL:masterfrom
Hanabi9248:codex/bridge-cancellation
Open

Hanabi9248 wants to merge 1 commit into
IvorySQL:masterfrom
Hanabi9248:codex/bridge-cancellation

Conversation

@Hanabi9248

@Hanabi9248 Hanabi9248 commented Sep 23, 2026 •

Copy link
Copy Markdown

Checklist:

  • Explained the change and its motivation
  • Added an automated regression test
  • Tested the affected package locally; environment limits are listed below

Type of Changes:

  • Bug fix

Current behavior

With BridgeIdentifiers enabled, a failed installation request can keep the reconciler waiting after its context is cancelled. The HTTP request uses the context, but wait.ExponentialBackoff does not interrupt the delay between attempts. The existing cancellation test checks the eventual error without bounding that delay.

New behavior

Use ExponentialBackoffWithContext so cancellation also interrupts the retry delay. Request headers, idempotency keys and response cleanup are unchanged. The new local HTTP-server regression uses a 100 ms deadline and a 3-second backoff: the original code returns after about 3 seconds and fails; the fix returns at the deadline.

Validation

  • go test ./internal/bridge -count=1 — passed (7 top-level tests).
  • go vet ./internal/bridge and git diff --check — passed.
  • Windows, Go 1.27.1. No live Kubernetes cluster or external Bridge service was used. BridgeIdentifiers remains disabled by default.

Summary by CodeRabbit

  • Bug Fixes
    • Retry delays now stop promptly when a request’s context is canceled or times out.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 4c2fedc8-693c-4236-9a85-2800b5e9f76c

📥 Commits

Reviewing files that changed from the base of the PR and between 0240ce2 and b5f4a6a.

📒 Files selected for processing (2)
  • internal/bridge/client.go
  • internal/bridge/client_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

doWithBackoff now uses context-aware exponential backoff. A new test checks that a context deadline interrupts the backoff delay and returns context.DeadlineExceeded.

Changes

Retry cancellation

Layer / File(s) Summary
Context-aware backoff and cancellation test
internal/bridge/client.go, internal/bridge/client_test.go
doWithBackoff passes its context to wait.ExponentialBackoffWithContext. The test verifies that a 100-millisecond deadline interrupts the configured backoff and returns context.DeadlineExceeded.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b5f4a

Cancellation can interrupt the retry delay, and no merge-blocking issue is identified from the supplied evidence.

🚥 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 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: interrupting Bridge HTTP backoff when the context is cancelled.
Description check ✅ Passed The description explains the current and new behavior, identifies the motivation, classifies the change as a bug fix, documents validation results and environment limits, and confirms an automated reg…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@Hanabi9248

Copy link
Copy Markdown
Author

Could a maintainer review this cancellation change and approve the pending workflows when convenient? The bridge package tests and go vet pass locally; the regression checks that a 100 ms deadline interrupts a 3-second retry delay. The three upstream workflows are still awaiting approval, so I have not treated them as passed. Please let me know if anything else is needed before considering a merge.

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.

1 participant