Add wall-clock timeout to reflect operations#643
Merged
nicoloboschi merged 3 commits intovectorize-io:mainfrom Mar 23, 2026
Merged
Add wall-clock timeout to reflect operations#643nicoloboschi merged 3 commits intovectorize-io:mainfrom
nicoloboschi merged 3 commits intovectorize-io:mainfrom
Conversation
…o#642) Add a configurable wall-clock timeout (default: 300s / 5 minutes) for the entire reflect operation. This prevents reflect calls from hanging for up to 40 minutes when LLM calls are slow or iteration counts are high. Changes: - Add DEFAULT_REFLECT_WALL_TIMEOUT (300s) config constant - Add HINDSIGHT_API_REFLECT_WALL_TIMEOUT env variable support - Wrap run_reflect_agent() with asyncio.wait_for() in reflect_async() - Return HTTP 504 on timeout in the reflect HTTP endpoint - Add unit test for wall-clock timeout enforcement Co-authored-by: ThePlenkov <6381507+ThePlenkov@users.noreply.github.com> Agent-Logs-Url: https://github.com/ThePlenkov/hindsight/sessions/a123d68b-aca1-4040-8bba-8c4f0fab2e2c
…py TypeError, overlapping exceptions, lazy logging) Co-authored-by: ThePlenkov <6381507+ThePlenkov@users.noreply.github.com> Agent-Logs-Url: https://github.com/ThePlenkov/hindsight/sessions/dd574a88-53a3-4f9e-bba7-5a40b0eddb99
nicoloboschi
added a commit
that referenced
this pull request
Mar 23, 2026
…nt build progenitor-impl-0.11.2 panics with `assertion failed: response_types.len() <= 1` when an endpoint declares more than one response type. PR #643 added `responses={504: ...}` to the reflect decorator, which injected a second response type into the generated OpenAPI spec and broke the Rust client build. Remove the `responses=` kwarg — the 504 is still raised at runtime via JSONResponse(status_code=504), it just won't appear in the OpenAPI schema. Regenerate openapi.json accordingly.
nicoloboschi
added a commit
that referenced
this pull request
Mar 23, 2026
…accept_with() enrichment (#650) * test: add unit tests for pg_trgm auto-detection and ValidationResult.accept_with() enrichment Two recent PRs landed without dedicated tests: - #626/#649 (pg_trgm fallback in EntityResolver): add 5 mocked unit tests covering the trigram→full fallback, single-check guarantee, and sticky downgrade behaviour. - #639 (accept_with() enrichment): add 7 pure unit tests for the factory method plus 5 integration tests verifying the engine applies enriched contents (retain) and tags/tag_groups (recall) returned by validators. Also verifies RecallContext carries tag filter state. * fix: remove 504 from reflect OpenAPI spec to fix progenitor Rust client build progenitor-impl-0.11.2 panics with `assertion failed: response_types.len() <= 1` when an endpoint declares more than one response type. PR #643 added `responses={504: ...}` to the reflect decorator, which injected a second response type into the generated OpenAPI spec and broke the Rust client build. Remove the `responses=` kwarg — the 504 is still raised at runtime via JSONResponse(status_code=504), it just won't appear in the OpenAPI schema. Regenerate openapi.json accordingly. * chore: sync generated files and ruff formatting (lint + docs skill)
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.
Reflect has no overall timeout. With high budget (20 iterations × 120s LLM timeout), a single call can hang for ~40 minutes.
Changes
HINDSIGHT_API_REFLECT_WALL_TIMEOUTenv var (default 300s)run_reflect_agent()inasyncio.wait_for()insidereflect_async()TimeoutErrorin reflect endpoint, return 504MCP callers are already covered by the existing
except Exceptionhandler—no changes needed there.Timeout is enforced at the
reflect_async()level so both HTTP and MCP callers are protected.Reflect operations have no overall wall-clock timeout ��� only per-LLM-call timeouts. With high budget (20 iterations �� 120s default LLM timeout), a reflect call can hang for ~40 minutes.
Fixes REDACTED` (http block)
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.