Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/engineer-bot-followup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ jobs:
with:
python-version: '3.11'

# setup-poetry runs `poetry lock` (to reconcile the lock with the internal
# JFrog source it injects), which REWRITES tracked poetry.lock / pyproject.toml
# in the working tree. The venv is already built, so the tree no longer needs
# that churn — revert it, else the followup's fixup commit (or its leftover
# check) would sweep up these bot-untouched dirty files. Keep ONLY the
# agent's edits in the tree.
- name: Revert poetry lock/pyproject churn (keep only the agent's edits)
run: git checkout -- poetry.lock pyproject.toml || true

# Shared prelude: mint the engineer-bot token (pushes fixup commits, posts
# replies) + the engine-scoped token, set up Node, install the engine.
- name: Bot prelude (tokens + Node + engine install)
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/engineer-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ jobs:
with:
python-version: '3.11'

# setup-poetry runs `poetry lock` (to reconcile the lock with the internal
# JFrog source it injects), which REWRITES tracked poetry.lock / pyproject.toml
# in the working tree. The venv is already built, so the tree no longer needs
# that churn — revert it, else publish's leftover safety-net sees these
# bot-untouched dirty files and refuses to open the PR (they aren't in the
# agent's touched_files). Keep ONLY the agent's edits in the tree.
- name: Revert poetry lock/pyproject churn (keep only the agent's edits)
run: git checkout -- poetry.lock pyproject.toml || true

# Shared prelude: mint the engineer-bot token (pushes the fix branch,
# comments) + the engine-scoped token, set up Node, install the pinned
# engine (PAT-free). `token` output is used by the steps below.
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/sql/auth/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def sleep_for_retry(self, response: BaseHTTPResponse) -> bool:
else:
proposed_wait = self.get_backoff_time()

proposed_wait = max(proposed_wait, self.delay_max)
proposed_wait = min(proposed_wait, self.delay_max)
self.check_proposed_wait(proposed_wait)
logger.debug(f"Retrying after {proposed_wait} seconds")
time.sleep(proposed_wait)
Expand Down
26 changes: 16 additions & 10 deletions tests/unit/test_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,23 @@ def test_sleep__no_retry_after(self, t_mock, retry_policy, error_history):
retry_policy.history = [error_history, error_history]
retry_policy.sleep(HTTPResponse(status=503))

expected_backoff_time = max(
self.calculate_backoff_time(
0, retry_policy.delay_min, retry_policy.delay_max
),
retry_policy.delay_max,
expected_backoff_time = self.calculate_backoff_time(
0, retry_policy.delay_min, retry_policy.delay_max
)
t_mock.assert_called_with(expected_backoff_time)

@patch("time.sleep")
def test_sleep__retry_after_header_honored_not_inflated(
self, t_mock, retry_policy, error_history
):
# A small server Retry-After must be honored as-is (capped at delay_max),
# not inflated up to delay_max.
retry_policy._retry_start_time = time.time()
retry_policy.history = [error_history, error_history]
retry_policy.sleep(HTTPResponse(status=503, headers={"Retry-After": "2"}))

t_mock.assert_called_with(2)

@patch("time.sleep")
def test_sleep__no_retry_after_header__multiple_retries(self, t_mock, retry_policy):
num_attempts = retry_policy.stop_after_attempts_count
Expand All @@ -62,11 +71,8 @@ def test_sleep__no_retry_after_header__multiple_retries(self, t_mock, retry_poli
expected_backoff_times = []
for attempt in range(num_attempts):
expected_backoff_times.append(
max(
self.calculate_backoff_time(
attempt, retry_policy.delay_min, retry_policy.delay_max
),
retry_policy.delay_max,
self.calculate_backoff_time(
attempt, retry_policy.delay_min, retry_policy.delay_max
)
)

Expand Down
Loading