fix(worker): bound wedged consolidation tasks - #3746
Open
Sanderhoff-alt wants to merge 1 commit into
Open
Conversation
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
Sanderhoff-alt
force-pushed
the
fix/issue-3726-consolidation-timeout
branch
from
August 24, 2026 05:15
11c8a61 to
ddf0c7e
Compare
Add a configurable two-hour wall-clock ceiling for consolidation worker operations and route it through the existing timeout and failure handling. Timed-out consolidations are cancelled and marked failed so they can be retried instead of holding a worker slot indefinitely. Document the new setting and cover timeout, disable, and cancellation behavior with tests.
Sanderhoff-alt
force-pushed
the
fix/issue-3726-consolidation-timeout
branch
from
August 24, 2026 05:17
ddf0c7e to
08ea3fa
Compare
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.
Summary
Consolidation worker tasks were not covered by the existing task-level wall-clock timeout. A wedged consolidation could therefore remain in
processingindefinitely, hold a reserved worker slot, and prevent consolidation backlog recovery until the worker restarted. This PR extends the existing timeout path with a dedicated consolidation ceiling and keeps the behavior opt-out through configuration.State Transition
flowchart LR A[Consolidation claimed] --> B{Completes before ceiling?} B -->|Yes| C[completed] B -->|No| D[Executor cancelled] D --> E[failed] E --> F[Retry API requeues task]Configuration
HINDSIGHT_API_CONSOLIDATION_WALL_TIMEOUT7200secondsHINDSIGHT_API_CONSOLIDATION_WALL_TIMEOUT=0Implementation
consolidationto a dedicated wall-timeout configuration and reuseasyncio.timeout()cancellation/failure handlingconsolidation_wall_timeoutwith a two-hour defaultCompatibility
This is backward compatible for existing deployments: the new default only applies to consolidation tasks, uses a deliberately longer ceiling than retain, and can be disabled with
0. Existing retain and reflect timeout behavior is unchanged.Verification
uv run pytest tests/test_worker_wall_timeout.py tests/test_config_validation.py -q-> 98 passeduv run ruff check hindsight_api/config.py hindsight_api/worker/poller.py tests/test_worker_wall_timeout.pyuv run ruff format --check hindsight_api/config.py hindsight_api/worker/poller.py tests/test_worker_wall_timeout.pyCloses #3726