Repository navigation
Closed
Labels
p2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.
Description
Summary
This issue tracks a set of reliability and contributor-experience problems found while running the full test suite locally (not slow and slow).
The work includes test/doc/example hardening so the suite is stable across common local environments (Ollama/HF/Apple Silicon).
Problems Observed
1) Missing prerequisite not clearly documented
- Unit/test runs failed due to missing NLTK tokenizer resource (
punkt_tab). - Contributor docs did not clearly call this out.
2) Docling crash/hang behavior on Macbook
- Rich document processing fails or behaves inconsistently on MPS.
- Needed a safer default path for Docling acceleration on Apple Silicon.
3) Slow/timeout-prone test/example behavior
- Some tests/examples took excessively long or timed out in broad runs.
- Slow-heavy paths were not consistently isolated from default fast loops.
4) Flaky intrinsic formatter slow tests (Transformers 5)
- Known intermittent failures in specific intrinsic combinations caused hard failures.
- These are environment/version-sensitive and non-deterministic.
5) Example robustness issues in local environments
m_servetool-calling example failed if a specific model (granite4:micro-h) was unavailable.- GSM8K example failed when dataset loading/URI path failed.
- Python decompose example failed on output-shape assumptions (
KeyError). - Session example did heavyweight execution on import path, increasing hang risk.
6) Plugin example API misuse
- Several plugin examples passed a list to
plugin_scopewhere varargs were expected.
7) Brittle assertion in sampling preset example
- Assertion depended on specific numeric tokens rather than stable semantic output.
Proposed Fixes
Documentation
- Add explicit prerequisite guidance for NLTK
punkt_tabin contributor/testing docs.
Runtime stability
- Force Docling CPU accelerator path on Apple Silicon/MPS to avoid crashes.
Test/marker hygiene
- Ensure slow-heavy tests are marked/isolated appropriately.
- Add targeted
xfailhandling for known flaky intrinsic formatter cases under Transformers 5:context_relevance_aloracontext-attributionuncertainty_alora
Example hardening
m_servetool-calling example: add model fallback candidates and graceful skip behavior.- GSM8K example: fail-soft when dataset loading fails (clean skip/exit).
- Decompose example: handle pipeline output variability defensively.
- Session example: move runtime execution behind
__main__, set bounded timeout, avoid heavy import-time work.
API correctness in examples
- Fix
plugin_scopeusage to pass varargs instead of a list.
Assertion resilience
- Relax brittle sampling preset assertion to validate stable expected behavior.
Validation
Broad test runs after fixes
uv run pytest -m "not slow" -vv --durations=40uv run pytest -m slow -vv --durations=40
No remaining hard failures in either broad run.
Acceptance Criteria
- Contributor docs clearly list required NLTK resource (
punkt_tab) for test runs. - Apple Silicon Docling path is stable (no MPS-related crash in affected workflows).
- Default non-slow suite passes consistently.
- Slow suite passes with only expected
xfail/skipoutcomes. - Examples do not fail hard due to common local environment variability (model availability, dataset load issues).
- Plugin examples use
plugin_scopeAPI correctly. - Known flaky intrinsic formatter combos are tracked and do not fail suite unexpectedly.
Activity
planetf1 commentedon Jun 23, 2026
PR #1292 covers the aLoRA-related items in this issue (Problems 3 & 4)
The proposed fixes called for
xfailmarkers oncontext_relevance_alora,context-attribution, anduncertainty_alora. PR #1292 goes further:inputs=→input_ids=ingenerate_with_transformers()restores PEFT aLoRA offset computation for all intrinsic tests (test: context_relevance_alora and uncertainty_alora fail on CPU — peft cannot compute aLoRA offsets without input_ids #1286)context-attribution— fixed with subset check (no longer flaky)uncertainty_alora— fixed with direction check (no longer flaky)context_relevance_alora—xfailapplied pending upstream truncation fix (context_relevance aLoRA adapter: missing max_completion_tokens causes JSONDecodeError in test; consider deprecating #1301)Additionally, PR #1269 (Epic #929 Phase 1) fixes
_find_adapterordering so aLoRA is consistently preferred over LoRA, improvingcontext-attributionandgroundedness_e2epass rates as a side effect.The acceptance criterion "Slow suite passes with only expected xfail/skip outcomes" should be met once #1292 merges. The remaining open items in this issue (NLTK docs, Docling MPS, example hardening, plugin_scope API, sampling assertion) are not touched by either PR.
planetf1 commentedon Jun 23, 2026
Issue #1318 also contributes to Problem 3 (slow/timeout-prone tests)
The five
test_tracing_backend.pytests (test_span_duration_captures_async_operation,test_context_propagation_parent_child,test_token_usage_recorded_after_completion,test_span_not_closed_prematurely,test_multiple_generations_separate_spans) are alle2e + ollamabut not markedslow, so they run in the standardnot slowsuite. When Ollama is under load locally — the same condition as a saturated CI runner — they hithttpx.ReadTimeoutand appear as hard failures.#1318 proposes applying the same split-and-mock treatment used in PR #1302: fast mocked equivalents run on every push; real-Ollama variants marked
slow. Once that lands, the acceptance criterion "Default non-slow suite passes consistently" should be met for this failure class too.planetf1 commentedon Jun 23, 2026
A few thoughts on the approach.
xfail handling for intrinsic tests
As noted in my earlier comment, #1292 takes a different route to the proposed xfail-all approach — two of the three failures turned out to be fixable with better-calibrated assertions. Worth carrying that pattern forward: reach for a tighter assertion before reaching for
xfail, and savexfailfor cases where the root cause is genuinely upstream.Fail-soft in examples
Silent catches will just make CI pass quietly for the wrong reasons. The pattern already in the test suite — explicit
skipifwith a reason string — is more honest about what was skipped and why.plugin_scopeAPI misuseFixing the examples is necessary but the trap will catch the next person too. Might be worth a follow-on issue to add a guard in
plugin_scopeitself with a clear error message.Docling on Apple Silicon
What's the intended fix here? The issue mentions "safer default path" but the options have fairly different trade-offs. Forcing CPU is the bluntest approach and will make Docling noticeably slower on the machines most likely to have the problem. Pinning a Docling version that's known-good on MPS is cleaner if the crash is version-specific. Skipping the test on Apple Silicon with an explicit reason is honest but loses coverage. And if the crash is inside Docling itself rather than in how we call it, the real fix may be upstream. Worth being clear about which of these is actually being proposed.
planetf1 commentedon Jun 23, 2026
I should also say … I 100% agree we need to get these tests stable across different hardware configurations - else how can we know the code works, or whether we broke it when fixing something else…. !
exequeryphil commentedon Jun 23, 2026
Yes, for Apple Silicon, I was thinking something like
AcceleratorOptions(device=AcceleratorDevice.CPU). Trading speed for stability, but it seems tolerable on my machine.Agree with on your thoughts re
xfailhandling.I guess we can consider 3/4 in progress then.
In the meantime, I can create a small PR for the NLTK prerequisite docs.
And yes, after a making a small change locally, it was a little disconcerting to run the tests and see all the failures. It would be good to either add a proviso that 'only limited tests work in your local environment' or ensure that some reasonable regression is possible.
rafvasq commentedon Nov 10, 2026
Ran the test suite and the handful of failures I found are not due to instability. I'll close this issue since I believe the core concern (reliability and contributor-experience when running the tests) has been addressed.
Feel free to reopen/open a new issue if needed!