Skip to content

feat(extract): add timeout for LLM extraction step#604

Merged
cpcloud merged 1 commit intomainfrom
worktree-squishy-meandering-toucan
Mar 4, 2026
Merged

feat(extract): add timeout for LLM extraction step#604
cpcloud merged 1 commit intomainfrom
worktree-squishy-meandering-toucan

Conversation

@cpcloud
Copy link
Copy Markdown
Collaborator

@cpcloud cpcloud commented Mar 4, 2026

Summary

  • Add configurable extraction.llm_timeout (env: MICASA_EXTRACTION_LLM_TIMEOUT, default: 2m) to bound LLM extraction inference time
  • On timeout, the overlay shows an actionable message: timed out after Xs -- increase extraction.llm_timeout in config
  • Non-timeout errors preserve their original message unchanged
  • Timeout context is properly cleaned up on completion, user cancellation, and rerun

closes #486

LLM extraction previously ran with an unbounded context, so a slow
model (e.g. qwen3:0.6b on an image) could hang indefinitely with no way
to bail out other than manually cancelling the overlay.

Add a configurable `extraction.llm_timeout` (env:
MICASA_EXTRACTION_LLM_TIMEOUT, default: 2m) that wraps the ChatStream
context with a deadline. On timeout the overlay shows an actionable
message pointing users to the config key. The timeout context is
properly cleaned up on completion, cancellation, and rerun.

closes #486
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 65.78947% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.06%. Comparing base (0505086) to head (6286db6).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
internal/app/extraction.go 56.66% 12 Missing and 1 partial ⚠️
internal/app/types.go 0.00% 9 Missing ⚠️
internal/config/config.go 88.88% 2 Missing and 1 partial ⚠️
cmd/micasa/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #604      +/-   ##
==========================================
- Coverage   76.13%   76.06%   -0.08%     
==========================================
  Files          63       63              
  Lines       18579    18673      +94     
==========================================
+ Hits        14145    14203      +58     
- Misses       3757     3790      +33     
- Partials      677      680       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cpcloud cpcloud merged commit ab450ff into main Mar 4, 2026
18 checks passed
@cpcloud cpcloud deleted the worktree-squishy-meandering-toucan branch March 4, 2026 13:04
cpcloud added a commit that referenced this pull request Mar 19, 2026
## Summary

- Add configurable `extraction.llm_timeout` (env:
`MICASA_EXTRACTION_LLM_TIMEOUT`, default: 2m) to bound LLM extraction
inference time
- On timeout, the overlay shows an actionable message: `timed out after
Xs -- increase extraction.llm_timeout in config`
- Non-timeout errors preserve their original message unchanged
- Timeout context is properly cleaned up on completion, user
cancellation, and rerun

closes #486
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.

feat(extract): add timeout for LLM extraction step

1 participant